]> git.saurik.com Git - cydia.git/commitdiff
Trust in the mobile permissions on Cydia's caches.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 2 Jul 2015 10:02:31 +0000 (03:02 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 2 Jul 2015 10:02:31 +0000 (03:02 -0700)
MobileCydia.mm
cydo.cpp
postinst.mm

index d0b89fba0b2df53eaca7f339a95d5fb354c7a3de..d67a01ea9c27ca12df6c68fe1496c36f731d438f 100644 (file)
@@ -5570,7 +5570,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
         pid_t pid(ExecFork());
         if (pid == 0) {
-            _root(execl("/usr/bin/sbreload", "sbreload", NULL));
+            execl("/usr/libexec/cydia/cydo", "cydo", "/usr/bin/sbreload", NULL);
             perror("sbreload");
 
             exit(0);
@@ -8910,7 +8910,6 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
 
 - (void) createDiskCachePath {
     [super createDiskCachePath];
-    _root(chown([[self diskCachePath] UTF8String], 501, 501));
 }
 
 @end
@@ -9474,7 +9473,7 @@ _end
     NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
 
     _trace();
-    _root(system([command UTF8String]));
+    system([command UTF8String]);
     _trace();
 
     [pool release];
@@ -9790,7 +9789,7 @@ _end
 - (void) stash {
     [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
     UpdateExternalStatus(1);
-    [self yieldToSelector:@selector(system:) withObject:@"/usr/libexec/cydia/free.sh"];
+    [self yieldToSelector:@selector(system:) withObject:@"/usr/libexec/cydia/cydo /usr/libexec/cydia/free.sh"];
     UpdateExternalStatus(0);
 
     [self removeStashController];
@@ -10486,13 +10485,13 @@ int main(int argc, char *argv[]) {
         dlopen("/Library/MobileSubstrate/MobileSubstrate.dylib", RTLD_LAZY | RTLD_GLOBAL);*/
 
     if (kCFCoreFoundationVersionNumber > 1000)
-        _root(system([[NSString stringWithFormat:@"/usr/libexec/cydia/setnsfpn /var/lib"] UTF8String]));
+        system("/usr/libexec/cydia/cydo /usr/libexec/cydia/setnsfpn /var/lib");
 
     int version([[NSString stringWithContentsOfFile:@"/var/lib/cydia/firmware.ver"] intValue]);
 
     if (access("/User", F_OK) != 0 || version != 6) {
         _trace();
-        _root(system("/usr/libexec/cydia/firmware.sh"));
+        system("/usr/libexec/cydia/cydo /usr/libexec/cydia/firmware.sh");
         _trace();
     }
 
@@ -10553,13 +10552,6 @@ int main(int argc, char *argv[]) {
     //UIKeyboardDisableAutomaticAppearance();
     /* }}} */
 
-    _root({
-        chown([Cache("ApplicationCache.db") UTF8String], 501, 501);
-        chown([Cache("Cache.db") UTF8String], 501, 501);
-        chown([Cache("Cache.db-shm") UTF8String], 501, 501);
-        chown([Cache("Cache.db-wal") UTF8String], 501, 501);
-    });
-
     $SBSSetInterceptsMenuButtonForever = reinterpret_cast<void (*)(bool)>(dlsym(RTLD_DEFAULT, "SBSSetInterceptsMenuButtonForever"));
 
     const char *symbol(kCFCoreFoundationVersionNumber >= 800 ? "MGGetBoolAnswer" : "GSSystemHasCapability");
index 458361620c08e33a8abf8cacb622e97f45bc4a9b..0aad39364cd3e0900c6b4f3782996760821b764f 100644 (file)
--- a/cydo.cpp
+++ b/cydo.cpp
@@ -3,7 +3,14 @@
 int main(int argc, char *argv[]) {
     setuid(0);
     setgid(0);
-    argv[0] = "/usr/bin/dpkg";
+
+    if (argc < 2 || argv[1][0] != '/')
+        argv[0] = "/usr/bin/dpkg";
+    else {
+        --argc;
+        ++argv;
+    }
+
     execv(argv[0], argv);
     return 1;
 }
index 11d70dc953237925130beed95e0af6ba9d7b6ba7..45a7da37d7f38e3a259346784c775637095a4be4 100644 (file)
@@ -229,11 +229,9 @@ int main(int argc, const char *argv[]) {
 
     #define NewCache_ "/var/mobile/Library/Caches/com.saurik.Cydia"
     system("cd /; su -c 'mkdir -p " NewCache_ "' mobile");
-
-    if (access(NewCache_ "/lists", F_OK) != 0 && errno == ENOENT) {
+    if (access(NewCache_ "/lists", F_OK) != 0 && errno == ENOENT)
         system("cp -at " NewCache_ " /var/lib/apt/lists");
-        system("chown -R 501.501 " NewCache_ "/lists");
-    }
+    system("chown -R 501.501 " NewCache_);
 
     #define OldLibrary_ "/var/lib/cydia"