]> git.saurik.com Git - apple/security.git/blob - SecurityTests/regressions/kc/kc-10-unlock-noui.c
Security-57031.1.35.tar.gz
[apple/security.git] / SecurityTests / regressions / kc / kc-10-unlock-noui.c
1 #include <Security/SecKeychain.h>
2
3 #include "testmore.h"
4 #include "testenv.h"
5
6 int main(int argc, char *const *argv)
7 {
8 int dont_skip = argc > 1 && !strcmp(argv[1], "-s");
9
10 plan_tests(7);
11
12 ok_status(SecKeychainSetUserInteractionAllowed(FALSE), "SecKeychainSetUserInteractionAllowed(FALSE)");
13 if (!tests_begin(argc, argv))
14 BAIL_OUT("tests_begin failed");
15
16 SecKeychainRef keychain;
17 ok_status(SecKeychainCreate("test", 4, "test", FALSE, NULL, &keychain),
18 "SecKeychainCreate");
19 ok_status(SecKeychainLock(keychain), "SecKeychainLock");
20 SKIP: {
21 skip("<rdar://problem/3916692> 8A325 SecKeychainSetUserInteractionAllowed() doesn't affect kc unlock dialogs", 1, dont_skip);
22
23 is_status(SecKeychainUnlock(keychain, 0, NULL, FALSE),
24 errSecInteractionNotAllowed, "SecKeychainUnlock");
25 }
26 ok_status(SecKeychainLock(keychain), "SecKeychainLock");
27 CFRelease(keychain);
28
29 ok_status(SecKeychainOpen("test", &keychain), "SecKeychainOpen locked kc");
30 SKIP: {
31 skip("<rdar://problem/3916692> 8A325 SecKeychainSetUserInteractionAllowed() doesn't affect kc unlock dialogs", 1, dont_skip);
32
33 is_status(SecKeychainUnlock(keychain, 0, NULL, FALSE),
34 errSecInteractionNotAllowed, "SecKeychainUnlock");
35 }
36 return !tests_end(1);
37 }