X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/dbe775057b53a81d9983d810772462c3233fccd3..bf028f67fd3bb2266df81b80fb6f25a77112e308:/sectask/SecTask.c?ds=sidebyside diff --git a/sectask/SecTask.c b/sectask/SecTask.c index 57b635c0..a73416c7 100644 --- a/sectask/SecTask.c +++ b/sectask/SecTask.c @@ -35,14 +35,15 @@ #include #include #include +#include #include #if TARGET_OS_OSX /* These won't exist until we unify codesigning */ -#include "SecCode.h" -#include "SecCodePriv.h" -#include "SecRequirement.h" +#include +#include +#include #endif /* TARGET_OS_OSX */ struct __SecTask { @@ -132,6 +133,21 @@ SecTaskRef SecTaskCreateWithAuditToken(CFAllocatorRef allocator, audit_token_t t return task; } +_Nullable SecTaskRef +SecTaskCreateWithXPCMessage(xpc_object_t _Nonnull message) +{ + audit_token_t token; + + if (message == NULL || xpc_get_type(message) != XPC_TYPE_DICTIONARY) { + return NULL; + } + xpc_dictionary_get_audit_token(message, &token); + + return SecTaskCreateWithAuditToken(NULL, token); +} + + + struct csheader { uint32_t magic; uint32_t length; @@ -354,7 +370,7 @@ out: return values; } -#if TARGET_OS_OSX +#if SEC_OS_OSX /* * Determine if the given task meets a specified requirement. */ @@ -385,7 +401,7 @@ SecTaskValidateForRequirement(SecTaskRef task, CFStringRef requirement) return status; } -#endif /* TARGET_OS_OSX */ +#endif /* SEC_OS_OSX */ Boolean SecTaskEntitlementsValidated(SecTaskRef task) { // TODO: Cache the result