[PATCH] proposal to enforce correct system account creation in adduser and addgroup

Tito farmatito at tiscali.it
Wed Apr 15 21:58:02 UTC 2009


Hi,
this patch enforces correct  system account creation in adduser and addgroup
(or at least it mimics the behaviour on my box :-)  ):

1) for both applets: if a specific id is requested the --system switch and 
                               min and max values are overriden and the range of valid
	                       id values is set between 0 and UINT_MAX
2) in adduser: if --system is set no interactive password is requested, users's group
                       is set to "nogroup" (unless --ingroup is set) and user's shell to /bin/false
                       (unless --shell is set).
                       Support for --uid was added.
3) in addgroup: support for long options and --system was added.
4) usage.h: was updated to reflect the changes.

Size increase is:

scripts/bloat-o-meter busybox_old busybox_unstripped
function                                             old     new   delta
adduser_main                                         642     753    +111
addgroup_main                                        334     415     +81
addgroup_longopts                                      -      16     +16
adduser_longopts                                      97     103      +6
packed_usage                                       25278   25276      -2
.rodata                                           122845  122817     -28
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/2 up/down: 214/-30)           Total: 184 bytes

The patches were tested in Virtualbox and the basics seem to work,
but it is difficult to test all possible combinations of switches by hand
so more testing and auditing by the list members is necessary.
Hints, critics and improvements are welcome.

Ciao,
Tito 
                                           
-------------- next part --------------
A non-text attachment was scrubbed...
Name: addgroup.patch
Type: text/x-diff
Size: 3366 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090415/edf27e84/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adduser_addgroup_usage.patch
Type: text/x-diff
Size: 670 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090415/edf27e84/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adduser.patch
Type: text/x-diff
Size: 3676 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090415/edf27e84/attachment-0005.bin>


More information about the busybox mailing list