From 3c440a82798cc4d4a95730a5305b6210bfbc9dd4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 16 Nov 2014 09:16:48 +0100 Subject: PHP 5.6.3 + upstream patches for php-fpm --- php-bug68419.patch | 27 ++++++++++++++++++++ php-bug68420.patch | 53 ++++++++++++++++++++++++++++++++++++++++ php-bug68421.patch | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ php56.spec | 22 ++++++++++++----- 4 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 php-bug68419.patch create mode 100644 php-bug68420.patch create mode 100644 php-bug68421.patch diff --git a/php-bug68419.patch b/php-bug68419.patch new file mode 100644 index 0000000..5db1acd --- /dev/null +++ b/php-bug68419.patch @@ -0,0 +1,27 @@ +From 1b156207446e0c5ec8a9476ad0966b5daa82f516 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 13 Nov 2014 13:08:00 +0100 +Subject: [PATCH] Fix build with gmp < 4.2 + +See 3d6d863ccbd10d212352462b587ae1573af4f1d1 +and acd7fcf55f81955e4837c750a5e45f83d3c55ba2 +--- + ext/gmp/gmp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c +index e9c1ad3..de61f1c 100644 +--- a/ext/gmp/gmp.c ++++ b/ext/gmp/gmp.c +@@ -1776,7 +1776,7 @@ static void gmp_init_random(TSRMLS_D) + #if GMP_42_OR_NEWER + gmp_randinit_mt(GMPG(rand_state)); + #else +- gmp_randinit_lc_2exp(GMPG(rand_state), 32L); ++ gmp_randinit_lc_2exp_size(GMPG(rand_state), 32L); + #endif + /* Seed */ + gmp_randseed_ui(GMPG(rand_state), GENERATE_SEED()); +-- +2.1.0 + diff --git a/php-bug68420.patch b/php-bug68420.patch new file mode 100644 index 0000000..0191244 --- /dev/null +++ b/php-bug68420.patch @@ -0,0 +1,53 @@ +From 1d9bb287c566425a9ab4b8de62940565fe357270 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Sat, 15 Nov 2014 08:08:23 +0100 +Subject: [PATCH] Fixed Bug #68420 listen=9000 listens to ipv6 localhost + instead of all addresses + +Restore default behavior when no address configured: +Listen on all IPv4 addresses. + +At some time we could consider to switch to all IPv6 +but this will be a BC break. +--- + sapi/fpm/fpm/fpm_sockets.c | 24 +++++++++++++++++------- + 1 file changed, 17 insertions(+), 7 deletions(-) + +diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c +index 3e4f09c..9d9def3 100644 +--- a/sapi/fpm/fpm/fpm_sockets.c ++++ b/sapi/fpm/fpm/fpm_sockets.c +@@ -274,13 +274,23 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* + return -1; + } + +- // strip brackets from address for getaddrinfo +- if (addr != NULL) { +- addr_len = strlen(addr); +- if (addr[0] == '[' && addr[addr_len - 1] == ']') { +- addr[addr_len - 1] = '\0'; +- addr++; +- } ++ if (!addr) { ++ /* no address: default documented behavior, all IPv4 addresses */ ++ struct sockaddr_in sa_in; ++ ++ memset(&sa_in, 0, sizeof(sa_in)); ++ sa_in.sin_family = AF_INET; ++ sa_in.sin_port = htons(port); ++ sa_in.sin_addr.s_addr = htonl(INADDR_ANY); ++ free(dup_address); ++ return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct sockaddr_in)); ++ } ++ ++ /* strip brackets from address for getaddrinfo */ ++ addr_len = strlen(addr); ++ if (addr[0] == '[' && addr[addr_len - 1] == ']') { ++ addr[addr_len - 1] = '\0'; ++ addr++; + } + + memset(&hints, 0, sizeof hints); +-- +2.1.0 + diff --git a/php-bug68421.patch b/php-bug68421.patch new file mode 100644 index 0000000..0f59efd --- /dev/null +++ b/php-bug68421.patch @@ -0,0 +1,72 @@ +From 5112fdd670175f4eab4529c84ccf4774f5577797 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 14 Nov 2014 19:09:50 +0100 +Subject: [PATCH] Fix bug #68421 access.format='%R' doesn't log ipv6 address + +--- + sapi/fpm/fpm/fastcgi.c | 10 ++++++++-- + sapi/fpm/fpm/fastcgi.h | 2 +- + sapi/fpm/fpm/fpm_log.c | 2 +- + 3 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c +index d77b6f8..86fca17 100644 +--- a/sapi/fpm/fpm/fastcgi.c ++++ b/sapi/fpm/fpm/fastcgi.c +@@ -137,6 +137,7 @@ typedef union _sa_t { + struct sockaddr sa; + struct sockaddr_un sa_unix; + struct sockaddr_in sa_inet; ++ struct sockaddr_in6 sa_inet6; + } sa_t; + + static HashTable fcgi_mgmt_vars; +@@ -1094,12 +1095,17 @@ void fcgi_free_mgmt_var_cb(void * ptr) + pefree(*var, 1); + } + +-char *fcgi_get_last_client_ip() /* {{{ */ ++const char *fcgi_get_last_client_ip() /* {{{ */ + { ++ static char str[INET6_ADDRSTRLEN]; ++ + if (client_sa.sa.sa_family == AF_UNIX) { + return NULL; + } +- return inet_ntoa(client_sa.sa_inet.sin_addr); ++ if (client_sa.sa.sa_family == AF_INET) { ++ return inet_ntop(client_sa.sa.sa_family, &client_sa.sa_inet.sin_addr, str, INET6_ADDRSTRLEN); ++ } ++ return inet_ntop(client_sa.sa.sa_family, &client_sa.sa_inet6.sin6_addr, str, INET6_ADDRSTRLEN); + } + /* }}} */ + /* +diff --git a/sapi/fpm/fpm/fastcgi.h b/sapi/fpm/fpm/fastcgi.h +index 34f9eef..f5cfe9f 100644 +--- a/sapi/fpm/fpm/fastcgi.h ++++ b/sapi/fpm/fpm/fastcgi.h +@@ -133,7 +133,7 @@ int fcgi_flush(fcgi_request *req, int close); + void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len); + void fcgi_free_mgmt_var_cb(void * ptr); + +-char *fcgi_get_last_client_ip(); ++const char *fcgi_get_last_client_ip(); + + /* + * Local variables: +diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c +index 4e1a057..c71281b 100644 +--- a/sapi/fpm/fpm/fpm_log.c ++++ b/sapi/fpm/fpm/fpm_log.c +@@ -367,7 +367,7 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */ + + case 'R': /* remote IP address */ + if (!test) { +- char *tmp = fcgi_get_last_client_ip(); ++ const char *tmp = fcgi_get_last_client_ip(); + len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", tmp ? tmp : "-"); + } + break; +-- +2.1.0 + diff --git a/php56.spec b/php56.spec index 3e290fe..3237fe1 100644 --- a/php56.spec +++ b/php56.spec @@ -135,7 +135,7 @@ Version: 5.6.3 %if 0%{?snapdate:1}%{?rcver:1} Release: 0.4.%{?snapdate}%{?rcver}%{?dist} %else -Release: 2%{?dist} +Release: 3%{?dist} %endif # All files licensed under PHP version 3.01, except # Zend is licensed under Zend @@ -197,8 +197,10 @@ Patch47: php-5.6.3-phpinfo.patch Patch91: php-5.6.3-oci8conf.patch # Upstream fixes (100+) -Patch100: php-gmp41.patch +Patch100: php-bug68419.patch Patch101: php-bug68423.patch +Patch102: php-bug68421.patch +Patch103: php-bug68420.patch # Security fixes (200+) @@ -956,8 +958,10 @@ rm -rf ext/json %patch91 -p1 -b .remi-oci8 # upstream patches -%patch100 -p1 -b .gmp41 +%patch100 -p1 -b .bug68419 %patch101 -p1 -b .bug68423 +%patch102 -p1 -b .bug68421 +%patch103 -p1 -b .bug68420 # security patches @@ -1947,13 +1951,19 @@ fi %changelog -* Fri Nov 14 2014 Remi Collet 5.6.3-2 -- add upstream patch for https://bugs.php.net/68423 +* Sun Nov 16 2014 Remi Collet 5.6.3-3 +- FPM: add upstream patch for https://bugs.php.net/68421 + access.format=R doesn't log ipv6 address +- FPM: add upstream patch for https://bugs.php.net/68420 + listen=9000 listens to ipv6 localhost instead of all addresses +- FPM: add upstream patch for https://bugs.php.net/68423 + will no longer load all pools * Thu Nov 13 2014 Remi Collet 5.6.3-1 - Update to PHP 5.6.3 http://php.net/releases/5_6_3.php -- add upstream patch for EL-5 and gmp 4.1 +- GMP: add upstream patch for https://bugs.php.net/68419 + Fix build with libgmp < 4.2 * Thu Oct 30 2014 Remi Collet 5.6.3-0.4.RC1 - php 5.6.3RC1 (refreshed, phpdbg changes reverted) -- cgit