X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/fa7225c82381bac4432a6edf16f53b5370238d85..07691282a056c4efea71e1e505527601e8cc166b:/OSX/libsecurity_keychain/regressions/kc-21-item-use-callback.c diff --git a/OSX/libsecurity_keychain/regressions/kc-21-item-use-callback.c b/OSX/libsecurity_keychain/regressions/kc-21-item-use-callback.c index 808c93ab..e373db89 100644 --- a/OSX/libsecurity_keychain/regressions/kc-21-item-use-callback.c +++ b/OSX/libsecurity_keychain/regressions/kc-21-item-use-callback.c @@ -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), " " "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);