diff options
author | Guillem Jover <guillem@debian.org> | 2008-01-22 12:57:43 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2008-01-22 12:57:43 +0200 |
commit | b5841bbaecc7659490400eb8d105473c4b646caf (patch) | |
tree | dbe1a7a55633a738b82ea92e5e84e27db99d2378 /utils | |
parent | 6585256b0f1040d5656ac4c9dce045de6c1d6323 (diff) | |
download | dpkg-b5841bbaecc7659490400eb8d105473c4b646caf.tar.gz |
s-s-d: Change uid after changing gid and initalizing supplementary groups
Closes: #462018
Diffstat (limited to 'utils')
-rw-r--r-- | utils/start-stop-daemon.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index ed21c3c26..2a31f7307 100644 --- a/utils/start-stop-daemon.c +++ b/utils/start-stop-daemon.c @@ -1413,10 +1413,6 @@ main(int argc, char **argv) if (chdir(changedir) < 0) fatal("Unable to chdir() to %s", changedir); - if (changeuser != NULL && getuid() != (uid_t)runas_uid) { - if (setuid(runas_uid)) - fatal("Unable to set uid to %s", changeuser); - } if (changegroup != NULL && *changegroup != '\0' && getgid() != (gid_t)runas_gid) { if (!gid_in_current_groups(runas_gid)) @@ -1426,6 +1422,10 @@ main(int argc, char **argv) if (setgid(runas_gid)) fatal("Unable to set gid to %d", runas_gid); } + if (changeuser != NULL && getuid() != (uid_t)runas_uid) { + if (setuid(runas_uid)) + fatal("Unable to set uid to %s", changeuser); + } if (background) { /* Continue background setup */ |