* @APPLE_LICENSE_HEADER_END@
*/
-#include <SecBase.h>
+#include <Security/SecBase.h>
#include <Security/SecAccess.h>
#include <Security/SecAccessPriv.h>
#include <Security/SecTrustedApplication.h>
#include <utilities/SecCFWrappers.h>
+#include "LegacyAPICounts.h"
/* No restrictions. Permission to perform all operations on
the resource or available to an ACL owner. */
SecAccessRef SecAccessCreateWithOwnerAndACL(uid_t userId, gid_t groupId, SecAccessOwnerType ownerType, CFArrayRef acls, CFErrorRef *error)
{
+ COUNTLEGACYAPI
SecAccessRef result = NULL;
CSSM_ACL_PROCESS_SUBJECT_SELECTOR selector =
CFRelease(debugStr);
#endif
- CSSM_ACL_AUTHORIZATION_TAG rights[numAcls];
- memset(rights, 0, sizeof(rights));
+ std::vector<CSSM_ACL_AUTHORIZATION_TAG> rights(numAcls);
for (CFIndex iCnt = 0; iCnt < numAcls; iCnt++)
{
{ 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
}
}
OSStatus SecAccessCopyOwnerAndACL(SecAccessRef accessRef, uid_t* userId, gid_t* groupId, SecAccessOwnerType* ownerType, CFArrayRef* aclList)
{
+ COUNTLEGACYAPI
CSSM_ACL_OWNER_PROTOTYPE_PTR owner = NULL;
CSSM_ACL_ENTRY_INFO_PTR acls = NULL;
uint32 aclCount = 0;
CFArrayRef SecAccessCopyMatchingACLList(SecAccessRef accessRef, CFTypeRef authorizationTag)
{
+ COUNTLEGACYAPI
CFArrayRef result = NULL;
CSSM_ACL_AUTHORIZATION_TAG tag = GetACLAuthorizationTagFromString((CFStringRef)authorizationTag);
OSStatus err = SecAccessCopySelectedACLList(accessRef, tag, &result);
// Make a bundle instance using the URLRef.
secBundle = CFBundleCreate(kCFAllocatorDefault,bundleURL);
- if (!secBundle)
+ if (!secBundle) {
goto xit;
+ }
trustedAppListFileNameWithoutExtension =
CFStringCreateMutableCopy(NULL,CFStringGetLength(trustedAppListFileName),trustedAppListFileName);
// Look for a resource in the bundle by name and type
trustedAppsURL = CFBundleCopyResourceURL(secBundle,trustedAppListFileNameWithoutExtension,CFSTR("plist"),NULL);
- if (!trustedAppsURL)
+ if (!trustedAppsURL) {
goto xit;
+ }
- if ( trustedAppListFileNameWithoutExtension )
- CFRelease(trustedAppListFileNameWithoutExtension);
-
- if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,trustedAppsURL,&xmlDataRef,NULL,NULL,&errorCode))
+ if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault,trustedAppsURL,&xmlDataRef,NULL,NULL,&errorCode)) {
goto xit;
+ }
trustedAppsPlist = CFPropertyListCreateFromXMLData(kCFAllocatorDefault,xmlDataRef,kCFPropertyListImmutable,&errorString);
trustedAppList = (CFArrayRef)trustedAppsPlist;
xit:
+ CFReleaseNull(trustedAppListFileNameWithoutExtension);
if (bundleURL)
CFRelease(bundleURL);
if (secBundle)
OSStatus SecAccessCreateWithTrustedApplications(CFStringRef trustedApplicationsPListPath, CFStringRef accessLabel, Boolean allowAny, SecAccessRef* returnedAccess)
{
+ COUNTLEGACYAPI
OSStatus err = errSecSuccess;
SecAccessRef accessToReturn=nil;
CFMutableArrayRef trustedApplications=nil;