aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-09-16 11:52:43 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-09-16 11:52:43 +0200
commitd18ef6c9f6f5c94f2a65a6ab6ae3776711cb2877 (patch)
treef48bc44b44267942bcbbd3ec3d840a04ff9a6e49
parent585541e8e338a85b9f18cf5f6ed88758b29e61f2 (diff)
downloadbusybox-w32-d18ef6c9f6f5c94f2a65a6ab6ae3776711cb2877.tar.gz
busybox-w32-d18ef6c9f6f5c94f2a65a6ab6ae3776711cb2877.tar.bz2
busybox-w32-d18ef6c9f6f5c94f2a65a6ab6ae3776711cb2877.zip
chpst: simple code shrink
function old new delta chpst_main 733 718 -15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--runit/chpst.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/runit/chpst.c b/runit/chpst.c
index 185706089..44c21a2a4 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -405,19 +405,18 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
405 if (opt & OPT_e) 405 if (opt & OPT_e)
406 edir(env_dir); 406 edir(env_dir);
407 407
408 // FIXME: chrooted jail must have /etc/passwd if we move this after chroot! 408 if (opt & (OPT_u|OPT_U)) {
409 // OTOH chroot fails for non-roots! 409 xget_uidgid(&ugid, set_user);
410 // SOLUTION: cache uid/gid before chroot, apply uid/gid after 410 }
411
411 if (opt & OPT_U) { 412 if (opt & OPT_U) {
412 xget_uidgid(&ugid, env_user);
413 xsetenv("GID", utoa(ugid.gid)); 413 xsetenv("GID", utoa(ugid.gid));
414 xsetenv("UID", utoa(ugid.uid)); 414 xsetenv("UID", utoa(ugid.uid));
415 } 415 }
416 416
417 if (opt & OPT_u) { 417 // chrooted jail must have /etc/passwd if we move this after chroot.
418 xget_uidgid(&ugid, set_user); 418 // OTOH chroot fails for non-roots.
419 } 419 // Solution: cache uid/gid before chroot, apply uid/gid after.
420
421 if (opt & OPT_root) { 420 if (opt & OPT_root) {
422 xchdir(root); 421 xchdir(root);
423 xchroot("."); 422 xchroot(".");