1
0
forked from rpms/rpcbind
rpcbind/rpcbind-0.1.5-setgid.patch

29 lines
1003 B
Diff
Raw Normal View History

commit f7d18d511767e892e52932f8c6f6e49755a8e5bc
Author: Guillaume Rousse <Guillaume.Rousse@inria.fr>
Date: Mon Jun 23 12:30:29 2008 -0400
rpcbind needs to also downgrade its gid to a non-priviledgied group
Signed-off-by: Andreas Hasenack <andreas@mandriva.com>
Signed-off-by: Guillaume Rousse <Guillaume.Rousse@inria.fr>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/src/rpcbind.c b/src/rpcbind.c
index 949ece2..fb75517 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -216,8 +216,12 @@ main(int argc, char *argv[])
syslog(LOG_ERR, "cannot get uid of '%s': %m", id);
exit(1);
}
+ if (setgid(p->pw_gid) == -1) {
+ syslog(LOG_ERR, "setgid to '%s' (%d) failed: %m", id, p->pw_gid);
+ exit(1);
+ }
if (setuid(p->pw_uid) == -1) {
- syslog(LOG_ERR, "setuid to '%s' failed: %m", id);
+ syslog(LOG_ERR, "setuid to '%s' (%d) failed: %m", id, p->pw_uid);
exit(1);
}
}