1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
}
/* }}} */
|