[PATCH] add euid egid handling to id
Tito
farmatito at tiscali.it
Thu Oct 23 19:52:33 UTC 2008
Hi to all,
this is a full rewrote of the id applet rather than a patch.
My goal was to add euid egid handling to the applet without
increasing its size.
While at it I fixed also some differences in exit codes vs GNU id
when an id to name translation fails,
added some error messages when ENABLE_DESKTOP is set
and added some clean up code when ENABLE_FEATURE_CLEAN_UP is set.
Bloat o meter says:
scripts/bloat-o-meter busybox_old busybox_unstripped
function old new delta
print_common - 123 +123
get_groups - 37 +37
print_user - 12 +12
print_group - 12 +12
status 120 124 +4
flags - 4 +4
printf_full 44 - -44
id_main 539 400 -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 1/1 up/down: 192/-183) Total: 9 bytes
the selinux code if enable was shrinked also:
[root at localhost busybox_1]# scripts/bloat-o-meter busybox_old busybox_unstripped
function old new delta
id_main 535 525 -10
.rodata 120583 120568 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-25) Total: -25 bytes
The code was extensively tested with the attached script and seems to work
correctly. The selinux code was tested in a virtualboxed fedora FC9 and seems
to work, but the selinux people on the list may take a look at it.
The test script maybe could be ported by some list member with better
scripting ablities to the testsuite, the main problem probably is that it
requires root privileges to prepare the environment for some tests.
Attached you will find the test script, the patch and a drop in
replacement to allow easier inspection of the code.
Hints, critics and imrovements are always welcome.
Please apply if you like it.
Ciao,
Tito
PS: Denys I removed the #if HAVE_getgrouplist as it seems to me
that now we have getgrouplist in busybox libpwd, in gnu libc and also
in uclibc (svn?).
PPS: is the G (*(struct globals*) stuff needed in this applet?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: id_test.sh
Type: application/x-shellscript
Size: 5915 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20081023/cc60dfc3/attachment-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: id.c
Type: text/x-csrc
Size: 4965 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20081023/cc60dfc3/attachment-0002.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: id.patch
Type: text/x-diff
Size: 8800 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20081023/cc60dfc3/attachment-0003.bin
More information about the busybox
mailing list