1010
1111// Nice global
1212extern SQLiteStorage *traceStorage;
13-
13+ extern NSString *objectTypeNotSupported;
1414
1515// Hook SecItemAdd()
1616static OSStatus (*original_SecItemAdd)(CFDictionaryRef attributes, CFTypeRef *result);
1717
1818static OSStatus replaced_SecItemAdd (CFDictionaryRef attributes, CFTypeRef *result){
19-
19+
2020 OSStatus origResult = original_SecItemAdd (attributes, result);
2121
2222 // Need the call stack inspector or we get into a weird infinite loop of SecItemAdd() calls
2323 // because SecIdentityCopyCertificate() seems to call SecItemAdd(), or something...
2424 if ([CallStackInspector wasDirectlyCalledByApp ]) {
2525 CallTracer *tracer = [[CallTracer alloc ] initWithClass: @" C" andMethod: @" SecItemAdd" ];
2626 [tracer addArgFromPlistObject: [PlistObjectConverter convertSecItemAttributesDict: attributes] withKey: @" attributes" ];
27- [tracer addArgFromPlistObject: [ NSNumber numberWithUnsignedInt: ( unsigned int )result] withKey: @" result" ];
27+ [tracer addArgFromPlistObject: objectTypeNotSupported withKey: @" result" ];
2828 [tracer addReturnValueFromPlistObject: [NSNumber numberWithInt: origResult]];
2929 [traceStorage saveTracedCall: tracer];
3030 [tracer release ];
@@ -41,7 +41,7 @@ static OSStatus replaced_SecItemCopyMatching(CFDictionaryRef query, CFTypeRef *r
4141 OSStatus origResult = original_SecItemCopyMatching (query, result);
4242 CallTracer *tracer = [[CallTracer alloc ] initWithClass: @" C" andMethod: @" SecItemCopyMatching" ];
4343 [tracer addArgFromPlistObject: (NSDictionary *)query withKey: @" query" ];
44- [tracer addArgFromPlistObject: [ NSNumber numberWithUnsignedInt: ( unsigned int )result] withKey: @" result" ];
44+ [tracer addArgFromPlistObject: objectTypeNotSupported withKey: @" result" ];
4545 [tracer addReturnValueFromPlistObject: [NSNumber numberWithInt: origResult]];
4646 [traceStorage saveTracedCall: tracer];
4747 [tracer release ];
@@ -68,7 +68,7 @@ static OSStatus replaced_SecItemDelete(CFDictionaryRef query){
6868
6969static OSStatus replaced_SecItemUpdate (CFDictionaryRef query, CFDictionaryRef attributesToUpdate){
7070 OSStatus origResult = original_SecItemUpdate (query, attributesToUpdate);
71-
71+
7272 if ([CallStackInspector wasDirectlyCalledByApp ]) {
7373 CallTracer *tracer = [[CallTracer alloc ] initWithClass: @" C" andMethod: @" SecItemUpdate" ];
7474 [tracer addArgFromPlistObject: (NSDictionary *)query withKey: @" query" ];
@@ -81,7 +81,7 @@ static OSStatus replaced_SecItemUpdate(CFDictionaryRef query, CFDictionaryRef at
8181}
8282
8383
84- @implementation KeychainHooks
84+ @implementation KeychainHooks
8585
8686+ (void )enableHooks {
8787 MSHookFunction (SecItemAdd, replaced_SecItemAdd, (void **) &original_SecItemAdd);
0 commit comments