X-Git-Url: https://git.saurik.com/apple/securityd.git/blobdiff_plain/5968d166aac117ec986929b2f8fb9ce7fae2e599..4cd1cad0dea00daa03e1b54fdf2797a02373ad5b:/src/AuthorizationEngine.cpp?ds=sidebyside diff --git a/src/AuthorizationEngine.cpp b/src/AuthorizationEngine.cpp index 01560b0..b989fc3 100644 --- a/src/AuthorizationEngine.cpp +++ b/src/AuthorizationEngine.cpp @@ -164,16 +164,15 @@ Engine::authorize(const AuthItemSet &inRights, const AuthItemSet &environment, string processName = "unknown"; string authCreatorName = "unknown"; - if (SecCodeRef code = Server::process().currentGuest()) { - CFRef path; - if (!SecCodeCopyPath(code, kSecCSDefaultFlags, &path.aref())) - processName = cfString(path); - } - if (SecStaticCodeRef code = auth.creatorCode()) { - CFRef path; - if (!SecCodeCopyPath(code, kSecCSDefaultFlags, &path.aref())) - authCreatorName = cfString(path); + { + StLock _(Server::process()); + if (SecCodeRef code = Server::process().currentGuest()) { + CFRef path; + if (!SecCodeCopyPath(code, kSecCSDefaultFlags, &path.aref())) + processName = cfString(path); + } } + authCreatorName = auth.creatorPath(); if (sandbox_check(Server::process().pid(), "authorization-right-obtain", SANDBOX_FILTER_RIGHT_NAME, (*it)->name())) { Syslog::error("Sandbox denied authorizing right '%s' by client '%s' [%d]", (*it)->name(), processName.c_str(), Server::process().pid()); @@ -194,13 +193,13 @@ Engine::authorize(const AuthItemSet &inRights, const AuthItemSet &environment, if (result == errAuthorizationSuccess) { outRights.insert(*it); - Syslog::info("Succeeded authorizing right '%s' by client '%s' [%d] for authorization created by '%s' [%d]", (*it)->name(), processName.c_str(), Server::process().pid(), authCreatorName.c_str(), auth.creatorPid()); + Syslog::info("Succeeded authorizing right '%s' by client '%s' [%d] for authorization created by '%s' [%d] (%X,%d)", (*it)->name(), processName.c_str(), Server::process().pid(), authCreatorName.c_str(), auth.creatorPid(), uint32_t(flags), auth.operatesAsLeastPrivileged()); } else if (result == errAuthorizationDenied || result == errAuthorizationInteractionNotAllowed) { if (result == errAuthorizationDenied) { - Syslog::notice("Failed to authorize right '%s' by client '%s' [%d] for authorization created by '%s' [%d]", (*it)->name(), processName.c_str(), Server::process().pid(), authCreatorName.c_str(), auth.creatorPid()); + secdebug("autheval", "Failed to authorize right '%s' by client '%s' [%d] for authorization created by '%s' [%d] (%X,%d)", (*it)->name(), processName.c_str(), Server::process().pid(), authCreatorName.c_str(), auth.creatorPid(), uint32_t(flags), auth.operatesAsLeastPrivileged()); } // add creator pid to authorization token