diff --git a/SOURCES/memcached-ipv6.patch b/SOURCES/memcached-ipv6.patch new file mode 100644 index 0000000..bd4040d --- /dev/null +++ b/SOURCES/memcached-ipv6.patch @@ -0,0 +1,58 @@ +commit 4baa578f2b7552ed44482b32fb18dc4bbb53f538 +Author: githublvv +Date: Fri Jan 9 18:15:36 2015 -0500 + + Fix for 310: memcached unable to bind to an ipv6 address + + URL: https://code.google.com/p/memcached/issues/detail?id=310 + +diff --git a/memcached.c b/memcached.c +index 154b15a..1181966 100644 +--- a/memcached.c ++++ b/memcached.c +@@ -4614,15 +4614,40 @@ static int server_sockets(int port, enum network_transport transport, + p != NULL; + p = strtok_r(NULL, ";,", &b)) { + int the_port = port; ++ ++ char *h = NULL; ++ if (*p == '[') { ++ // expecting it to be an IPv6 address enclosed in [] ++ // i.e. RFC3986 style recommended by RFC5952 ++ char *e = strchr(p, ']'); ++ if (e == NULL) { ++ fprintf(stderr, "Invalid IPV6 address: \"%s\"", p); ++ return 1; ++ } ++ h = ++p; // skip the opening '[' ++ *e = '\0'; ++ p = ++e; // skip the closing ']' ++ } ++ + char *s = strchr(p, ':'); + if (s != NULL) { +- *s = '\0'; +- ++s; +- if (!safe_strtol(s, &the_port)) { +- fprintf(stderr, "Invalid port number: \"%s\"", s); +- return 1; ++ // If no more semicolons - attempt to treat as port number. ++ // Otherwise the only valid option is an unenclosed IPv6 without port, until ++ // of course there was an RFC3986 IPv6 address previously specified - ++ // in such a case there is no good option, will just send it to fail as port number. ++ if (strchr(s + 1, ':') == NULL || h != NULL) { ++ *s = '\0'; ++ ++s; ++ if (!safe_strtol(s, &the_port)) { ++ fprintf(stderr, "Invalid port number: \"%s\"", s); ++ return 1; ++ } + } + } ++ ++ if (h != NULL) ++ p = h; ++ + if (strcmp(p, "*") == 0) { + p = NULL; + } diff --git a/SPECS/memcached.spec b/SPECS/memcached.spec index ef4747e..0329864 100644 --- a/SPECS/memcached.spec +++ b/SPECS/memcached.spec @@ -3,7 +3,7 @@ Name: memcached Version: 1.4.15 -Release: 9%{?dist} +Release: 9%{?dist}.1 Epoch: 0 Summary: High Performance, Distributed Memory Object Cache @@ -19,6 +19,7 @@ Source1: memcached.service Patch001: memcached-manpages.patch Patch002: memcached-CVE-2011-4971.patch Patch003: memcached-CVE-2013-0179_7290_7291.patch +Patch005: memcached-ipv6.patch # Fixes @@ -58,6 +59,7 @@ access to the memcached binary include files. %patch001 -p1 -b .manpages %patch002 -p1 -b .CVE-2011-4971 %patch003 -p1 -b .CVE-2013-0179_7290_7291 +%patch005 -p1 -b .ipv6 %build # compile with full RELRO @@ -157,6 +159,9 @@ exit 0 %{_includedir}/memcached/* %changelog +* Thu Aug 11 2016 Miroslav Lichvar - 0:1.4.15-9.el7_2.1 +- fix binding to IPv6 address (#1366158) + * Fri Jan 24 2014 Daniel Mach - 01.4.15-9 - Mass rebuild 2014-01-24