X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/fa7225c82381bac4432a6edf16f53b5370238d85..6b200bc335dc93c5516ccb52f14bd896d8c7fad7:/OSX/libsecurity_keychain/lib/Item.cpp diff --git a/OSX/libsecurity_keychain/lib/Item.cpp b/OSX/libsecurity_keychain/lib/Item.cpp index 07907423..dad801c5 100644 --- a/OSX/libsecurity_keychain/lib/Item.cpp +++ b/OSX/libsecurity_keychain/lib/Item.cpp @@ -77,8 +77,8 @@ ItemImpl *ItemImpl::required(SecKeychainItemRef ptr) ItemImpl *ItemImpl::optional(SecKeychainItemRef ptr) { - if (SecCFObject *p = KeyItem::fromSecKeyRef(ptr)) { - return dynamic_cast(p); + if (ptr != NULL && CFGetTypeID(ptr) == SecKeyGetTypeID()) { + return dynamic_cast(KeyItem::fromSecKeyRef(ptr)); } else if (SecCFObject *p = SecCFObject::optional(ptr)) { if (ItemImpl *pp = dynamic_cast(p)) { return pp; @@ -470,8 +470,6 @@ void ItemImpl::computeDigestFromDictionary(CssmOwnedData &sha2, DbAttributes* db } void ItemImpl::addIntegrity(Access &access, bool force) { - secnotice("integrity", "called"); - if(!force && (!mKeychain || !mKeychain->hasIntegrityProtection())) { secnotice("integrity", "skipping integrity add due to keychain version\n"); return; @@ -881,8 +879,6 @@ ItemImpl::updateSSGroup(Db& db, CSSM_DB_RECORDTYPE recordType, CssmDataContainer AclFactory aclFactory; const AccessCredentials *nullCred = aclFactory.nullCred(); - secnotice("integrity", "called"); - bool haveOldUniqueId = !!mUniqueId.get(); SSDbUniqueRecord ssUniqueId(NULL); SSGroup ssGroup(NULL); @@ -1318,6 +1314,8 @@ void ItemImpl::modifyContent(const SecKeychainAttributeList *attrList, UInt32 dataLength, const void *inData) { StLock_(mMutex); + unique_ptr __(mKeychain == NULL ? NULL : new StReadWriteLock(*(mKeychain->getKeychainReadWriteLock()), StReadWriteLock::Write)); + if (!mDbAttributes.get()) { mDbAttributes.reset(new DbAttributes());