summaryrefslogtreecommitdiff
path: root/sysutils/mtools/patches/patch-ae
blob: b85872847a0e30d586b90fc93c60a66462545a3c (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
29
30
31
$NetBSD: patch-ae,v 1.4 2013/01/18 00:34:30 mef Exp $

See
http://gnats.netbsd.org/18771

mtools drops its privileges so thoroughly that it can't regain its
original effective group id for opening the device file. This
defeats the "setgid mtools" setup that is mentioned in the
documentation and described in the comment above Setuid() in
privileges.c.

--- privileges.c.orig	2003-12-11 18:07:44.000000000 +0000
+++ privileges.c
@@ -68,7 +68,7 @@ void reclaim_privs(void)
 {
 	if(noPrivileges)
 		return;
-	setgid(egid);
+	setegid(egid);
 	Setuid(euid);
 	print_privs("after reclaim privs, both uids should be 0 ");
 }
@@ -76,7 +76,7 @@ void reclaim_privs(void)
 void drop_privs(void)
 {
 	Setuid(ruid);
-	setgid(rgid);
+	setegid(rgid);
 	print_privs("after drop_privs, real should be 0, effective should not ");
 }