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> 2007-11-23 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/salt.c: Move the srandom call to gensalt. * 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]; static char result[40];
size_t salt_len = 8; size_t salt_len = 8;
char *method = "DES"; char *method;
result[0] = '\0'; result[0] = '\0';
if (NULL != meth) if (NULL != meth)
method = meth; method = meth;
else else {
#ifdef ENCRYPTMETHOD_SELECT #ifdef ENCRYPTMETHOD_SELECT
if ((method = getdef_str ("ENCRYPT_METHOD")) == NULL) if ((method = getdef_str ("ENCRYPT_METHOD")) == NULL)
#endif #endif
if (getdef_bool ("MD5_CRYPT_ENAB")) method = getdef_bool ("MD5_CRYPT_ENAB") ? "MD5" : "DES";
method = "MD5"; }
if (!strcmp (method, "MD5")) { if (!strcmp (method, "MD5")) {
MAGNUM(result, '1'); MAGNUM(result, '1');