summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2015-07-02 03:02:31 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2015-07-02 03:02:31 -0700
commit0c0a966bea2bf3b32d0a5abb2658dd22215e9c7f (patch)
tree2fb82e58427fb63e46425919e3b7b4b2eec82a6c
parent232b396b15248b956dd18092649f378b0db8bd4d (diff)
Trust in the mobile permissions on Cydia's caches.
-rw-r--r--MobileCydia.mm18
-rw-r--r--cydo.cpp9
-rw-r--r--postinst.mm6
3 files changed, 15 insertions, 18 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index d0b89fb..d67a01e 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -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");
diff --git a/cydo.cpp b/cydo.cpp
index 4583616..0aad393 100644
--- 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;
}
diff --git a/postinst.mm b/postinst.mm
index 11d70dc..45a7da3 100644
--- a/postinst.mm
+++ b/postinst.mm
@@ -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"