pajoye Tue, 23 Feb 2010 17:26:49 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295419
Log:
- return *0/*1 on failure instead of FALSE, to avoid possible issues with bad
user code
Changed paths:
U php/php-src/branches/PHP_5_3/ext/standard/crypt.c
U php/php-src/trunk/ext/standard/crypt.c
Modified: php/php-src/branches/PHP_5_3/ext/standard/crypt.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/crypt.c 2010-02-23 15:31:22 UTC
(rev 295418)
+++ php/php-src/branches/PHP_5_3/ext/standard/crypt.c 2010-02-23 17:26:49 UTC
(rev 295419)
@@ -198,7 +198,11 @@
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 @@
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 @@
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 @@
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 @@
# 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);
}
Modified: php/php-src/trunk/ext/standard/crypt.c
===================================================================
--- php/php-src/trunk/ext/standard/crypt.c 2010-02-23 15:31:22 UTC (rev
295418)
+++ php/php-src/trunk/ext/standard/crypt.c 2010-02-23 17:26:49 UTC (rev
295419)
@@ -199,7 +199,11 @@
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);
}
@@ -218,7 +222,11 @@
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);
}
@@ -239,7 +247,11 @@
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);
}
@@ -251,7 +263,11 @@
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);
}
@@ -271,7 +287,11 @@
# 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);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php