X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/fa7225c82381bac4432a6edf16f53b5370238d85..0d4552ce43ff8bf2e8666a9c5c44c3590eb117a8:/OSX/libsecurity_keychain/lib/SecAccess.cpp?ds=sidebyside diff --git a/OSX/libsecurity_keychain/lib/SecAccess.cpp b/OSX/libsecurity_keychain/lib/SecAccess.cpp index ba74e379..91680d82 100644 --- a/OSX/libsecurity_keychain/lib/SecAccess.cpp +++ b/OSX/libsecurity_keychain/lib/SecAccess.cpp @@ -21,12 +21,14 @@ * @APPLE_LICENSE_HEADER_END@ */ -#include +#include #include #include #include #include #include +#include +#include #include "SecBridge.h" #include @@ -230,6 +232,7 @@ CFStringRef GetAuthStringFromACLAuthorizationTag(sint32 tag) { result = (CFStringRef)CFDictionaryGetValue(gTagMapping, aNum); } + CFReleaseSafe(aNum); return result; } @@ -291,7 +294,7 @@ SecAccessRef SecAccessCreateWithOwnerAndACL(uid_t userId, gid_t groupId, SecAcce CSSM_ACL_PROCESS_SUBJECT_SELECTOR selector = { CSSM_ACL_PROCESS_SELECTOR_CURRENT_VERSION, // selector version - ownerType, + int_cast(ownerType), userId, groupId }; @@ -318,8 +321,7 @@ SecAccessRef SecAccessCreateWithOwnerAndACL(uid_t userId, gid_t groupId, SecAcce CFRelease(debugStr); #endif - CSSM_ACL_AUTHORIZATION_TAG rights[numAcls]; - memset(rights, 0, sizeof(rights)); + std::vector rights(numAcls); for (CFIndex iCnt = 0; iCnt < numAcls; iCnt++) { @@ -379,7 +381,7 @@ SecAccessRef SecAccessCreateWithOwnerAndACL(uid_t userId, gid_t groupId, SecAcce { CSSM_LIST_TYPE_UNKNOWN, &subject1, &subject2 }, false, // Delegate // rights for this entry - { (uint32)(sizeof(rights) / sizeof(rights[0])), rights }, + { (uint32)numAcls, rights.data() }, // rest is defaulted } } @@ -576,9 +578,6 @@ CFArrayRef copyTrustedAppListFromBundle(CFStringRef bundlePath, CFStringRef trus if (!trustedAppsURL) goto xit; - if ( trustedAppListFileNameWithoutExtension ) - CFRelease(trustedAppListFileNameWithoutExtension); - if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,trustedAppsURL,&xmlDataRef,NULL,NULL,&errorCode)) goto xit; @@ -586,6 +585,7 @@ CFArrayRef copyTrustedAppListFromBundle(CFStringRef bundlePath, CFStringRef trus trustedAppList = (CFArrayRef)trustedAppsPlist; xit: + CFReleaseNull(trustedAppListFileNameWithoutExtension); if (bundleURL) CFRelease(bundleURL); if (secBundle)