Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 May 2014 16:50:19 +0000 (UTC)
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266813 - head/lib/libcrypt
Message-ID:  <201405281650.s4SGoJiB055742@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Wed May 28 16:50:18 2014
New Revision: 266813
URL: http://svnweb.freebsd.org/changeset/base/266813

Log:
  Don't break the legacy applications which set
  just 2 bytes to salt.
  
  MFC after:	1 week

Modified:
  head/lib/libcrypt/crypt.c

Modified: head/lib/libcrypt/crypt.c
==============================================================================
--- head/lib/libcrypt/crypt.c	Wed May 28 16:28:22 2014	(r266812)
+++ head/lib/libcrypt/crypt.c	Wed May 28 16:50:18 2014	(r266813)
@@ -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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405281650.s4SGoJiB055742>