summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Rousse <Guillaume.Rousse@inria.fr>2008-06-23 12:30:29 -0400
committerSteve Dickson <steved@redhat.com>2008-06-23 12:30:29 -0400
commitf7d18d511767e892e52932f8c6f6e49755a8e5bc (patch)
tree75961a8c19bb8908475ad8bafca2eb1b838e9264
parent592d6b53f1ccf0bb9b7861395df689d1fca901f1 (diff)
downloadrpcbind-f7d18d511767e892e52932f8c6f6e49755a8e5bc.tar.gz
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>
-rw-r--r--src/rpcbind.c6
1 files changed, 5 insertions, 1 deletions
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);
}
}