summaryrefslogtreecommitdiff
path: root/Ports/oksh/patches/remove_issetugid.patch
blob: 99d6940030305880f873941f144d6acb8ab787f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff --git a/misc.c b/misc.c
index b440088..1c32061 100644
--- a/misc.c
+++ b/misc.c
@@ -291,22 +291,7 @@ change_flag(enum sh_flag f,
 			Flag(f) = newval;
 		}
 	} else
-	/* Turning off -p? */
-	if (f == FPRIVILEGED && oldval && !newval && issetugid() &&
-	    !dropped_privileges) {
-		gid_t gid = getgid();
-
-		setresgid(gid, gid, gid);
-		setgroups(1, &gid);
-		setresuid(ksheuid, ksheuid, ksheuid);
-
-#ifdef HAVE_PLEDGE
-		if (pledge("stdio rpath wpath cpath fattr flock getpw proc "
-		    "exec tty", NULL) == -1)
-			bi_errorf("pledge fail");
-#endif
-		dropped_privileges = 1;
-	} else if (f == FPOSIX && newval) {
+	if (f == FPOSIX && newval) {
 		Flag(FBRACEEXPAND) = 0;
 	}
 	/* Changing interactive flag? */