mirror of
https://github.com/php/php-src.git
synced 2024-09-23 19:07:26 +00:00
Merge branch 'PHP-7.0'
This commit is contained in:
commit
e9ee9e13f0
@ -246,6 +246,13 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
|
||||
}
|
||||
#else
|
||||
|
||||
if (salt[0] != '$' && salt[0] != '_' && (!IS_VALID_SALT_CHARACTER(salt[0]) || !IS_VALID_SALT_CHARACTER(salt[1]))) {
|
||||
if (!quiet) {
|
||||
/* error consistently about invalid DES fallbacks */
|
||||
php_error_docref(NULL, E_DEPRECATED, DES_INVALID_SALT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(HAVE_CRYPT_R) && (defined(_REENTRANT) || defined(_THREAD_SAFE))
|
||||
{
|
||||
# if defined(CRYPT_R_STRUCT_CRYPT_DATA)
|
||||
@ -254,24 +261,23 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
|
||||
# elif defined(CRYPT_R_CRYPTD)
|
||||
CRYPTD buffer;
|
||||
# else
|
||||
# error Data struct used by crypt_r() is unknown. Please report.
|
||||
# error Data struct used by crypt_r() is unknown. Please report.
|
||||
# endif
|
||||
if (salt[0] != '$' && salt[0] != '_' && (!IS_VALID_SALT_CHARACTER(salt[0]) || !IS_VALID_SALT_CHARACTER(salt[1]))) {
|
||||
if (!quiet) {
|
||||
/* error consistently about invalid DES fallbacks */
|
||||
php_error_docref(NULL, E_DEPRECATED, DES_INVALID_SALT_ERROR);
|
||||
}
|
||||
}
|
||||
crypt_res = crypt_r(password, salt, &buffer);
|
||||
if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
|
||||
return NULL;
|
||||
} else {
|
||||
result = zend_string_init(crypt_res, strlen(crypt_res), 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
# elif defined(HAVE_CRYPT)
|
||||
crypt_res = crypt(password, salt);
|
||||
# else
|
||||
# error No crypt() implementation
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
|
||||
return NULL;
|
||||
} else {
|
||||
result = zend_string_init(crypt_res, strlen(crypt_res), 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user