php: fix crypt segfault on musl (patches from Alpine)

This commit is contained in:
Eivind Uggedal 2015-08-18 14:19:17 +00:00
parent 526bfa987f
commit 8bbe66dae3
3 changed files with 62 additions and 1 deletions

View file

@ -0,0 +1,20 @@
--- ext/standard/config.m4.orig
+++ 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

View file

@ -0,0 +1,41 @@
Reported upstream:
https://bugs.php.net/bug.php?id=67512
--- ext/standard/crypt.c.orig 2014-06-25 13:10:38.930010191 -0300
+++ ext/standard/crypt.c 2014-06-25 13:45:09.762124864 -0300
@@ -228,18 +228,20 @@
}
}
#else
-
-# 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
+# else
+# error Data struct used by crypt_r() is unknown. Please report.
+# endif
crypt_res = crypt_r(password, salt, &buffer);
+# else
+ crypt_res = crypt(passwrd, salt);
+#endif
if (!crypt_res || (salt[0] == '*' && salt[1] == '0')) {
return FAILURE;
} else {
@@ -247,7 +249,6 @@
return SUCCESS;
}
}
-# endif
#endif
}
/* }}} */

View file

@ -1,7 +1,7 @@
# Template build file for 'php'
pkgname=php
version=5.6.12
revision=1
revision=2
short_desc="An HTML-embedded scripting language"
license="PHP"
homepage="http://www.php.net"