summaryrefslogtreecommitdiff
path: root/ext/standard/crypt.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-11-30 21:41:04 -0800
committerStanislav Malyshev <stas@php.net>2014-11-30 21:47:40 -0800
commitbfc8d297be96b10f82190e58d8de67e101c33573 (patch)
treec55902dfcefaa593f1c24be9c04b70d0070d8e66 /ext/standard/crypt.c
parentf3faa205c757e49a43f6672fc28aa296b4b65e11 (diff)
parent720ba679485cb7120911af8013b7b6ab72a47884 (diff)
downloadphp-git-bfc8d297be96b10f82190e58d8de67e101c33573.tar.gz
Merge branch 'PHP-5.6'
* PHP-5.6: update news update news update NEWS Apply error-code-salt fix to Windows too Bug fixes in light of failing bcrypt tests Add tests from 1.3. Add missing tests. Upgrade crypt_blowfish to version 1.3 Apply error-code-salt fix to Windows too Bug fixes in light of failing bcrypt tests Add tests from 1.3. Add missing tests. Upgrade crypt_blowfish to version 1.3 Conflicts: ext/standard/crypt.c
Diffstat (limited to 'ext/standard/crypt.c')
-rw-r--r--ext/standard/crypt.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 7fae04fcbf..efc4248732 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -196,7 +196,6 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
} else if (
salt[0] == '$' &&
salt[1] == '2' &&
- salt[2] >= 'a' && salt[2] <= 'z' &&
salt[3] == '$' &&
salt[4] >= '0' && salt[4] <= '3' &&
salt[5] >= '0' && salt[5] <= '9' &&
@@ -219,7 +218,7 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
_crypt_extended_init_r();
crypt_res = _crypt_extended_r(password, salt, &buffer);
- if (!crypt_res) {
+ if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
return NULL;
} else {
result = zend_string_init(crypt_res, strlen(crypt_res), 0);
@@ -240,8 +239,8 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
# error Data struct used by crypt_r() is unknown. Please report.
# endif
crypt_res = crypt_r(password, salt, &buffer);
- if (!crypt_res) {
- return FAILURE;
+ if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
+ return NULL;
} else {
result = zend_string_init(crypt_res, strlen(crypt_res), 0);
return result;