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
This commit is contained in:
Denis Vlasenko
2008-06-12 16:56:52 +00:00
parent 4ea83bf562
commit fdddab0c61
7 changed files with 27 additions and 17 deletions

View File

@ -40,6 +40,7 @@ int correct_password(const struct passwd *pw)
{
char *unencrypted, *encrypted;
const char *correct;
int r;
#if ENABLE_FEATURE_SHADOWPASSWDS
/* Using _r function to avoid pulling in static buffers */
struct spwd spw;
@ -72,6 +73,8 @@ int correct_password(const struct passwd *pw)
return 0;
}
encrypted = pw_encrypt(unencrypted, correct, 1);
r = (strcmp(encrypted, correct) == 0);
free(encrypted);
memset(unencrypted, 0, strlen(unencrypted));
return strcmp(encrypted, correct) == 0;
return r;
}