From 333fb40d2d52c32959badba1fa855c1c831f058a Mon Sep 17 00:00:00 2001 From: Sam Bingner Date: Thu, 4 Oct 2018 16:00:06 -1000 Subject: Add entitlements and calls necessary for jbd/kppless --- sbreload.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sbreload.c') diff --git a/sbreload.c b/sbreload.c index 3db5a68..42da2a8 100644 --- a/sbreload.c +++ b/sbreload.c @@ -45,6 +45,27 @@ #include +/* Set platform binary flag */ +#define FLAG_PLATFORMIZE (1 << 1) +#include + +void platformizeme() { + void* handle = dlopen("/usr/lib/libjailbreak.dylib", RTLD_LAZY); + if (!handle) return; + + // Reset errors + dlerror(); + typedef void (*fix_entitle_prt_t)(pid_t pid, uint32_t what); + fix_entitle_prt_t ptr = (fix_entitle_prt_t)dlsym(handle, "jb_oneshot_entitle_now"); + + const char *dlsym_error = dlerror(); + if (dlsym_error) { + return; + } + + ptr(getpid(), FLAG_PLATFORMIZE); +} + launch_data_t CF2launch_data(CFTypeRef cfr); @@ -163,6 +184,7 @@ void stop() { #define SpringBoard_plist "/System/Library/LaunchDaemons/com.apple.SpringBoard.plist" int main(int argc, const char *argv[]) { + platformizeme(); _assert(argc == 1, "usage: sbreload"); CFDictionaryRef plist = CreateMyPropertyListFromFile(SpringBoard_plist); -- cgit v1.2.3