aboutsummaryrefslogtreecommitdiff
path: root/util-linux/setpriv.c
AgeCommit message (Collapse)Author
2017-07-04setpriv: do not process remaining argsPatrick Steinhardt
By default, the 'getopt32' call will continue parsing the command line even after hitting a non-option string. But in setpriv, this should be avoided, as all parameters following the initial non-option argument are in fact arguments to the binary that is to be executed by setpriv. Otherwise, calling e.g. 'busybox setpriv ls -l' would result in an error due to the unknown parameter "-l". Fix the issue by passing "+" as the first character in the options string. This will cause 'getopt32' to stop processing after hitting the first non-option. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-06-14setpriv: new appletAssaf Gordon
Add a minimal 'setpriv' implementation supporting the NO_NEW_PRIVS bit. Typical usage: $ busybox setpriv sudo uname Linux $ busybox setpriv --nnp sudo uname sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges? function old new delta packed_usage 31580 31685 +105 setpriv_main - 87 +87 prctl - 53 +53 static.setpriv_longopts - 22 +22 applet_names 2620 2628 +8 applet_main 1516 1520 +4 ------------------------------------------------------------------------------ (add/remove: 5/0 grow/shrink: 3/0 up/down: 279/0) Total: 279 bytes Signed-off-by: Assaf Gordon <assafgordon@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>