]> granicus.if.org Git - php/commitdiff
- return *0/*1 on failure instead of FALSE, to avoid possible issues with bad user...
authorPierre Joye <pajoye@php.net>
Tue, 23 Feb 2010 17:26:49 +0000 (17:26 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 23 Feb 2010 17:26:49 +0000 (17:26 +0000)
ext/standard/crypt.c

index 9e2f49f57f4061fe1adbf424168ccc76dd184aa7..4fa43bbb96ec3e5c6efe35d490f763743c5524a0 100644 (file)
@@ -199,7 +199,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);
                        }
@@ -218,7 +222,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);
                        }
@@ -239,7 +247,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);
                        }
@@ -251,7 +263,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);
                        }
@@ -271,7 +287,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);
                }