svn commit: r267116 - stable/9/lib/libcrypt
Hajimu UMEMOTO
ume at FreeBSD.org
Thu Jun 5 15:39:57 UTC 2014
Author: ume
Date: Thu Jun 5 15:39:57 2014
New Revision: 267116
URL: http://svnweb.freebsd.org/changeset/base/267116
Log:
MFH r266813: Don't break the legacy applications which set
just 2 bytes to salt.
Approved by: re (gjb)
Modified:
stable/9/lib/libcrypt/crypt.c
Directory Properties:
stable/9/lib/libcrypt/ (props changed)
Modified: stable/9/lib/libcrypt/crypt.c
==============================================================================
--- stable/9/lib/libcrypt/crypt.c Thu Jun 5 15:39:54 2014 (r267115)
+++ stable/9/lib/libcrypt/crypt.c Thu Jun 5 15:39:57 2014 (r267116)
@@ -104,12 +104,16 @@ char *
crypt(const char *passwd, const char *salt)
{
const struct crypt_format *cf;
+#ifdef HAS_DES
+ int len;
+#endif
for (cf = crypt_formats; cf->name != NULL; ++cf)
if (cf->magic != NULL && strstr(salt, cf->magic) == salt)
return (cf->func(passwd, salt));
#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));
#endif
return (crypt_format->func(passwd, salt));
More information about the svn-src-stable
mailing list