diff options
Diffstat (limited to 'usr.sbin/rwhod/rwhod.c')
-rw-r--r-- | usr.sbin/rwhod/rwhod.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.sbin/rwhod/rwhod.c b/usr.sbin/rwhod/rwhod.c index 6b63843..30cc2cf 100644 --- a/usr.sbin/rwhod/rwhod.c +++ b/usr.sbin/rwhod/rwhod.c @@ -248,9 +248,18 @@ main(int argc, char *argv[]) syslog(LOG_ERR, "bind: %m"); exit(1); } - setgid(unpriv_gid); - setgroups(1, &unpriv_gid); /* XXX BOGUS groups[0] = egid */ - setuid(unpriv_uid); + if (setgid(unpriv_gid) != 0) { + syslog(LOG_ERR, "setgid: %m"); + exit(1); + } + if (setgroups(1, &unpriv_gid) != 0) { /* XXX BOGUS groups[0] = egid */ + syslog(LOG_ERR, "setgroups: %m"); + exit(1); + } + if (setuid(unpriv_uid) != 0) { + syslog(LOG_ERR, "setuid: %m"); + exit(1); + } if (!configure(s)) exit(1); if (!quiet_mode) { |