From 2161173d58321f94d6908577ceb2d1454311f337 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 28 Jun 2021 08:55:50 +0200 Subject: update to 1.7.0 fix loadResolvConfBlocking to only return valid IPs from https://github.com/reactphp/dns/pull/181 --- 181.patch | 29 +++++++++++++++++++++++++++++ php-react-dns.spec | 6 ++++++ 2 files changed, 35 insertions(+) create mode 100644 181.patch diff --git a/181.patch b/181.patch new file mode 100644 index 0000000..e3ce883 --- /dev/null +++ b/181.patch @@ -0,0 +1,29 @@ +From 24f0601345fa245eddaaecab5dde8fc0d14b0ef6 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 28 Jun 2021 08:47:07 +0200 +Subject: [PATCH] only return valid IPs + +--- + src/Config/Config.php | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/Config/Config.php b/src/Config/Config.php +index 37ae91d..81b70a4 100644 +--- a/src/Config/Config.php ++++ b/src/Config/Config.php +@@ -85,7 +85,14 @@ public static function loadResolvConfBlocking($path = null) + preg_match_all('/^nameserver\s+(\S+)\s*$/m', $contents, $matches); + + $config = new self(); +- $config->nameservers = $matches[1]; ++ $config->nameservers = []; ++ ++ /* only valid IP */ ++ foreach($matches[1] as $n) { ++ if (filter_var("$n",FILTER_VALIDATE_IP)) { ++ $config->nameservers[] = $n; ++ } ++ } + + return $config; + } diff --git a/php-react-dns.spec b/php-react-dns.spec index 53d711d..9455c6c 100644 --- a/php-react-dns.spec +++ b/php-react-dns.spec @@ -55,6 +55,9 @@ URL: https://reactphp.org/dns/ Source0: %{name}-%{github_version}-%{github_commit}.tar.gz Source1: %{name}-get-source.sh +# Filter valid IPs +Patch0: https://patch-diff.githubusercontent.com/raw/reactphp/dns/pull/181.patch + BuildArch: noarch # Tests %if %{with tests} @@ -133,6 +136,7 @@ Autoloader: %{phpdir}/React/Dns/autoload.php %prep %setup -qn %{github_name}-%{github_commit} +%patch0 -p1 %build @@ -214,6 +218,8 @@ exit $RETURN_CODE %changelog * Mon Jun 28 2021 Remi Collet - 1.7.0-1 - update to 1.7.0 +- fix loadResolvConfBlocking to only return valid IPs + from https://github.com/reactphp/dns/pull/181 * Mon Jun 21 2021 Remi Collet - 1.6.0-1 - update to 1.6.0 -- cgit