root_ = true;
_trace();
_assert(setreuid(real ? 0 : 501, 0) != -1);
+ _assert(setregid(real ? 0 : 501, 0) != -1);
}
~Root() {
root_ = false;
_trace();
+ _assert(setregid(501, 501) != -1);
_assert(setreuid(501, 501) != -1);
}
}
_end
+ _root(true) _system->Lock();
+
_trace();
OpProgress progress;
bool opened;
}
}
+ _system->UnLock();
return;
}
_trace();
- (void) configure {
NSString *dpkg = [NSString stringWithFormat:@"dpkg --configure -a --status-fd %u", statusfd_];
_trace();
- system([dpkg UTF8String]);
+ _root(true) system([dpkg UTF8String]);
_trace();
}
_assert(close(fds[0]) != -1);
_assert(close(fds[1]) != -1);
/* XXX: this should probably not use du */
- execl("/usr/libexec/cydia/du", "du", "-s", [path UTF8String], NULL);
+ _root(true) execl("/usr/libexec/cydia/du", "du", "-s", [path UTF8String], NULL);
exit(1);
} else {
_assert(close(fds[1]) != -1);
pid_t pid(ExecFork());
if (pid == 0) {
- execl("/usr/bin/sbreload", "sbreload", NULL);
+ _root(true) execl("/usr/bin/sbreload", "sbreload", NULL);
perror("sbreload");
exit(0);
pid_t pid(ExecFork());
if (pid == 0) {
- FILE *dpkg(popen("dpkg --set-selections", "w"));
+ FILE *dpkg(nullptr); // XXX: this is due to _root's if
+ _root(true) dpkg = popen("dpkg --set-selections", "w");
fwrite(package, strlen(package), 1, dpkg);
if (on)
}
}
- CydiaWriteSources();
+ _root(true) CydiaWriteSources();
}
// Navigation controller for the queuing badge.
} broken = nil;
/* }}} */
- CydiaWriteSources();
+ _root(true) CydiaWriteSources();
_trace();
_root(true) MetaFile_.Open("/var/lib/cydia/metadata.cb0");
int version([[NSString stringWithContentsOfFile:@"/var/lib/cydia/firmware.ver"] intValue]);
- _root(true) if (access("/User", F_OK) != 0 || version != 6) {
+ if (access("/User", F_OK) != 0 || version != 6) {
_trace();
- system("/usr/libexec/cydia/firmware.sh");
+ _root(true) system("/usr/libexec/cydia/firmware.sh");
_trace();
}