com php-src: Merge remote branch 'upstream/master' into hash_password: ext/standard/crypt.c
| From: | Anthony Ferrara | Date: | Fri, 29 Jun 2012 14:29:58 +0000 |
| Subject: | com php-src: Merge remote branch 'upstream/master' into hash_password: ext/standard/crypt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-70379@lists.php.net to get a copy of this message | ||
Commit: 9e18e578f0e7f30c2d73ae38620b5fd228ac21eb
Author: Anthony Ferrara <ircmaxell@gmail.com> Fri, 29 Jun 2012 10:29:58 -0400
Parents: da3d8bf514e61a486065b0bf335b4657f20e6b66 c51fbbe4b4e2c047d1be76d8bffc6391203adbdd
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9e18e578f0e7f30c2d73ae38620b5fd228ac21eb
Log:
Merge remote branch 'upstream/master' into hash_password
Conflicts:
ext/standard/crypt.c
Changed paths:
MM ext/standard/crypt.c
Diff:
diff --cc ext/standard/crypt.c
index a592a4b,27a8d82..25f5ec0
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@@ -171,36 -199,46 +171,36 @@@ PHPAPI int crypt_execute(const char *pa
char *output;
int needed = (sizeof(sha512_salt_prefix) - 1
+ sizeof(sha512_rounds_prefix) + 9 + 1
- + PHP_MAX_SALT_LEN + 43 + 1);
+ + salt_in_len + 1 + 86 + 1);
output = emalloc(needed);
- salt[salt_in_len] = '\0';
- crypt_res = php_sha512_crypt_r(str, salt, output, needed);
+ crypt_res = php_sha512_crypt_r(password, salt, output, needed);
if (!crypt_res) {
- if (salt[0]=='*' && salt[1]=='0') {
- RETVAL_STRING("*1", 1);
- } else {
- RETVAL_STRING("*0", 1);
- }
+ memset(output, 0, needed);
+ efree(output);
+ return FAILURE;
} else {
- RETVAL_STRING(output, 1);
+ *result = output;
+ return SUCCESS;
}
-
- memset(output, 0, needed);
- efree(output);
} else if (salt[0]=='$' && salt[1]=='5' &&
salt[2]=='$') {
const char sha256_salt_prefix[] = "$5$";
const char sha256_rounds_prefix[] = "rounds=";
char *output;
int needed = (sizeof(sha256_salt_prefix) - 1
+ sizeof(sha256_rounds_prefix) + 9 + 1
- + PHP_MAX_SALT_LEN + 43 + 1);
+ + salt_in_len + 1 + 43 + 1);
output = emalloc(needed);
- salt[salt_in_len] = '\0';
- crypt_res = php_sha256_crypt_r(str, salt, output, needed);
+ crypt_res = php_sha256_crypt_r(password, salt, output, needed);
if (!crypt_res) {
- if (salt[0]=='*' && salt[1]=='0') {
- RETVAL_STRING("*1", 1);
- } else {
- RETVAL_STRING("*0", 1);
- }
+ memset(output, 0, needed);
+ efree(output);
+ return FAILURE;
} else {
- RETVAL_STRING(output, 1);
+ *result = output;
+ return SUCCESS;
}
-
- memset(output, 0, needed);
- efree(output);
} else if (
salt[0] == '$' &&
salt[1] == '2' &&