diff options
author | vasilii <vasilii@chromium.org> | 2015-06-30 03:08:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-30 10:09:09 +0000 |
commit | 0b57b117fdabefd8584a99064822d50deea6d52a (patch) | |
tree | e2cb53b4f40e2d9e422ee693fcd99210df73d28e /crypto/mock_apple_keychain_mac.cc | |
parent | 03962f9b02d62493eee010a233cd4b9949eaa5cc (diff) | |
download | chromium_src-0b57b117fdabefd8584a99064822d50deea6d52a.zip chromium_src-0b57b117fdabefd8584a99064822d50deea6d52a.tar.gz chromium_src-0b57b117fdabefd8584a99064822d50deea6d52a.tar.bz2 |
Implement Mac Keychain migration algorithm.
This code is currently not actually running, so no migration is happening yet.
Design doc: https://docs.google.com/a/google.com/document/d/1A8ZG16bLuUH1u21K0GoABKz_wpz1kchXMnMlpmq_ecA/edit?usp=sharing
BUG=466638
Review URL: https://codereview.chromium.org/1207373002
Cr-Commit-Position: refs/heads/master@{#336756}
Diffstat (limited to 'crypto/mock_apple_keychain_mac.cc')
-rw-r--r-- | crypto/mock_apple_keychain_mac.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/crypto/mock_apple_keychain_mac.cc b/crypto/mock_apple_keychain_mac.cc index d586f70..5f33e5b 100644 --- a/crypto/mock_apple_keychain_mac.cc +++ b/crypto/mock_apple_keychain_mac.cc @@ -13,7 +13,8 @@ const SecKeychainSearchRef MockAppleKeychain::kDummySearchRef = reinterpret_cast<SecKeychainSearchRef>(1000); MockAppleKeychain::MockAppleKeychain() - : next_item_key_(0), + : locked_(false), + next_item_key_(0), search_copy_count_(0), keychain_item_copy_count_(0), attribute_data_copy_count_(0), @@ -195,6 +196,9 @@ OSStatus MockAppleKeychain::ItemCopyAttributesAndData( return errSecInvalidItemRef; DCHECK(!itemClass); // itemClass not implemented in the Mock. + if (locked_ && outData) + return errSecAuthFailed; + if (attrList) *attrList = &(keychain_attr_list_[key]); if (outData) { @@ -213,6 +217,8 @@ OSStatus MockAppleKeychain::ItemModifyAttributesAndData( UInt32 length, const void* data) const { DCHECK(itemRef); + if (locked_) + return errSecAuthFailed; const char* fail_trigger = "fail_me"; if (length == strlen(fail_trigger) && memcmp(data, fail_trigger, length) == 0) { @@ -248,6 +254,8 @@ OSStatus MockAppleKeychain::ItemFreeAttributesAndData( } OSStatus MockAppleKeychain::ItemDelete(SecKeychainItemRef itemRef) const { + if (locked_) + return errSecAuthFailed; MockKeychainItemType key = reinterpret_cast<MockKeychainItemType>(itemRef) - 1; @@ -390,6 +398,8 @@ OSStatus MockAppleKeychain::AddInternetPassword( UInt32 passwordLength, const void* passwordData, SecKeychainItemRef* itemRef) const { + if (locked_) + return errSecAuthFailed; // Check for the magic duplicate item trigger. if (strcmp(serverName, "some.domain.com") == 0) |