#include <Security/SecAccess.h>
#include <Security/Access.h>
#include "SecBridge.h"
CFTypeID SecAccessGetTypeID(void)
{
BEGIN_SECAPI
return gTypes().access.typeId;
END_SECAPI1(_kCFRuntimeNotATypeID)
}
OSStatus SecAccessCreate(CFStringRef descriptor, CFArrayRef trustedList, SecAccessRef *accessRef)
{
BEGIN_SECAPI
Required(descriptor);
RefPointer<Access> access;
if (trustedList) {
CFIndex length = CFArrayGetCount(trustedList);
ACL::ApplicationList trusted;
for (CFIndex n = 0; n < length; n++)
trusted.push_back(gTypes().trustedApplication.required(
SecTrustedApplicationRef(CFArrayGetValueAtIndex(trustedList, n))));
access = new Access(cfString(descriptor), trusted);
} else {
access = new Access(cfString(descriptor));
}
Required(accessRef) = gTypes().access.handle(*access);
END_SECAPI
}
OSStatus SecAccessCreateFromOwnerAndACL(const CSSM_ACL_OWNER_PROTOTYPE *owner,
uint32 aclCount, const CSSM_ACL_ENTRY_INFO *acls,
SecAccessRef *accessRef)
{
BEGIN_SECAPI
Required(accessRef); RefPointer<Access> access = new Access(Required(owner), aclCount, &Required(acls));
*accessRef = gTypes().access.handle(*access);
END_SECAPI
}
OSStatus SecAccessGetOwnerAndACL(SecAccessRef accessRef,
CSSM_ACL_OWNER_PROTOTYPE_PTR *owner,
uint32 *aclCount, CSSM_ACL_ENTRY_INFO_PTR *acls)
{
BEGIN_SECAPI
#if 0
gTypes().access.required(accessRef)->copyOwnerAndAcl(
Required(owner), Required(aclCount), Required(acls));
#endif
END_SECAPI
}
OSStatus SecAccessCopyACLList(SecAccessRef accessRef,
CFArrayRef *aclList)
{
BEGIN_SECAPI
Required(aclList) = gTypes().access.required(accessRef)->copySecACLs();
END_SECAPI
}
OSStatus SecAccessCopySelectedACLList(SecAccessRef accessRef,
CSSM_ACL_AUTHORIZATION_TAG action,
CFArrayRef *aclList)
{
BEGIN_SECAPI
Required(aclList) = gTypes().access.required(accessRef)->copySecACLs(action);
END_SECAPI
}