summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2015-06-16 00:15:06 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2015-06-16 00:15:06 -0700
commit202bf8406ce550a612cce583115dc6e1f07bb031 (patch)
tree639bd2305006314014219fe6822a691cc23d379b
parent3a686b9fa3139eb401ef9287d5dcee6997b31a08 (diff)
This apparently relied on a bug Apple fixed (8.3).
-rw-r--r--MobileCydia.mm29
1 files changed, 15 insertions, 14 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 36c1c62..6dfe632 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -239,29 +239,29 @@ union SplitHash {
};
// }}}
-static void setreugid(uid_t uid, gid_t gid) {
- _assert(setreuid(uid, uid) != -1);
- _assert(setregid(gid, gid) != -1);
-}
+#define seteugid(uid, gid) do { \
+ _assert(setreuid(0, uid) != -1); \
+ _assert(setregid(0, gid) != -1); \
+} while (false)
-static void setreguid(gid_t gid, uid_t uid) {
- _assert(setregid(gid, gid) != -1);
- _assert(setreuid(uid, uid) != -1);
-}
+#define seteguid(uid, gid) do { \
+ _assert(setregid(0, gid) != -1); \
+ _assert(setreuid(0, uid) != -1); \
+} while (false)
struct Root {
Root() {
_trace();
- setreugid(0, 0);
+ seteugid(0, 0);
_assert(pthread_setugid_np(0, 0) != -1);
- setreguid(501, 501);
+ seteguid(501, 501);
}
~Root() {
_trace();
- setreugid(0, 0);
+ seteugid(0, 0);
_assert(pthread_setugid_np(KAUTH_UID_NONE, KAUTH_GID_NONE) != -1);
- setreguid(501, 501);
+ seteguid(501, 501);
}
};
@@ -9381,7 +9381,7 @@ _end
_trace();
if (UpgradeCydia_ && Finish_ > 0) {
- setreugid(0, 0);
+ seteugid(0, 0);
system("su -c /usr/bin/uicache mobile");
} else {
system("/usr/bin/uicache");
@@ -10166,7 +10166,8 @@ MSHook(id, NSUserDefaults$objectForKey$, NSUserDefaults *self, SEL _cmd, NSStrin
}
int main(int argc, char *argv[]) {
- setreugid(501, 501);
+ seteugid(0, 0);
+ seteguid(501, 501);
NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);