diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-24 12:20:05 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-24 12:22:07 +0200 |
commit | 565baf05c07f3d1c2971a424fb03854c84b0eccc (patch) | |
tree | a7046cb34793d3489962f68933b52b5fc2264c0b | |
parent | 32257ac17f68b4f8a5c276b92521f338f6c7cf86 (diff) | |
download | php-git-565baf05c07f3d1c2971a424fb03854c84b0eccc.tar.gz |
Handle *0 / *1 more consistently
Avoid throwing a DES salt deprecation warning if the libc crypt
implementation is used.
-rw-r--r-- | ext/standard/crypt.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index b727575fad..92430b69f7 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -99,6 +99,11 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch { char *crypt_res; zend_string *result; + + if (salt[0] == '*' && (salt[1] == '0' || salt[1] == '1')) { + return NULL; + } + /* Windows (win32/crypt) has a stripped down version of libxcrypt and a CryptoApi md5_crypt implementation */ #if PHP_USE_PHP_CRYPT_R @@ -160,8 +165,6 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN + 1); return result; } - } else if (salt[0] == '*' && (salt[1] == '0' || salt[1] == '1')) { - return NULL; } else { /* DES Fallback */ |