- CodeSigning::OSXCode *processCode = Server::process().clientCode();
- string processName = processCode ? processCode->canonicalPath() : "unknown";
- CodeSigning::OSXCode *authCreatorCode = auth.creatorCode();
- string authCreatorName = authCreatorCode ? authCreatorCode->canonicalPath() : "unknown";
-
- if (result == errAuthorizationSuccess)
- Syslog::info("Succeeded authorizing right %s by process %s for authorization created by %s.", (*it)->name(), processName.c_str(), authCreatorName.c_str());
- else if (result == errAuthorizationDenied)
- Syslog::notice("Failed to authorize right %s by process %s for authorization created by %s.", (*it)->name(), processName.c_str(), authCreatorName.c_str());
+ string processName = "unknown";
+ if (SecCodeRef code = Server::process().currentGuest()) {
+ CFRef<CFURLRef> path;
+ if (!SecCodeCopyPath(code, kSecCSDefaultFlags, &path.aref()))
+ processName = cfString(path);
+ }
+ string authCreatorName = "unknown";
+ if (SecStaticCodeRef code = auth.creatorCode()) {
+ CFRef<CFURLRef> path;
+ if (!SecCodeCopyPath(code, kSecCSDefaultFlags, &path.aref()))
+ authCreatorName = cfString(path);
+ }
+
+ if (result == errAuthorizationSuccess) {
+ Syslog::info("Succeeded authorizing right %s by client %s for authorization created by %s.", (*it)->name(), processName.c_str(), authCreatorName.c_str());
+ CommonCriteria::AuditRecord auditrec(auth.creatorAuditToken());
+ auditrec.submit(AUE_ssauthorize, CommonCriteria::errNone, (*it)->name());
+ } else if (result == errAuthorizationDenied) {
+ Syslog::notice("Failed to authorize right %s by client %s for authorization created by %s.", (*it)->name(), processName.c_str(), authCreatorName.c_str());
+ }