Don't break the legacy applications which set
just 2 bytes to salt. MFC after: 1 week
This commit is contained in:
parent
4272b84663
commit
0cb06892fa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266813
@ -104,12 +104,16 @@ char *
|
|||||||
crypt(const char *passwd, const char *salt)
|
crypt(const char *passwd, const char *salt)
|
||||||
{
|
{
|
||||||
const struct crypt_format *cf;
|
const struct crypt_format *cf;
|
||||||
|
#ifdef HAS_DES
|
||||||
|
int len;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (cf = crypt_formats; cf->name != NULL; ++cf)
|
for (cf = crypt_formats; cf->name != NULL; ++cf)
|
||||||
if (cf->magic != NULL && strstr(salt, cf->magic) == salt)
|
if (cf->magic != NULL && strstr(salt, cf->magic) == salt)
|
||||||
return (cf->func(passwd, salt));
|
return (cf->func(passwd, salt));
|
||||||
#ifdef HAS_DES
|
#ifdef HAS_DES
|
||||||
if (strlen(salt) == 13 && strspn(salt, DES_SALT_ALPHABET) == 13)
|
len = strlen(salt);
|
||||||
|
if ((len == 13 || len == 2) && strspn(salt, DES_SALT_ALPHABET) == len)
|
||||||
return (crypt_des(passwd, salt));
|
return (crypt_des(passwd, salt));
|
||||||
#endif
|
#endif
|
||||||
return (crypt_format->func(passwd, salt));
|
return (crypt_format->func(passwd, salt));
|
||||||
|
Loading…
Reference in New Issue
Block a user