]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_keychain/regressions/kc-01-keychain-creation.c
2 #include <Security/SecKeychain.h>
4 #include "keychain_regressions.h"
5 #include "kc-helpers.h"
7 int kc_01_keychain_creation(int argc
, char *const *argv
)
11 ok_status(SecKeychainSetUserInteractionAllowed(FALSE
), "disable ui");
12 SecKeychainRef keychain
= createNewKeychain("test", "test");
14 skip("can't continue without keychain", 2, ok(keychain
, "keychain not NULL"));
16 is(CFGetRetainCount(keychain
), 1, "retaincount of created keychain is 1");
19 SecKeychainRef keychain2
= NULL
;
20 ok_status(SecKeychainOpen("test", &keychain2
), "SecKeychainOpen");
22 skip("can't continue without keychain", 2, ok(keychain
, "keychain not NULL"));
23 CFIndex retCount
= CFGetRetainCount(keychain2
);
24 is(retCount
, 2, "retaincount of created+opened keychain is 2"); // 2, because we opened and created the same keychain.
27 is(keychain
, keychain2
, "SecKeychainCreate and SecKeychainOpen returned a different handle for the same keychain");
29 ok_status(SecKeychainDelete(keychain
), "SecKeychainDelete");