]> git.saurik.com Git - apple/security.git/blobdiff - OSX/libsecurity_keychain/regressions/kc-21-item-use-callback.c
Security-57740.51.3.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / regressions / kc-21-item-use-callback.c
index 808c93abf7630952541fcb0332f0f8f330d6e3e5..e373db8987afc64f03a60f993142e022efe72db6 100644 (file)
@@ -6,6 +6,13 @@
 #include "keychain_regressions.h"
 #include "kc-helpers.h"
 
+/*
+ Note: to force a failure, run this as root:
+    chmod o-r /var/db/mds/messages/se_SecurityMessages
+ Restore with
+    chmod o+r /var/db/mds/messages/se_SecurityMessages
+ */
+
 static char account[] = "account";
 static char service[] = "service";
 static char password[] = "password";
@@ -32,6 +39,7 @@ static void checkContent(SecKeychainItemRef itemRef)
     is(length, sizeof(password), "<rdar://problem/3867900> "
         "SecKeychainItemCopyContent() returns bad data on items "
         "from notifications");
+    ok(data, "received data from item");
 
     ok(!memcmp(password, data, length), "password data matches.");
 
@@ -61,7 +69,7 @@ static OSStatus callbackFunction(SecKeychainEvent keychainEvent,
 int
 kc_21_item_use_callback(int argc, char *const *argv)
 {
-       plan_tests(14);
+       plan_tests(16);
 
     // Run the CFRunLoop to clear out existing notifications
     CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0, false);
@@ -85,6 +93,8 @@ kc_21_item_use_callback(int argc, char *const *argv)
 
        CFRelease(itemRef);
 
+    ok_status(SecKeychainRemoveCallback(callbackFunction), "Remove callback");
+
     ok_status(SecKeychainDelete(keychain), "%s: SecKeychainDelete", testName);
        CFRelease(keychain);