]> granicus.if.org Git - php/commitdiff
Remove password_make_salt() from the implementation
authorAnthony Ferrara <ircmaxell@gmail.com>
Tue, 28 Aug 2012 15:24:33 +0000 (11:24 -0400)
committerAnthony Ferrara <ircmaxell@gmail.com>
Tue, 28 Aug 2012 15:24:33 +0000 (11:24 -0400)
ext/standard/basic_functions.c
ext/standard/password.c
ext/standard/php_password.h
ext/standard/tests/password/password_make_salt.phpt [deleted file]
ext/standard/tests/password/password_make_salt_error.phpt [deleted file]

index e6b155979fbcb1f8bbae75a02cf43a236d064ffa..1f1b3d366db955df3435b7719fa5948f8de519ef 100644 (file)
@@ -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)
 
index 2e5d62acecaea8837313aa9dc123f7b9077be6cd..4f8ef5dcab7ca0197afafd9b95ecf9d41cd9c6cb 100644 (file)
@@ -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)
index 8211ae175331f44c50cac91a61367c7819cc5327..d99c061c008bfea52132a5de5e00f8e17d938602 100644 (file)
@@ -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 (file)
index c7aa514..0000000
+++ /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 (file)
index 92df53a..0000000
+++ /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)