update to 5.6.4RC1

This commit is contained in:
Remi Collet 2014-11-28 06:52:36 +01:00
parent e006dc9375
commit ae664d387c
7 changed files with 8 additions and 358 deletions

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ php-5.5.*.xz
/php-5.6.2-strip.tar.xz
/php-5.6.3RC1-strip.tar.xz
/php-5.6.3-strip.tar.xz
/php-5.6.4RC1-strip.tar.xz

View File

@ -1,53 +0,0 @@
From 1d9bb287c566425a9ab4b8de62940565fe357270 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
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

View File

@ -1,118 +0,0 @@
From 5112fdd670175f4eab4529c84ccf4774f5577797 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
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
From 4657289e87e18bb8967d5a8b0163c772d410e2b8 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Mon, 17 Nov 2014 06:53:38 +0100
Subject: [PATCH] Improve fix bug #68421 access.format='%R' doesn't log ipv6
address
Log IPv4-Mapped-Ipv6 address as IPv4 (not as IPv6)
---
sapi/fpm/fpm/fastcgi.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c
index 86fca17..d1db0ec 100644
--- a/sapi/fpm/fpm/fastcgi.c
+++ b/sapi/fpm/fpm/fastcgi.c
@@ -1099,13 +1099,23 @@ const char *fcgi_get_last_client_ip() /* {{{ */
{
static char str[INET6_ADDRSTRLEN];
- if (client_sa.sa.sa_family == AF_UNIX) {
- return NULL;
- }
+ /* Ipv4 */
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);
+#ifdef IN6_IS_ADDR_V4MAPPED
+ /* Ipv4-Mapped-Ipv6 */
+ if (client_sa.sa.sa_family == AF_INET6
+ && IN6_IS_ADDR_V4MAPPED(&client_sa.sa_inet6.sin6_addr)) {
+ return inet_ntop(AF_INET, ((char *)&client_sa.sa_inet6.sin6_addr)+12, str, INET6_ADDRSTRLEN);
+ }
+#endif
+ /* Ipv6 */
+ if (client_sa.sa.sa_family == AF_INET6) {
+ return inet_ntop(client_sa.sa.sa_family, &client_sa.sa_inet6.sin6_addr, str, INET6_ADDRSTRLEN);
+ }
+ /* Unix socket */
+ return NULL;
}
/* }}} */
/*
--
2.1.0

View File

@ -1,55 +0,0 @@
From 23db11976889c3600cf7853fe0fd687a1c9435e6 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Fri, 14 Nov 2014 17:29:31 +0100
Subject: [PATCH] Fix bug #68423i PHP-FPM will no longer load all pools
The hash need to be unique per IP + Port
Previous version have (IPv4 only)
sprintf(key, "%u.%u.%u.%u:%u", IPQUAD(&sa_in->sin_addr), (unsigned int) ntohs(sa_in->sin_port));
---
sapi/fpm/fpm/fpm_sockets.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index da14d63..3e4f09c 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -85,13 +85,24 @@ static void *fpm_get_in_addr(struct sockaddr *sa) /* {{{ */
}
/* }}} */
+static int fpm_get_in_port(struct sockaddr *sa) /* {{{ */
+{
+ if (sa->sa_family == AF_INET) {
+ return ntohs(((struct sockaddr_in*)sa)->sin_port);
+ }
+
+ return ntohs(((struct sockaddr_in6*)sa)->sin6_port);
+}
+/* }}} */
+
static int fpm_sockets_hash_op(int sock, struct sockaddr *sa, char *key, int type, int op) /* {{{ */
{
if (key == NULL) {
switch (type) {
case FPM_AF_INET : {
- key = alloca(INET6_ADDRSTRLEN);
- inet_ntop(sa->sa_family, fpm_get_in_addr(sa), key, sizeof key);
+ key = alloca(INET6_ADDRSTRLEN+10);
+ inet_ntop(sa->sa_family, fpm_get_in_addr(sa), key, INET6_ADDRSTRLEN);
+ sprintf(key+strlen(key), ":%d", fpm_get_in_port(sa));
break;
}
@@ -246,7 +257,7 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
char *addr = NULL;
int addr_len;
int port = 0;
- int sock;
+ int sock = -1;
int status;
if (port_str) { /* this is host:port pair */
--
2.1.0

View File

@ -1,120 +0,0 @@
From 3a8103ae4738824ebb27a9a739e253740580ed36 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Mon, 17 Nov 2014 09:22:13 +0100
Subject: [PATCH] Fixed bug #68428 allowed_client is IPv4 only
---
sapi/fpm/fpm/fastcgi.c | 72 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 50 insertions(+), 22 deletions(-)
diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c
index d1db0ec..36e37b7 100644
--- a/sapi/fpm/fpm/fastcgi.c
+++ b/sapi/fpm/fpm/fastcgi.c
@@ -144,7 +144,7 @@ static HashTable fcgi_mgmt_vars;
static int is_initialized = 0;
static int in_shutdown = 0;
-static in_addr_t *allowed_clients = NULL;
+static sa_t *allowed_clients = NULL;
static sa_t client_sa;
@@ -267,14 +267,18 @@ void fcgi_set_allowed_clients(char *ip)
*end = 0;
end++;
}
- allowed_clients[n] = inet_addr(cur);
- if (allowed_clients[n] == INADDR_NONE) {
+ if (inet_pton(AF_INET, cur, &allowed_clients[n].sa_inet.sin_addr)>0) {
+ allowed_clients[n].sa.sa_family = AF_INET;
+ n++;
+ } else if (inet_pton(AF_INET6, cur, &allowed_clients[n].sa_inet6.sin6_addr)>0) {
+ allowed_clients[n].sa.sa_family = AF_INET6;
+ n++;
+ } else {
zlog(ZLOG_ERROR, "Wrong IP address '%s' in listen.allowed_clients", cur);
}
- n++;
cur = end;
}
- allowed_clients[n] = INADDR_NONE;
+ allowed_clients[n].sa.sa_family = 0;
free(ip);
}
}
@@ -760,6 +764,43 @@ void fcgi_close(fcgi_request *req, int force, int destroy)
}
}
+static int fcgi_is_allowed() {
+ int i;
+
+ if (client_sa.sa.sa_family == AF_UNIX) {
+ return 1;
+ }
+ if (!allowed_clients) {
+ return 1;
+ }
+ if (client_sa.sa.sa_family == AF_INET) {
+ for (i=0 ; allowed_clients[i].sa.sa_family ; i++) {
+ if (allowed_clients[i].sa.sa_family == AF_INET
+ && !memcmp(&client_sa.sa_inet.sin_addr, &allowed_clients[i].sa_inet.sin_addr, 4)) {
+ return 1;
+ }
+ }
+ }
+ if (client_sa.sa.sa_family == AF_INET6) {
+ for (i=0 ; allowed_clients[i].sa.sa_family ; i++) {
+ if (allowed_clients[i].sa.sa_family == AF_INET6
+ && !memcmp(&client_sa.sa_inet6.sin6_addr, &allowed_clients[i].sa_inet6.sin6_addr, 12)) {
+ return 1;
+ }
+#ifdef IN6_IS_ADDR_V4MAPPED
+ if (allowed_clients[i].sa.sa_family == AF_INET
+ && IN6_IS_ADDR_V4MAPPED(&client_sa.sa_inet6.sin6_addr)
+ && !memcmp(((char *)&client_sa.sa_inet6.sin6_addr)+12, &allowed_clients[i].sa_inet.sin_addr, 4)) {
+ return 1;
+ }
+#endif
+ }
+ }
+
+ zlog(ZLOG_ERROR, "Connection disallowed: IP address '%s' has been dropped.", fcgi_get_last_client_ip());
+ return 0;
+}
+
int fcgi_accept_request(fcgi_request *req)
{
#ifdef _WIN32
@@ -810,23 +851,10 @@ int fcgi_accept_request(fcgi_request *req)
FCGI_UNLOCK(req->listen_socket);
client_sa = sa;
- if (sa.sa.sa_family == AF_INET && req->fd >= 0 && allowed_clients) {
- int n = 0;
- int allowed = 0;
-
- while (allowed_clients[n] != INADDR_NONE) {
- if (allowed_clients[n] == sa.sa_inet.sin_addr.s_addr) {
- allowed = 1;
- break;
- }
- n++;
- }
- if (!allowed) {
- zlog(ZLOG_ERROR, "Connection disallowed: IP address '%s' has been dropped.", inet_ntoa(sa.sa_inet.sin_addr));
- closesocket(req->fd);
- req->fd = -1;
- continue;
- }
+ if (req->fd >= 0 && !fcgi_is_allowed()) {
+ closesocket(req->fd);
+ req->fd = -1;
+ continue;
}
}
--
2.1.0

View File

@ -57,12 +57,12 @@
%global db_devel libdb-devel
%endif
#global rcver RC1
%global rcver RC1
Summary: PHP scripting language for creating dynamic web sites
Name: php
Version: 5.6.3
Release: 4%{?dist}
Version: 5.6.4
Release: 0.1.RC1%{?dist}
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
# TSRM is licensed under BSD
@ -114,10 +114,6 @@ Patch46: php-5.6.3-fixheader.patch
Patch47: php-5.6.3-phpinfo.patch
# Upstream fixes (100+)
Patch101: php-bug68423.patch
Patch102: php-bug68421.patch
Patch103: php-bug68420.patch
Patch104: php-bug68428.patch
# Security fixes (200+)
@ -720,10 +716,6 @@ httpd -V | grep -q 'threaded:.*yes' && exit 1
%patch47 -p1 -b .phpinfo
# upstream patches
%patch101 -p1 -b .bug68423
%patch102 -p1 -b .bug68421
%patch103 -p1 -b .bug68420
%patch104 -p1 -b .bug68428
# security patches
@ -1484,6 +1476,9 @@ rm -f README.{Zeus,QNX,CVS-RULES}
%changelog
* Fri Nov 28 2014 Remi Collet <rcollet@redhat.com> 5.6.4-0.1.RC1
- php 5.6.4RC1
* Mon Nov 17 2014 Remi Collet <remi@fedoraproject.org> 5.6.3-4
- FPM: add upstream patch for https://bugs.php.net/68428
listen.allowed_clients is IPv4 only

View File

@ -1 +1 @@
b1c660cc4bf8445bc29b3fde2c6b40c6 php-5.6.3-strip.tar.xz
df8c2a93ace40eb35f10ae9fa9173109 php-5.6.4RC1-strip.tar.xz