]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_keychain/regressions/kc-04-is-valid.c
1 #include <Security/SecKeychain.h>
2 #include <Security/SecKeychainPriv.h>
9 #include "keychain_regressions.h"
10 #include "kc-helpers.h"
12 static void tests(void)
14 char *home
= getenv("HOME");
15 char kcname1
[256], kcname2
[256];
17 if (!home
|| strlen(home
) > 200)
18 plan_skip_all("home too big");
20 sprintf(kcname1
, "%s/kctests/kc1-16-is-valid", home
);
21 SecKeychainRef kc1
= NULL
, kc2
= NULL
;
22 Boolean kc1valid
, kc2valid
;
23 kc1
= createNewKeychainAt(kcname1
, "test");
24 ok_status(SecKeychainIsValid(kc1
, &kc1valid
), "SecKeychainIsValid kc1");
25 is(kc1valid
, TRUE
, "is kc1 valid");
27 ok_status(SecKeychainDelete(kc1
), "%s: SecKeychainDelete", testName
);
31 sprintf(kcname2
, "%s/kctests/kc2-16-is-valid", home
);
32 ok_unix(fd
= open(kcname2
, O_CREAT
|O_WRONLY
|O_TRUNC
, 0600),
33 "create invalid kc2 file");
34 ok_unix(close(fd
), "close the kc2 file");
35 ok_status(SecKeychainOpen(kcname2
, &kc2
), "SecKeychainOpen kc2");
37 ok_status(SecKeychainIsValid(kc2
, &kc2valid
), "SecKeychainIsValid kc2");
39 todo("<rdar://problem/3795566> SecKeychainIsValid always returns "
41 is(kc2valid
, FALSE
, "is kc2 not valid");
44 ok_status(SecKeychainDelete(kc2
), "%s: SecKeychainDelete", testName
);
48 int kc_04_is_valid(int argc
, char *const *argv
)