diff options
author | Pierre Joye <pajoye@php.net> | 2010-02-23 17:26:49 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2010-02-23 17:26:49 +0000 |
commit | fb9ce4aaa20109e857cc42c974f5bc59be347379 (patch) | |
tree | bd84e07a58d30d6b88f2a9364bfc7139efe6d793 | |
parent | 5cbece0a8eaed4738c4be476d9ddcc6a30cb8ec0 (diff) | |
download | php-git-fb9ce4aaa20109e857cc42c974f5bc59be347379.tar.gz |
- return *0/*1 on failure instead of FALSE, to avoid possible issues with bad user code
-rw-r--r-- | ext/standard/crypt.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c index 5123d8ff4a..a89fd5a10f 100644 --- a/ext/standard/crypt.c +++ b/ext/standard/crypt.c @@ -198,7 +198,11 @@ PHP_FUNCTION(crypt) crypt_res = php_sha512_crypt_r(str, salt, output, needed); if (!crypt_res) { - RETVAL_FALSE; + if (salt[0]=='*' && salt[1]=='0') { + RETVAL_STRING("*1", 1); + } else { + RETVAL_STRING("*0", 1); + } } else { RETVAL_STRING(output, 1); } @@ -217,7 +221,11 @@ PHP_FUNCTION(crypt) crypt_res = php_sha256_crypt_r(str, salt, output, needed); if (!crypt_res) { - RETVAL_FALSE; + if (salt[0]=='*' && salt[1]=='0') { + RETVAL_STRING("*1", 1); + } else { + RETVAL_STRING("*0", 1); + } } else { RETVAL_STRING(output, 1); } @@ -238,7 +246,11 @@ PHP_FUNCTION(crypt) crypt_res = php_crypt_blowfish_rn(str, salt, output, sizeof(output)); if (!crypt_res) { - RETVAL_FALSE; + if (salt[0]=='*' && salt[1]=='0') { + RETVAL_STRING("*1", 1); + } else { + RETVAL_STRING("*0", 1); + } } else { RETVAL_STRING(output, 1); } @@ -250,7 +262,11 @@ PHP_FUNCTION(crypt) crypt_res = _crypt_extended_r(str, salt, &buffer); if (!crypt_res) { - RETURN_FALSE; + if (salt[0]=='*' && salt[1]=='0') { + RETURN_STRING("*1", 1); + } else { + RETURN_STRING("*0", 1); + } } else { RETURN_STRING(crypt_res, 1); } @@ -270,7 +286,11 @@ PHP_FUNCTION(crypt) # endif crypt_res = crypt_r(str, salt, &buffer); if (!crypt_res) { - RETURN_FALSE; + if (salt[0]=='*' && salt[1]=='0') { + RETURN_STRING("*1", 1); + } else { + RETURN_STRING("*0", 1); + } } else { RETURN_STRING(crypt_res, 1); } |