diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-04-07 08:29:34 +0000 |
---|---|---|
committer | <> | 2015-04-13 18:52:43 +0000 |
commit | b2ccf8dd31d1457ae9f0ae270054117179220370 (patch) | |
tree | 4ccd4a16d5e9ef5869630ba624e822665a6e248c /ntpd/ntpd.c | |
parent | bdab5265fcbf3f472545073a23f8999749a9f2b9 (diff) | |
download | ntp-4.2.8p2.tar.gz |
Imported from /home/lorry/working-area/delta_ntp/ntp-4.2.8p2.tar.gz.HEADntp-4.2.8p2master
Diffstat (limited to 'ntpd/ntpd.c')
-rw-r--r-- | ntpd/ntpd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index ef1baa7..529e6ce 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -168,8 +168,8 @@ int root_dropped; char *user; /* User to switch to */ char *group; /* group to switch to */ const char *chrootdir; /* directory to chroot to */ -int sw_uid; -int sw_gid; +uid_t sw_uid; +gid_t sw_gid; char *endp; struct group *gr; struct passwd *pw; @@ -937,6 +937,10 @@ getgroup: msyslog(LOG_ERR, "Cannot setegid() to group `%s': %m", group); exit (-1); } + if (group) + setgroups(1, &sw_gid); + else + initgroups(pw->pw_name, pw->pw_gid); if (user && setuid(sw_uid)) { msyslog(LOG_ERR, "Cannot setuid() to user `%s': %m", user); exit (-1); @@ -1258,6 +1262,7 @@ finish( if (mdns != NULL) DNSServiceRefDeallocate(mdns); # endif + peer_cleanup(); exit(0); } #endif /* !SIM && SIGDIE1 */ |