Date: Thu, 5 Jun 2014 15:39:57 +0000 (UTC) From: Hajimu UMEMOTO <ume@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r267116 - stable/9/lib/libcrypt Message-ID: <201406051539.s55FdvmU029282@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406051539.s55FdvmU029282>