aboutsummaryrefslogtreecommitdiffstats
path: root/testing/php7/fix-crypt.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/php7/fix-crypt.patch')
-rw-r--r--testing/php7/fix-crypt.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/testing/php7/fix-crypt.patch b/testing/php7/fix-crypt.patch
new file mode 100644
index 0000000000..f21ee4d5fe
--- /dev/null
+++ b/testing/php7/fix-crypt.patch
@@ -0,0 +1,77 @@
+--- php-7.0.4.orig/ext/standard/config.m4
++++ php-7.0.4/ext/standard/config.m4
+@@ -314,7 +314,7 @@
+ fi
+ AC_DEFINE_UNQUOTED(PHP_MD5_CRYPT, $ac_result, [Whether the system supports MD5 salt])
+
+- if test "$ac_cv_crypt_sha512" = "yes"; then
++ if test "$ac_cv_crypt_SHA512" = "yes"; then
+ ac_result=1
+ ac_crypt_sha512=1
+ else
+@@ -323,7 +323,7 @@
+ fi
+ AC_DEFINE_UNQUOTED(PHP_SHA512_CRYPT, $ac_result, [Whether the system supports SHA512 salt])
+
+- if test "$ac_cv_crypt_sha256" = "yes"; then
++ if test "$ac_cv_crypt_SHA256" = "yes"; then
+ ac_result=1
+ ac_crypt_sha256=1
+ else
+--- php-7.0.4.orig/ext/standard/crypt.c
++++ php-7.0.4/ext/standard/crypt.c
+@@ -58,6 +58,7 @@
+ #include "php_lcg.h"
+ #include "php_crypt.h"
+ #include "php_rand.h"
++#include "php_config.h"
+
+ /* The capabilities of the crypt() function is determined by the test programs
+ * run by configure from aclocal.m4. They will set PHP_STD_DES_CRYPT,
+@@ -245,24 +246,27 @@
+ }
+ }
+ #else
++ if (salt[0] != '$' && salt[0] != '_' && (!IS_VALID_SALT_CHARACTER(salt[0]) || !IS_VALID_SALT_CHARACTER(salt[1]))) {
++ if (!quiet) {
++ /* error consistently about invalid DES fallbacks */
++ php_error_docref(NULL, E_DEPRECATED, DES_INVALID_SALT_ERROR);
++ }
++ }
+
+-# if defined(HAVE_CRYPT_R) && (defined(_REENTRANT) || defined(_THREAD_SAFE))
+ {
+-# if defined(CRYPT_R_STRUCT_CRYPT_DATA)
++# if defined(HAVE_CRYPT_R)
++# if defined(CRYPT_R_STRUCT_CRYPT_DATA)
+ struct crypt_data buffer;
+ memset(&buffer, 0, sizeof(buffer));
+-# elif defined(CRYPT_R_CRYPTD)
++# elif defined(CRYPT_R_CRYPTD)
+ CRYPTD buffer;
++# else
++# error Data struct used by crypt_r() is unknown. Please report.
++# endif
++ crypt_res = crypt_r(password, salt, &buffer);
+ # else
+-# error Data struct used by crypt_r() is unknown. Please report.
++ crypt_res = crypt(password, salt, &buffer);
+ # endif
+- if (salt[0] != '$' && salt[0] != '_' && (!IS_VALID_SALT_CHARACTER(salt[0]) || !IS_VALID_SALT_CHARACTER(salt[1]))) {
+- if (!quiet) {
+- /* error consistently about invalid DES fallbacks */
+- php_error_docref(NULL, E_DEPRECATED, DES_INVALID_SALT_ERROR);
+- }
+- }
+- crypt_res = crypt_r(password, salt, &buffer);
+ if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
+ return NULL;
+ } else {
+@@ -270,7 +274,6 @@
+ return result;
+ }
+ }
+-# endif
+ #endif
+ }
+ /* }}} */