[PATCH] new correct_password and sulogin size reduction
Tito
farmatito at tiscali.it
Sun Mar 26 14:58:13 PST 2006
Hi,
this is a resend of a previous set of patches.
1) It is a rewrite of the correct_password function in libbb
and changes it from:
int correct_password ( const struct passwd *pw );
to:
int correct_password (struct passwd *pw, int timeout, int flag);
the goal of adding the two new args is to make it more flexible so that
also sulogin can use it. It now uses pw_encrypt instead of crypt
so that it could support also SHA1 passwords.
The possible values for the int flag parameter are:
If flag is 0 do not check for empty passwords (sulogin).
If flag is 1 check for empty passwords (login, su).
If flag is -1 return an error for empty passwords (vlock).
The return values of the function are:
Return 0 if the user gives the correct password or password
is empty and flag is 1.
Return 1 on authentication failure.
Return 2 if bb_askpass returns NULL;
2) it fixes libbb/Makefile.in as correct_password now uses pw_encrypt ( hope
i've done it right...)
3) it fixes include/libbb.h
4) it ports vlock, su and login to the new function interface
5) it reduces size and code of sulogin by using correct_password in it.
6) Overall size reduction with su, sulogin, login, vlock and
shadow_passwords enabled is:
text data bss dec hex filename
15708 616 8772 25096 6208 busybox.orig/busybox
15455 612 552 16619 40eb busybox.prova/busybox
which is due mostly to the size reduction of sulogin (and a few bytes in
correct_password)
text data bss dec hex filename
1208 0 0 1208 4b8 busybox.orig/loginutils/sulogin.o
924 0 0 924 39c busybox.prova/loginutils/sulogin.o
199 0 0 199 c7 busybox.orig/libbb/correct_password.o
184 0 0 184 b8 busybox.prova/libbb/correct_password.o
The other applets show minimal size increase due to the
2 additional args passed to the function:
623 0 0 623 26f busybox.orig/loginutils/su.o
629 0 0 629 275 busybox.prova/loginutils/su.o
784 0 104 888 378 busybox.orig/loginutils/vlock.o
788 0 104 892 37c busybox.prova/loginutils/vlock.o
1886 0 0 1886 75e busybox.orig/loginutils/login.o
1892 0 0 1892 764 busybox.prova/loginutils/login.o
The patch is tested, but a little more testing and review by the list members
wouldn't be bad...
TIA and Ciao,
Tito
-------------- next part --------------
A non-text attachment was scrubbed...
Name: correct_password.patch.tar.gz
Type: application/x-tgz
Size: 4489 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20060327/ea878f6a/correct_password.patch.tar.bin
More information about the busybox
mailing list