Make sure method is not NULL, defaulting to DES. Thanks to Dan Kopecek <dkopecek@redhat.com>.

This commit is contained in:
nekral-guest 2007-11-23 23:57:47 +00:00
parent 963bfaf521
commit a99bec34a9
2 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2007-11-24 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/salt.c: Make sure method is not NULL, defaulting to DES.
Thanks to Dan Kopecek <dkopecek@redhat.com>.
2007-11-23 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/salt.c: Move the srandom call to gensalt.

View File

@ -180,18 +180,18 @@ char *crypt_make_salt (char *meth, void *arg)
*/
static char result[40];
size_t salt_len = 8;
char *method = "DES";
char *method;
result[0] = '\0';
if (NULL != meth)
method = meth;
else
else {
#ifdef ENCRYPTMETHOD_SELECT
if ((method = getdef_str ("ENCRYPT_METHOD")) == NULL)
#endif
if (getdef_bool ("MD5_CRYPT_ENAB"))
method = "MD5";
method = getdef_bool ("MD5_CRYPT_ENAB") ? "MD5" : "DES";
}
if (!strcmp (method, "MD5")) {
MAGNUM(result, '1');