aboutsummaryrefslogtreecommitdiff
path: root/loginutils/sulogin.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-10-29 19:25:45 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-10-29 19:25:45 +0000
commit15ca51e3e2a31efc275b616106244d8ec3f8f773 (patch)
treee54716fcb612a54cfa72564d9ef089eebe92acbd /loginutils/sulogin.c
parent5a28a25b9dd81e0975532458723c4244ff532e58 (diff)
downloadbusybox-w32-15ca51e3e2a31efc275b616106244d8ec3f8f773.tar.gz
busybox-w32-15ca51e3e2a31efc275b616106244d8ec3f8f773.tar.bz2
busybox-w32-15ca51e3e2a31efc275b616106244d8ec3f8f773.zip
appletlib.c: make it actally follow _BB_SUID_ALWAYS rules
adduser: implement -S and code shrink / fix uid selection *: sanitize getspnam_r use text data bss dec hex filename 777042 974 9676 787692 c04ec busybox_old 776883 974 9676 787533 c044d busybox_unstripped
Diffstat (limited to '')
-rw-r--r--loginutils/sulogin.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index f633fbbf1..f1545b78f 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -44,7 +44,6 @@ int sulogin_main(int argc, char **argv)
44 /* Using _r function to avoid pulling in static buffers */ 44 /* Using _r function to avoid pulling in static buffers */
45 char buffer[256]; 45 char buffer[256];
46 struct spwd spw; 46 struct spwd spw;
47 struct spwd *result;
48#endif 47#endif
49 48
50 logmode = LOGMODE_BOTH; 49 logmode = LOGMODE_BOTH;
@@ -83,10 +82,16 @@ int sulogin_main(int argc, char **argv)
83 } 82 }
84 83
85#if ENABLE_FEATURE_SHADOWPASSWDS 84#if ENABLE_FEATURE_SHADOWPASSWDS
86 if (getspnam_r(pwd->pw_name, &spw, buffer, sizeof(buffer), &result)) { 85 {
87 goto auth_error; 86 /* getspnam_r may return 0 yet set result to NULL.
87 * At least glibc 2.4 does this. Be extra paranoid here. */
88 struct spwd *result = NULL;
89 int r = getspnam_r(pwd->pw_name, &spw, buffer, sizeof(buffer), &result);
90 if (r || !result) {
91 goto auth_error;
92 }
93 pwd->pw_passwd = result->sp_pwdp;
88 } 94 }
89 pwd->pw_passwd = spw.sp_pwdp;
90#endif 95#endif
91 96
92 while (1) { 97 while (1) {