Commit: e05413ca594ff10fd93d40429cb598c2e109edf4 Author: Anthony Ferrara <ircmax...@gmail.com> Tue, 28 Aug 2012 11:24:33 -0400 Parents: 707c9073b595a75447fbc25e01e7804293fad9b7 Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e05413ca594ff10fd93d40429cb598c2e109edf4 Log: Remove password_make_salt() from the implementation Changed paths: M ext/standard/basic_functions.c M ext/standard/password.c M ext/standard/php_password.h D ext/standard/tests/password/password_make_salt.phpt D ext/standard/tests/password/password_make_salt_error.phpt Diff: diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e6b1559..1f1b3d3 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1884,10 +1884,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_password_verify, 0, 0, 2) ZEND_ARG_INFO(0, password) ZEND_ARG_INFO(0, hash) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_password_make_salt, 0, 0, 1) - ZEND_ARG_INFO(0, length) - ZEND_ARG_INFO(0, raw_output) -ZEND_END_ARG_INFO() /* }}} */ /* {{{ proc_open.c */ #ifdef PHP_CAN_SUPPORT_PROC_OPEN @@ -2907,8 +2903,6 @@ const zend_function_entry basic_functions[] = { /* {{{ */ PHP_FE(password_get_info, arginfo_password_get_info) PHP_FE(password_needs_rehash, arginfo_password_needs_rehash) PHP_FE(password_verify, arginfo_password_verify) - PHP_FE(password_make_salt, arginfo_password_make_salt) - PHP_FE(convert_uuencode, arginfo_convert_uuencode) PHP_FE(convert_uudecode, arginfo_convert_uudecode) diff --git a/ext/standard/password.c b/ext/standard/password.c index 2e5d62a..4f8ef5d 100644 --- a/ext/standard/password.c +++ b/ext/standard/password.c @@ -40,9 +40,6 @@ PHP_MINIT_FUNCTION(password) /* {{{ */ REGISTER_LONG_CONSTANT("PASSWORD_DEFAULT", PHP_PASSWORD_DEFAULT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PASSWORD_BCRYPT", PHP_PASSWORD_BCRYPT, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PASSWORD_SALT_RAW", PHP_PASSWORD_SALT_RAW, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("PASSWORD_SALT_BCRYPT", PHP_PASSWORD_SALT_BCRYPT, CONST_CS | CONST_PERSISTENT); - return SUCCESS; } /* }}} */ @@ -95,8 +92,6 @@ static int php_password_salt_to64(const char *str, const int str_len, const int } /* }}} */ -#define PHP_PASSWORD_FUNCTION_EXISTS(func, func_len) (zend_hash_find(EG(function_table), (func), (func_len) + 1, (void **) &func_ptr) == SUCCESS && func_ptr->type == ZEND_INTERNAL_FUNCTION && func_ptr->internal_function.handler != zif_display_disabled_function) - static int php_password_make_salt(long length, int salt_type, char *ret TSRMLS_DC) /* {{{ */ { int buffer_valid = 0; @@ -277,35 +272,6 @@ PHP_FUNCTION(password_verify) } /* }}} */ -/* {{{ proto string password_make_salt(int length, int salt_type = PASSWORD_SALT_BCRYPT) -Make a new random salt */ -PHP_FUNCTION(password_make_salt) -{ - char *salt; - long length = 0, salt_type = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &length, &salt_type) == FAILURE) { - RETURN_NULL(); - } - if (length <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length cannot be less than or equal zero: %ld", length); - RETURN_NULL(); - } else if (length > (LONG_MAX / 3)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length is too large to safely generate"); - RETURN_NULL(); - } - - if (!salt_type) { - salt_type = PHP_PASSWORD_SALT_BCRYPT; - } - salt = safe_emalloc(length, 1, 1); - if (php_password_make_salt(length, (int) salt_type, salt TSRMLS_CC) == FAILURE) { - efree(salt); - RETURN_FALSE; - } - RETURN_STRINGL(salt, length, 0); -} -/* }}} */ - /* {{{ proto string password_hash(string password, int algo, array options = array()) Hash a password */ PHP_FUNCTION(password_hash) diff --git a/ext/standard/php_password.h b/ext/standard/php_password.h index 8211ae1..d99c061 100644 --- a/ext/standard/php_password.h +++ b/ext/standard/php_password.h @@ -23,7 +23,6 @@ PHP_FUNCTION(password_hash); PHP_FUNCTION(password_verify); -PHP_FUNCTION(password_make_salt); PHP_FUNCTION(password_needs_rehash); PHP_FUNCTION(password_get_info); diff --git a/ext/standard/tests/password/password_make_salt.phpt b/ext/standard/tests/password/password_make_salt.phpt deleted file mode 100644 index c7aa514..0000000 --- a/ext/standard/tests/password/password_make_salt.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test normal operation of password_make_salt() ---FILE-- -<?php -//-=-=-=- -echo strlen(password_make_salt(1)) . "\n"; -echo strlen(password_make_salt(2)) . "\n"; -echo strlen(password_make_salt(3)) . "\n"; -echo strlen(password_make_salt(4)) . "\n"; -echo strlen(password_make_salt(5, PASSWORD_SALT_BCRYPT)) . "\n"; -echo "\n"; - -echo strlen(password_make_salt(1, PASSWORD_SALT_RAW)) . "\n"; -echo strlen(password_make_salt(2, PASSWORD_SALT_RAW)) . "\n"; -echo strlen(password_make_salt(3, PASSWORD_SALT_RAW)) . "\n"; -echo strlen(password_make_salt(4, PASSWORD_SALT_RAW)) . "\n"; -echo strlen(password_make_salt(5, PASSWORD_SALT_RAW)) . "\n"; -echo "\n"; - -$a = password_make_salt(32); -$b = password_make_salt(32); - -var_dump($a != $b); -echo "OK!"; -?> ---EXPECT-- -1 -2 -3 -4 -5 - -1 -2 -3 -4 -5 - -bool(true) -OK! diff --git a/ext/standard/tests/password/password_make_salt_error.phpt b/ext/standard/tests/password/password_make_salt_error.phpt deleted file mode 100644 index 92df53a..0000000 --- a/ext/standard/tests/password/password_make_salt_error.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test error operation of password_make_salt() ---FILE-- -<?php -//-=-=-=- - -var_dump(password_make_salt()); - -var_dump(password_make_salt("foo")); - -var_dump(password_make_salt(-1)); - -var_dump(password_make_salt(PHP_INT_MAX)); - -var_dump(password_make_salt(floor(PHP_INT_MAX / 2.9))); - -var_dump(password_make_salt(5, 999)); - -?> ---EXPECTF-- -Warning: password_make_salt() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: password_make_salt() expects parameter 1 to be long, string given in %s on line %d -NULL - -Warning: password_make_salt(): Length cannot be less than or equal zero: -1 in %s on line %d -NULL - -Warning: password_make_salt(): Length is too large to safely generate in %s on line %d -NULL - -Warning: password_make_salt(): Length is too large to safely generate in %s on line %d -NULL - -Warning: password_make_salt(): Unknown salt type paramter in %s on line %d -bool(false) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php