X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/e3d460c9de4426da6c630c3ae3f46173a99f82d8..7e6b461318c8a779d91381531435a68ee4e8b6ed:/OSX/libsecurity_codesigning/lib/singlediskrep.cpp?ds=sidebyside diff --git a/OSX/libsecurity_codesigning/lib/singlediskrep.cpp b/OSX/libsecurity_codesigning/lib/singlediskrep.cpp index 84c5a781..c475d78c 100644 --- a/OSX/libsecurity_codesigning/lib/singlediskrep.cpp +++ b/OSX/libsecurity_codesigning/lib/singlediskrep.cpp @@ -82,6 +82,14 @@ size_t SingleDiskRep::signingLimit() 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. // @@ -89,7 +97,6 @@ FileDesc &SingleDiskRep::fd() { if (!mFd) mFd.open(mPath, O_RDONLY); - return mFd; } @@ -101,6 +108,11 @@ void SingleDiskRep::flush() 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, @@ -118,6 +130,11 @@ string SingleDiskRep::recommendedIdentifier(const SigningContext &) 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())