//
// Construct a running process representation
//
-ProcessCode::ProcessCode(pid_t pid, PidDiskRep *pidDiskRep /*= NULL */)
- : GenericCode(KernelCode::active()), mPid(pid), mPidBased(pidDiskRep)
+ProcessCode::ProcessCode(pid_t pid, const audit_token_t* token, PidDiskRep *pidDiskRep /*= NULL */)
+ : SecCode(KernelCode::active()), mPid(pid), mPidBased(pidDiskRep)
{
+ if (token)
+ mAudit = new audit_token_t(*token);
+ else
+ mAudit = NULL;
}
-mach_port_t ProcessCode::getHostingPort()
+int ProcessCode::csops(unsigned int ops, void *addr, size_t size)
{
- return SecurityServer::ClientSession().hostingPort(pid());
+ // pass pid and audit token both if we have it, or just the pid if we don't
+ if (mAudit)
+ return ::csops_audittoken(mPid, ops, addr, size, mAudit);
+ else
+ return ::csops(mPid, ops, addr, size);
}
+
/*
*
*/
{
if (mGuest->pidBased()->supportInfoPlist())
return SecStaticCode::infoDictionary();
- return makeCFDictionary(0);
+ if (!mEmptyInfoDict) {
+ mEmptyInfoDict.take(makeCFDictionary(0));
+ }
+ return mEmptyInfoDict;
}
void ProcessDynamicCode::validateComponent(CodeDirectory::SpecialSlot slot, OSStatus fail /* = errSecCSSignatureFailed */)