[PATCH] proposal to unify passwd and group file handling of loginutils

Tito farmatito at tiscali.it
Thu Apr 9 13:20:32 UTC 2009


Hi,
this series of patches is a first attempt to unify passwd and group file handling 
of loginutils applets. The goal of the patch is to avoid that every applet
cooks his own soup while scribbling /etc/passwd, /etc/group, /etc/shadow
and /etc/gshadow and to enforce "cooperative locking".
The patch is based on the existing version of update_password
function as it already has some locking and and backup mechanism.
This is a first version of the patch series, tested just for the basic stuff
and almost size neutral:

debian:~/Desktop/busybox$ scripts/bloat-o-meter ../busybox.orig/busybox_unstripped busybox_unstripped
function                                             old     new   delta
bb_update_passwd                                       -    1092   +1092
parse_and_run_stream                                  54     154    +100
.rodata                                           122570  122640     +70
o_addstr                                               -      59     +59
expand_variables                                    2141    2191     +50
handle_dollar                                        632     667     +35
lookup_param                                           -      31     +31
set_in_charmap                                         -      30     +30
o_addstrauto                                           -      27     +27
builtin_trap                                         414     438     +24
builtin_help                                          63      74     +11
bb_perror_nomsg                                        -       9      +9
hush_main                                            961     968      +7
check_and_run_traps                                  164     169      +5
pseudo_exec_argv                                     147     151      +4
passwd_main                                         1023    1027      +4
chpasswd_main                                        315     319      +4
maybe_set_sighandler                                  47      50      +3
hush_exit                                             90      93      +3
builtin_wait                                         272     275      +3
arith                                               1535    1537      +2
static.null_ptr                                        4       -      -4
run_list                                            2021    2017      -4
fbset_main                                          1713    1709      -4
adduser_main                                         646     642      -4
addgroup_main                                        338     334      -4
deluser_main                                         137     132      -5
doCommands                                          2533    2522     -11
parse_stream                                        1462    1448     -14
o_addstr_with_NUL                                     27       -     -27
get_local_var_value                                   31       -     -31
o_addblock                                            59       -     -59
add_user_to_group                                    231       -    -231
del_line_matching                                    460      31    -429
update_passwd                                        745       -    -745
------------------------------------------------------------------------------
(add/remove: 6/6 grow/shrink: 15/8 up/down: 1573/-1572)         Total: 1 bytes

As this is security related stuff i would like the more experienced list members to take
a look at it for bugs and other possible improvements.
I would also like to know if there is some interest in this patchset 
before investing more time in it.

As always hints and critics are welcome.

Ciao,
Tito

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01-update_passwd.patch
Type: text/x-diff
Size: 8020 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090409/c81d3e39/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03-addgroup.patch
Type: text/x-diff
Size: 2747 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090409/c81d3e39/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 02-adduser.patch
Type: text/x-diff
Size: 1986 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090409/c81d3e39/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 05-passwd.patch
Type: text/x-diff
Size: 611 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090409/c81d3e39/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04-deluser_delgroup.patch
Type: text/x-diff
Size: 3694 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090409/c81d3e39/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 06-chpasswd.patch
Type: text/x-diff
Size: 714 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20090409/c81d3e39/attachment-0005.bin>


More information about the busybox mailing list