diff options
author | Sam Bingner <sam@bingner.com> | 2018-10-04 16:00:06 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2018-10-04 16:00:06 -1000 |
commit | 333fb40d2d52c32959badba1fa855c1c831f058a (patch) | |
tree | 5ae84bf94bda75887881eebca6e5829c56078794 /ldrestart.cpp | |
parent | 68d2b30b8a240347caa0937c75cfbf0079b7a3a5 (diff) |
Add entitlements and calls necessary for jbd/kppless
Diffstat (limited to 'ldrestart.cpp')
-rw-r--r-- | ldrestart.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ldrestart.cpp b/ldrestart.cpp index 04f7a8b..a6d6cb6 100644 --- a/ldrestart.cpp +++ b/ldrestart.cpp @@ -30,6 +30,26 @@ #include <launch.h> #include <sys/stat.h> +/* Set platform binary flag */ +#define FLAG_PLATFORMIZE (1 << 1) +#include <dlfcn.h> + +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); +} void process(launch_data_t value, const char *name, void *baton) { if (launch_data_get_type(value) != LAUNCH_DATA_DICTIONARY) @@ -65,6 +85,7 @@ void process(launch_data_t value, const char *name, void *baton) { } int main(int argc, char *argv[]) { + platformizeme(); auto request(launch_data_new_string(LAUNCH_KEY_GETJOBS)); auto response(launch_msg(request)); launch_data_free(request); |