diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2015-07-02 07:54:47 -0700 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2015-07-02 07:54:47 -0700 |
commit | f7f32d9a12b75e8e7e57326de881cc8609f738ed (patch) | |
tree | 693fe5fbc29febbe434f5833c536874007225fc1 | |
parent | f26c90b114a5fdb3b701cd7e73ce9328a93eaeda (diff) |
Cydia no longer runs as root. (WE FINALLY DID IT!)
-rwxr-xr-x | MobileCydia.app/Cydia | 6 | ||||
-rw-r--r-- | MobileCydia.mm | 54 | ||||
-rw-r--r-- | makefile | 3 |
3 files changed, 4 insertions, 59 deletions
diff --git a/MobileCydia.app/Cydia b/MobileCydia.app/Cydia deleted file mode 100755 index 572af7b..0000000 --- a/MobileCydia.app/Cydia +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -C=/${0} -C=${C%/*} -declare -a flags -[[ :${DYLD_INSERT_LIBRARIES}: == */MobileSubstrate.dylib: ]] && flags[${#flags[@]}]=--substrate -exec "${C:-.}"/MobileCydia "${flags[@]}" -- "$@" 2>>/tmp/cydia.log diff --git a/MobileCydia.mm b/MobileCydia.mm index 612cd23..3c0ffa9 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -237,35 +237,6 @@ union SplitHash { }; // }}} -static void setreugid(uid_t uid, gid_t gid) { - _assert(setreuid(uid, uid) != -1); - _assert(setregid(gid, gid) != -1); -} - -static void setreguid(gid_t gid, uid_t uid) { - _assert(setregid(gid, gid) != -1); - _assert(setreuid(uid, uid) != -1); -} - -struct Root { - Root() { - _trace(); - setreugid(0, 0); - _assert(pthread_setugid_np(0, 0) != -1); - setreguid(501, 501); - } - - ~Root() { - _trace(); - setreugid(0, 0); - _assert(pthread_setugid_np(KAUTH_UID_NONE, KAUTH_GID_NONE) != -1); - setreguid(501, 501); - } -}; - -#define _root(code) \ - ({ Root _root; code; }) - static NSString *Colon_; NSString *Elision_; static NSString *Error_; @@ -9307,12 +9278,10 @@ _end - (void) _uicache { _trace(); - if (UpgradeCydia_ && Finish_ > 0) { - setreugid(0, 0); - system("su -c /usr/bin/uicache mobile"); - } else { + if (UpgradeCydia_ && Finish_ > 0) + system("/usr/libexec/cydia/cydo /bin/su -c /usr/bin/uicache mobile"); + else system("/usr/bin/uicache"); - } _trace(); } @@ -10099,8 +10068,6 @@ MSHook(id, NSUserDefaults$objectForKey$, NSUserDefaults *self, SEL _cmd, NSStrin } int main(int argc, char *argv[]) { - setreugid(501, 501); - NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); _trace(); @@ -10417,21 +10384,6 @@ int main(int argc, char *argv[]) { Finishes_ = [NSArray arrayWithObjects:@"return", @"reopen", @"restart", @"reload", @"reboot", nil]; -#define MobileSubstrate_(name) \ - if (substrate && access("/Library/MobileSubstrate/DynamicLibraries/" #name ".dylib", F_OK) == 0) { \ - void *handle(dlopen("/Library/MobileSubstrate/DynamicLibraries/" #name ".dylib", RTLD_LAZY | RTLD_GLOBAL)); \ - if (handle == NULL) \ - NSLog(@"%s", dlerror()); \ - } - - MobileSubstrate_(Activator) - MobileSubstrate_(libstatusbar) - MobileSubstrate_(SimulatedKeyEvents) - MobileSubstrate_(WinterBoard) - - /*if (substrate && access("/Library/MobileSubstrate/MobileSubstrate.dylib", F_OK) == 0) - dlopen("/Library/MobileSubstrate/MobileSubstrate.dylib", RTLD_LAZY | RTLD_GLOBAL);*/ - if (kCFCoreFoundationVersionNumber > 1000) system("/usr/libexec/cydia/cydo /usr/libexec/cydia/setnsfpn /var/lib"); @@ -167,7 +167,7 @@ debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion s mkdir -p _/Applications cp -a MobileCydia.app _/Applications/Cydia.app rm -rf _/Applications/Cydia.app/*.lproj - cp -a MobileCydia _/Applications/Cydia.app/MobileCydia + cp -a MobileCydia _/Applications/Cydia.app/Cydia cd MobileCydia.app && find . -name '*.png' -exec cp -af ../Images/MobileCydia.app/{} ../_/Applications/Cydia.app/{} ';' @@ -183,7 +183,6 @@ debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst cfversion s sudo chown -R 0 _ sudo chgrp -R 0 _ - sudo chmod 6755 _/Applications/Cydia.app/MobileCydia mkdir -p debs ln -sf debs/cydia_$(version)_iphoneos-arm.deb Cydia.deb |