ItemImpl *ItemImpl::optional(SecKeychainItemRef ptr)
{
- if (SecCFObject *p = KeyItem::fromSecKeyRef(ptr)) {
- return dynamic_cast<ItemImpl *>(p);
+ if (ptr != NULL && CFGetTypeID(ptr) == SecKeyGetTypeID()) {
+ return dynamic_cast<ItemImpl *>(KeyItem::fromSecKeyRef(ptr));
} else if (SecCFObject *p = SecCFObject::optional(ptr)) {
if (ItemImpl *pp = dynamic_cast<ItemImpl *>(p)) {
return pp;
}
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;
AclFactory aclFactory;
const AccessCredentials *nullCred = aclFactory.nullCred();
- secnotice("integrity", "called");
-
bool haveOldUniqueId = !!mUniqueId.get();
SSDbUniqueRecord ssUniqueId(NULL);
SSGroup ssGroup(NULL);
ItemImpl::modifyContent(const SecKeychainAttributeList *attrList, UInt32 dataLength, const void *inData)
{
StLock<Mutex>_(mMutex);
+ unique_ptr<StReadWriteLock> __(mKeychain == NULL ? NULL : new StReadWriteLock(*(mKeychain->getKeychainReadWriteLock()), StReadWriteLock::Write));
+
if (!mDbAttributes.get())
{
mDbAttributes.reset(new DbAttributes());