X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/c2a06e2499a2998aca30764dd75ee8aee5c5bc09..e3d3b979fd185d8303f28a937baa53a187fb8c7d:/libsecurity_cdsa_client/lib/dlclient.cpp?ds=inline diff --git a/libsecurity_cdsa_client/lib/dlclient.cpp b/libsecurity_cdsa_client/lib/dlclient.cpp index bac07b58..31510a53 100644 --- a/libsecurity_cdsa_client/lib/dlclient.cpp +++ b/libsecurity_cdsa_client/lib/dlclient.cpp @@ -23,6 +23,7 @@ #include #include #include +#include using namespace CssmClient; @@ -106,7 +107,6 @@ DbImpl::open() { { StLock _(mActivateMutex); - if (!mActive) { assert(mDbInfo == nil); @@ -114,10 +114,11 @@ DbImpl::open() check(CSSM_DL_DbOpen(mHandle.DLHandle, mDbName.canonicalName(), dbLocation(), mAccessRequest, mAccessCredentials, mOpenParameters, &mHandle.DBHandle)); + mActive = true; } - } - + } + if (!mAccessCredentials && mDefaultCredentials) if (const AccessCredentials *creds = mDefaultCredentials->makeCredentials()) CSSM_DL_Authenticate(handle(), mAccessRequest, creds); // ignore error @@ -367,6 +368,18 @@ DbImpl::unlock(const CSSM_DATA &password) check(CSSM_DL_PassThrough(handle(), CSSM_APPLECSPDL_DB_UNLOCK, &password, NULL)); } +void +DbImpl::stash() +{ + check(CSSM_DL_PassThrough(handle(), CSSM_APPLECSPDL_DB_STASH, NULL, NULL)); +} + +void +DbImpl::stashCheck() +{ + check(CSSM_DL_PassThrough(handle(), CSSM_APPLECSPDL_DB_STASH_CHECK, NULL, NULL)); +} + void DbImpl::getSettings(uint32 &outIdleTimeout, bool &outLockOnSleep) { @@ -437,7 +450,7 @@ void DbImpl::setBatchMode(Boolean mode, Boolean rollback) // // Now, toggle the autocommit... // - if ( result == noErr ) + if ( result == errSecSuccess ) { CSSM_BOOL modeToUse = !mode; if (rollback) @@ -448,7 +461,7 @@ void DbImpl::setBatchMode(Boolean mode, Boolean rollback) result = CSSM_DL_PassThrough(dldbHandleOfUnderlyingDL, CSSM_APPLEFILEDL_TOGGLE_AUTOCOMMIT, - (void *)(modeToUse), + (void *)((size_t) modeToUse), NULL); if (!rollback && modeToUse) result = CSSM_DL_PassThrough(dldbHandleOfUnderlyingDL,