return fd().fileSize();
}
+//
+// No executable segment in non-machO files.
+//
+size_t SingleDiskRep::execSegLimit(const Architecture *)
+{
+ return 0;
+}
+
//
// A lazily opened read-only file descriptor for the path.
//
{
if (!mFd)
mFd.open(mPath, O_RDONLY);
-
return mFd;
}
mFd.close();
}
+//Check the magic darwinup xattr
+bool SingleDiskRep::appleInternalForcePlatform() const
+{
+ return mFd.hasExtendedAttribute("com.apple.root.installed");
+}
//
// The recommended identifier of a SingleDiskRep is, absent any better clue,
void SingleDiskRep::strictValidate(const CodeDirectory* cd, const ToleratedErrors& tolerated, SecCSFlags flags)
{
DiskRep::strictValidate(cd, tolerated, flags);
+
+ if (flags & kSecCSRestrictSidebandData)
+ if (fd().hasExtendedAttribute(XATTR_RESOURCEFORK_NAME) || fd().hasExtendedAttribute(XATTR_FINDERINFO_NAME))
+ if (tolerated.find(errSecCSInvalidAssociatedFileData) == tolerated.end())
+ MacOSError::throwMe(errSecCSInvalidAssociatedFileData);
// code limit must cover (exactly) the entire file
if (cd && cd->signingLimit() != signingLimit())