diff options
author | Denis Vlasenko | 2008-06-12 16:56:52 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-06-12 16:56:52 +0000 |
commit | fdddab0c61c55c25d4218d4370e2b16a7936a794 (patch) | |
tree | bf93480018a52ab051189222248b6d04af98d7d4 /loginutils/sulogin.c | |
parent | 4ea83bf562c44a6792e7c77e7d87cba91f86f763 (diff) | |
download | busybox-fdddab0c61c55c25d4218d4370e2b16a7936a794.zip busybox-fdddab0c61c55c25d4218d4370e2b16a7936a794.tar.gz |
make pw_encrypt() return malloc'ed string.
text data bss dec hex filename
759802 604 6684 767090 bb472 busybox_old
759804 604 6676 767084 bb46c busybox_unstripped
Diffstat (limited to 'loginutils/sulogin.c')
-rw-r--r-- | loginutils/sulogin.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index f52ce8a..38812a6 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c @@ -72,6 +72,9 @@ int sulogin_main(int argc ATTRIBUTE_UNUSED, char **argv) #endif while (1) { + char *encrypted; + int r; + /* cp points to a static buffer that is zeroed every time */ cp = bb_askpass(timeout, "Give root password for system maintenance\n" @@ -81,7 +84,10 @@ int sulogin_main(int argc ATTRIBUTE_UNUSED, char **argv) bb_info_msg("Normal startup"); return 0; } - if (strcmp(pw_encrypt(cp, pwd->pw_passwd, 1), pwd->pw_passwd) == 0) { + encrypted = pw_encrypt(cp, pwd->pw_passwd, 1); + r = strcmp(encrypted, pwd->pw_passwd); + free(encrypted); + if (r == 0) { break; } bb_do_delay(FAIL_DELAY); |