From f244584cbb226b05a323298d04022cba4c4496fa Mon Sep 17 00:00:00 2001 From: Teutates <103068388+Teutates@users.noreply.github.com> Date: Wed, 20 Jul 2022 17:13:17 -0400 Subject: Allow -P to work on directories --- ldid.cpp | 14 +++++++------- ldid.hpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ldid.cpp b/ldid.cpp index 6bcc248..2e54207 100644 --- a/ldid.cpp +++ b/ldid.cpp @@ -2822,7 +2822,7 @@ struct State { } }; -Bundle Sign(const std::string &root, Folder &parent, const std::string &key, State &local, const std::string &requirements, const Functor &alter, bool merge, const Progress &progress) { +Bundle Sign(const std::string &root, Folder &parent, const std::string &key, State &local, const std::string &requirements, const Functor &alter, bool merge, uint8_t platform, const Progress &progress) { std::string executable; std::string identifier; @@ -2930,7 +2930,7 @@ Bundle Sign(const std::string &root, Folder &parent, const std::string &key, Sta State remote; bundles[nested[1]] = Sign(root + bundle, subfolder, key, remote, "", Starts(name, "PlugIns/") ? alter : static_cast &>(fun([&](const std::string &, const std::string &) -> std::string { return entitlements; })) - , merge, progress); + , merge, platform, progress); local.Merge(bundle, remote); }), fun([&](const std::string &name, const Functor &read) { })); @@ -2984,7 +2984,7 @@ Bundle Sign(const std::string &root, Folder &parent, const std::string &key, Sta case MH_CIGAM: case MH_CIGAM_64: folder.Save(name, true, flag, fun([&](std::streambuf &save) { Slots slots; - Sign(header.bytes, size, data, hash, save, identifier, "", false, "", key, slots, length, 0, false, Progression(progress, root + name)); + Sign(header.bytes, size, data, hash, save, identifier, "", false, "", key, slots, length, 0, platform, Progression(progress, root + name)); })); return; } @@ -3114,16 +3114,16 @@ Bundle Sign(const std::string &root, Folder &parent, const std::string &key, Sta Slots slots; slots[1] = local.files.at(info); slots[3] = local.files.at(signature); - bundle.hash = Sign(NULL, 0, buffer, local.files[executable], save, identifier, entitlements, merge, requirements, key, slots, length, 0, false, Progression(progress, root + executable)); + bundle.hash = Sign(NULL, 0, buffer, local.files[executable], save, identifier, entitlements, merge, requirements, key, slots, length, 0, platform, Progression(progress, root + executable)); })); })); return bundle; } -Bundle Sign(const std::string &root, Folder &folder, const std::string &key, const std::string &requirements, const Functor &alter, bool merge, const Progress &progress) { +Bundle Sign(const std::string &root, Folder &folder, const std::string &key, const std::string &requirements, const Functor &alter, bool merge, uint8_t platform, const Progress &progress) { State local; - return Sign(root, folder, key, local, requirements, alter, merge, progress); + return Sign(root, folder, key, local, requirements, alter, merge, platform, progress); } #endif @@ -3445,7 +3445,7 @@ int main(int argc, char *argv[]) { exit(1); } ldid::DiskFolder folder(path + "/"); - path += "/" + Sign("", folder, key, requirements, ldid::fun([&](const std::string &, const std::string &) -> std::string { return entitlements; }), flag_M, dummy_).path; + path += "/" + Sign("", folder, key, requirements, ldid::fun([&](const std::string &, const std::string &) -> std::string { return entitlements; }), flag_M, platform, dummy_).path; } else if (flag_S || flag_r || flag_s) { Map input(path, O_RDONLY, PROT_READ, MAP_PRIVATE); diff --git a/ldid.hpp b/ldid.hpp index 861fbb3..688b14c 100644 --- a/ldid.hpp +++ b/ldid.hpp @@ -157,7 +157,7 @@ struct Bundle { Hash hash; }; -Bundle Sign(const std::string &root, Folder &folder, const std::string &key, const std::string &requirements, const Functor &alter, bool merge, const Progress &progress); +Bundle Sign(const std::string &root, Folder &folder, const std::string &key, const std::string &requirements, const Functor &alter, bool merge, uint8_t platform, const Progress &progress); typedef std::map Slots; -- cgit v1.2.3-56-ge451