diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-15 18:27:05 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-09-15 18:27:05 +0200 |
commit | 585541e8e338a85b9f18cf5f6ed88758b29e61f2 (patch) | |
tree | 6d17c3f52ecc3b9e05430793a923edb9b2551683 /debianutils | |
parent | dd1eb413f28a2a8b5768056e1967e87b2363dc32 (diff) | |
download | busybox-w32-585541e8e338a85b9f18cf5f6ed88758b29e61f2.tar.gz busybox-w32-585541e8e338a85b9f18cf5f6ed88758b29e61f2.tar.bz2 busybox-w32-585541e8e338a85b9f18cf5f6ed88758b29e61f2.zip |
start_stop_daemon: set complementary group ids too. Closes 3253
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'debianutils')
-rw-r--r-- | debianutils/start_stop_daemon.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index bc61959d2..02609c04f 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c | |||
@@ -502,8 +502,16 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv) | |||
502 | if (opt & OPT_c) { | 502 | if (opt & OPT_c) { |
503 | struct bb_uidgid_t ugid = { -1, -1 }; | 503 | struct bb_uidgid_t ugid = { -1, -1 }; |
504 | parse_chown_usergroup_or_die(&ugid, chuid); | 504 | parse_chown_usergroup_or_die(&ugid, chuid); |
505 | if (ugid.gid != (gid_t) -1) xsetgid(ugid.gid); | 505 | if (ugid.uid != (uid_t) -1) { |
506 | if (ugid.uid != (uid_t) -1) xsetuid(ugid.uid); | 506 | struct passwd *pw = xgetpwuid(ugid.uid); |
507 | if (ugid.gid != (gid_t) -1) | ||
508 | pw->pw_gid = ugid.gid; | ||
509 | /* initgroups, setgid, setuid: */ | ||
510 | change_identity(pw); | ||
511 | } else if (ugid.gid != (gid_t) -1) { | ||
512 | xsetgid(ugid.gid); | ||
513 | setgroups(1, &ugid.gid); | ||
514 | } | ||
507 | } | 515 | } |
508 | #if ENABLE_FEATURE_START_STOP_DAEMON_FANCY | 516 | #if ENABLE_FEATURE_START_STOP_DAEMON_FANCY |
509 | if (opt & OPT_NICELEVEL) { | 517 | if (opt & OPT_NICELEVEL) { |