Hello community,

here is the log from the commit of package c-ares for openSUSE:Factory checked 
in at 2019-10-28 16:46:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/c-ares (Old)
 and      /work/SRC/openSUSE:Factory/.c-ares.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "c-ares"

Mon Oct 28 16:46:11 2019 rev:4 rq:742209 version:1.15.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/c-ares/c-ares.changes    2019-02-24 
17:06:50.956581897 +0100
+++ /work/SRC/openSUSE:Factory/.c-ares.new.2990/c-ares.changes  2019-10-28 
16:46:11.616687690 +0100
@@ -1,0 +2,17 @@
+Wed Oct 23 15:11:27 UTC 2019 - Michał Rostecki <[email protected]>
+
+- Add upstream patches with the ares_getaddrinfo function:
+  * 0001-Add-initial-implementation-for-ares_getaddrinfo-112.patch
+  * 0002-Remaining-queries-counter-fix-additional-unit-tests-.patch
+  * 0003-Bugfix-for-ares_getaddrinfo-and-additional-unit-test.patch
+  * 0004-Add-ares__sortaddrinfo-to-support-getaddrinfo-sorted.patch
+  * 0005-getaddrinfo-avoid-infinite-loop-in-case-of-NXDOMAIN-.patch
+  * 0006-getaddrinfo-callback-must-be-called-on-bad-domain-24.patch
+  * 0007-getaddrinfo-enhancements-257.patch
+  * 0008-Add-missing-limits.h-include-from-ares_getaddrinfo.c.patch
+  * 0009-Increase-portability-of-ares-test-mock-ai.cc-235.patch
+- Add a patch which disables test failing on OBS (but passing in
+  local environment):
+  * 0010-Disable-failing-test.patch
+
+-------------------------------------------------------------------

New:
----
  0001-Add-initial-implementation-for-ares_getaddrinfo-112.patch
  0002-Remaining-queries-counter-fix-additional-unit-tests-.patch
  0003-Bugfix-for-ares_getaddrinfo-and-additional-unit-test.patch
  0004-Add-ares__sortaddrinfo-to-support-getaddrinfo-sorted.patch
  0005-getaddrinfo-avoid-infinite-loop-in-case-of-NXDOMAIN-.patch
  0006-getaddrinfo-callback-must-be-called-on-bad-domain-24.patch
  0007-getaddrinfo-enhancements-257.patch
  0008-Add-missing-limits.h-include-from-ares_getaddrinfo.c.patch
  0009-Increase-portability-of-ares-test-mock-ai.cc-235.patch
  0010-Disable-failing-test.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ c-ares.spec ++++++
--- /var/tmp/diff_new_pack.SFpi0Z/_old  2019-10-28 16:46:12.968689411 +0100
+++ /var/tmp/diff_new_pack.SFpi0Z/_new  2019-10-28 16:46:13.000689451 +0100
@@ -31,6 +31,26 @@
 Patch0:         0001-Use-RPM-compiler-options.patch
 Patch1:         disable-live-tests.patch
 Patch2:         onion-crash.patch
+# PATCH-FEATURE-UPSTREAM 
0001-Add-initial-implementation-for-ares_getaddrinfo-112.patch
+Patch3:         0001-Add-initial-implementation-for-ares_getaddrinfo-112.patch
+# PATCH-FEATURE-UPSTREAM 
0002-Remaining-queries-counter-fix-additional-unit-tests-.patch
+Patch4:         0002-Remaining-queries-counter-fix-additional-unit-tests-.patch
+# PATCH-FEATURE-UPSTREAM 
0003-Bugfix-for-ares_getaddrinfo-and-additional-unit-test.patch
+Patch5:         0003-Bugfix-for-ares_getaddrinfo-and-additional-unit-test.patch
+# PATCH-FEATURE-UPSTREAM 
0004-Add-ares__sortaddrinfo-to-support-getaddrinfo-sorted.patch
+Patch6:         0004-Add-ares__sortaddrinfo-to-support-getaddrinfo-sorted.patch
+# PATCH-FEATURE-UPSTREAM 
0005-getaddrinfo-avoid-infinite-loop-in-case-of-NXDOMAIN-.patch
+Patch7:         0005-getaddrinfo-avoid-infinite-loop-in-case-of-NXDOMAIN-.patch
+# PATCH-FEATURE-UPSTREAM 
0006-getaddrinfo-callback-must-be-called-on-bad-domain-24.patch
+Patch8:         0006-getaddrinfo-callback-must-be-called-on-bad-domain-24.patch
+# PATCH-FEATURE-UPSTREAM 0007-getaddrinfo-enhancements-257.patch
+Patch9:         0007-getaddrinfo-enhancements-257.patch
+# PATCH-FEATURE-UPSTREAM 
0008-Add-missing-limits.h-include-from-ares_getaddrinfo.c.patch
+Patch10:        0008-Add-missing-limits.h-include-from-ares_getaddrinfo.c.patch
+# PATCH-FEATURE-UPSTREAM 
0009-Increase-portability-of-ares-test-mock-ai.cc-235.patch
+Patch11:        0009-Increase-portability-of-ares-test-mock-ai.cc-235.patch
+# PATCH-FIX-OPENSUSE 0010-Disable-failing-test.patch
+Patch12:        0010-Disable-failing-test.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  gcc-c++
@@ -65,10 +85,7 @@
 by Greg Hudson at MIT.
 
 %prep
-%setup -q
-%patch0 -p1
-%patch1 -p1
-%patch2 -p1
+%autosetup -p1
 
 # Remove bogus cflags checking
 sed -i -e '/XC_CHECK_BUILD_FLAGS/d' configure.ac

++++++ 0001-Add-initial-implementation-for-ares_getaddrinfo-112.patch ++++++
++++ 1189 lines (skipped)

++++++ 0002-Remaining-queries-counter-fix-additional-unit-tests-.patch ++++++
>From 6697ef495521ffd80386b6ccf162db286b36375f Mon Sep 17 00:00:00 2001
From: Christian Ammer <[email protected]>
Date: Sun, 11 Nov 2018 23:25:38 +0100
Subject: [PATCH 02/10] Remaining queries counter fix, additional unit tests
 for `ares_getaddrinfo` (#233)

Remaining queries counter fix, added tests (ParallelLookups,
SearchDomains, SearchDomainsServFailOnAAAA).  Removed unnecessary
if and commented code in test.

Fix By: Christian Ammer (@ChristianAmmer)
---
 ares_getaddrinfo.c        |  39 ++++++++-------
 test/ares-test-ai.h       |   7 +++
 test/ares-test-mock-ai.cc | 125 +++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 153 insertions(+), 18 deletions(-)

diff --git a/ares_getaddrinfo.c b/ares_getaddrinfo.c
index be936ff..36f29b5 100644
--- a/ares_getaddrinfo.c
+++ b/ares_getaddrinfo.c
@@ -122,7 +122,7 @@ void ares_getaddrinfo(ares_channel channel,
   hquery->arg = arg;
   hquery->timeouts = 0;
   hquery->next_domain = 0;
-  hquery->remaining = ai_family == AF_UNSPEC ? 2 : 1;
+  hquery->remaining = 0;
 
   /* Host file lookup */
   if (file_lookup(hquery->name, ai_family, &hquery->ai) == ARES_SUCCESS) {
@@ -291,9 +291,11 @@ static void next_dns_lookup(struct host_query *hquery) {
   if (s) {
     if (hquery->ai_family == AF_INET || hquery->ai_family == AF_UNSPEC) {
       ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery);
+      hquery->remaining++;
     }
     if (hquery->ai_family == AF_INET6 || hquery->ai_family == AF_UNSPEC) {
       ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery);
+      hquery->remaining++;
     }
     if (is_s_allocated) {
       ares_free(s);
@@ -306,9 +308,7 @@ static void next_dns_lookup(struct host_query *hquery) {
 }
 
 static void end_hquery(struct host_query *hquery, int status) {
-  if (hquery->ai) {
-    hquery->callback(hquery->arg, status, hquery->ai);
-  }
+  hquery->callback(hquery->arg, status, hquery->ai);
   ares_free(hquery->name);
   ares_free(hquery);
 }
@@ -319,11 +319,14 @@ static void host_callback(void *arg, int status, int 
timeouts,
   ares_channel channel = hquery->channel;
   struct hostent *host = NULL;
   int qtype;
+  int qtypestatus;
   hquery->timeouts += timeouts;
 
+  hquery->remaining--;
+
   if (status == ARES_SUCCESS) {
-    status = ares__parse_qtype_reply(abuf, alen, &qtype);
-    if (status == ARES_SUCCESS && qtype == T_A) {
+    qtypestatus = ares__parse_qtype_reply(abuf, alen, &qtype);
+    if (qtypestatus == ARES_SUCCESS && qtype == T_A) {
       /* Can ares_parse_a_reply be unsuccessful (after parse_qtype) */
       ares_parse_a_reply(abuf, alen, &host, NULL, NULL);
       if (host && channel->nsort) {
@@ -331,11 +334,8 @@ static void host_callback(void *arg, int status, int 
timeouts,
       }
       add_to_addrinfo(&hquery->ai, host);
       ares_free_hostent(host);
-      if (!--hquery->remaining) {
-       end_hquery(hquery, ARES_SUCCESS);
-      }
     }
-    else if (status == ARES_SUCCESS && qtype == T_AAAA) {
+    else if (qtypestatus == ARES_SUCCESS && qtype == T_AAAA) {
       /* Can ares_parse_a_reply be unsuccessful (after parse_qtype) */
       ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
       if (host && channel->nsort) {
@@ -343,18 +343,23 @@ static void host_callback(void *arg, int status, int 
timeouts,
       }
       add_to_addrinfo(&hquery->ai, host);
       ares_free_hostent(host);
-      if (!--hquery->remaining) {
-        end_hquery(hquery, ARES_SUCCESS);
-      }
+    }
+  }
+
+  if (!hquery->remaining) {
+    if (hquery->ai) {
+      // at least one query ended with ARES_SUCCESS
+      end_hquery(hquery, ARES_SUCCESS);
+    }
+    else if (status == ARES_ENOTFOUND) {
+      next_dns_lookup(hquery);
     }
     else {
-      assert(!hquery->ai);
       end_hquery(hquery, status);
     }
   }
-  else {
-    next_dns_lookup(hquery);
-  }
+
+  // at this point we keep on waiting for the next query to finish
 }
 
 static void sort_addresses(struct hostent *host,
diff --git a/test/ares-test-ai.h b/test/ares-test-ai.h
index e4c4403..a7a6a73 100644
--- a/test/ares-test-ai.h
+++ b/test/ares-test-ai.h
@@ -16,6 +16,13 @@ class MockChannelTestAI
   MockChannelTestAI() : MockChannelOptsTest(1, GetParam().first, 
GetParam().second, nullptr, 0) {}
 };
 
+class MockUDPChannelTestAI
+    : public MockChannelOptsTest,
+      public ::testing::WithParamInterface<int> {
+ public:
+  MockUDPChannelTestAI() : MockChannelOptsTest(1, GetParam(), false, nullptr, 
0) {}
+};
+
 // Structure that describes the result of an ares_addr_callback invocation.
 struct AIResult {
   // Whether the callback has been invoked.
diff --git a/test/ares-test-mock-ai.cc b/test/ares-test-mock-ai.cc
index 8ba1611..28a01be 100644
--- a/test/ares-test-mock-ai.cc
+++ b/test/ares-test-mock-ai.cc
@@ -52,6 +52,50 @@ MATCHER_P(IncludesV6Address, address, "") {
   return false;
 }
 
+// UDP only so mock server doesn't get confused by concatenated requests
+TEST_P(MockUDPChannelTestAI, ParallelLookups) {
+  DNSPacket rsp1;
+  rsp1.set_response().set_aa()
+    .add_question(new DNSQuestion("www.google.com", ns_t_a))
+    .add_answer(new DNSARR("www.google.com", 100, {2, 3, 4, 5}));
+  ON_CALL(server_, OnRequest("www.google.com", ns_t_a))
+    .WillByDefault(SetReply(&server_, &rsp1));
+  DNSPacket rsp2;
+  rsp2.set_response().set_aa()
+    .add_question(new DNSQuestion("www.example.com", ns_t_a))
+    .add_answer(new DNSARR("www.example.com", 100, {1, 2, 3, 4}));
+  ON_CALL(server_, OnRequest("www.example.com", ns_t_a))
+    .WillByDefault(SetReply(&server_, &rsp2));
+
+  struct ares_addrinfo hints = {};
+  hints.ai_family = AF_INET;
+  AIResult result1;
+  ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AICallback, 
&result1);
+  AIResult result2;
+  ares_getaddrinfo(channel_, "www.example.com.", NULL, &hints, AICallback, 
&result2);
+  AIResult result3;
+  ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AICallback, 
&result3);
+  Process();
+
+  EXPECT_TRUE(result1.done);
+  EXPECT_EQ(result1.status, ARES_SUCCESS);
+  EXPECT_THAT(result1.airesult, IncludesNumAddresses(1));
+  EXPECT_THAT(result1.airesult, IncludesV4Address("2.3.4.5"));
+  ares_freeaddrinfo(result1.airesult);
+
+  EXPECT_TRUE(result2.done);
+  EXPECT_EQ(result2.status, ARES_SUCCESS);
+  EXPECT_THAT(result2.airesult, IncludesNumAddresses(1));
+  EXPECT_THAT(result2.airesult, IncludesV4Address("1.2.3.4"));
+  ares_freeaddrinfo(result2.airesult);
+
+  EXPECT_TRUE(result3.done);
+  EXPECT_EQ(result3.status, ARES_SUCCESS);
+  EXPECT_THAT(result3.airesult, IncludesNumAddresses(1));
+  EXPECT_THAT(result3.airesult, IncludesV4Address("2.3.4.5"));
+  ares_freeaddrinfo(result3.airesult);
+}
+
 TEST_P(MockChannelTestAI, FamilyV6) {
   DNSPacket rsp6;
   rsp6.set_response().set_aa()
@@ -146,9 +190,88 @@ TEST_P(MockChannelTestAI, FamilyUnspecified) {
   ares_freeaddrinfo(result.airesult);
 }
 
-INSTANTIATE_TEST_CASE_P(AddressFamilies, MockChannelTestAI,
+TEST_P(MockChannelTestAI, SearchDomains) {
+  DNSPacket nofirst;
+  nofirst.set_response().set_aa().set_rcode(ns_r_nxdomain)
+    .add_question(new DNSQuestion("www.first.com", ns_t_a));
+  ON_CALL(server_, OnRequest("www.first.com", ns_t_a))
+    .WillByDefault(SetReply(&server_, &nofirst));
+  DNSPacket nosecond;
+  nosecond.set_response().set_aa().set_rcode(ns_r_nxdomain)
+    .add_question(new DNSQuestion("www.second.org", ns_t_a));
+  ON_CALL(server_, OnRequest("www.second.org", ns_t_a))
+    .WillByDefault(SetReply(&server_, &nosecond));
+  DNSPacket yesthird;
+  yesthird.set_response().set_aa()
+    .add_question(new DNSQuestion("www.third.gov", ns_t_a))
+    .add_answer(new DNSARR("www.third.gov", 0x0200, {2, 3, 4, 5}));
+  ON_CALL(server_, OnRequest("www.third.gov", ns_t_a))
+    .WillByDefault(SetReply(&server_, &yesthird));
+
+  AIResult result;
+  struct ares_addrinfo hints = {};
+  hints.ai_family = AF_INET;
+  ares_getaddrinfo(channel_, "www", NULL, &hints, AICallback, &result);
+  Process();
+  EXPECT_TRUE(result.done);
+  EXPECT_EQ(result.status, ARES_SUCCESS);
+  EXPECT_THAT(result.airesult, IncludesNumAddresses(1));
+  EXPECT_THAT(result.airesult, IncludesV4Address("2.3.4.5"));
+  ares_freeaddrinfo(result.airesult);
+}
+
+TEST_P(MockChannelTestAI, SearchDomainsServFailOnAAAA) {
+  DNSPacket nofirst;
+  nofirst.set_response().set_aa().set_rcode(ns_r_nxdomain)
+    .add_question(new DNSQuestion("www.first.com", ns_t_aaaa));
+  ON_CALL(server_, OnRequest("www.first.com", ns_t_aaaa))
+    .WillByDefault(SetReply(&server_, &nofirst));
+  DNSPacket nofirst4;
+  nofirst4.set_response().set_aa().set_rcode(ns_r_nxdomain)
+    .add_question(new DNSQuestion("www.first.com", ns_t_a));
+  ON_CALL(server_, OnRequest("www.first.com", ns_t_a))
+    .WillByDefault(SetReply(&server_, &nofirst4));
+  
+  DNSPacket nosecond;
+  nosecond.set_response().set_aa().set_rcode(ns_r_nxdomain)
+    .add_question(new DNSQuestion("www.second.org", ns_t_aaaa));
+  ON_CALL(server_, OnRequest("www.second.org", ns_t_aaaa))
+    .WillByDefault(SetReply(&server_, &nosecond));
+  DNSPacket yessecond4;
+  yessecond4.set_response().set_aa()
+    .add_question(new DNSQuestion("www.second.org", ns_t_a))
+    .add_answer(new DNSARR("www.second.org", 0x0200, {2, 3, 4, 5}));
+  ON_CALL(server_, OnRequest("www.second.org", ns_t_a))
+    .WillByDefault(SetReply(&server_, &yessecond4));
+  
+  DNSPacket failthird;
+  failthird.set_response().set_aa().set_rcode(ns_r_servfail)
+    .add_question(new DNSQuestion("www.third.gov", ns_t_aaaa));
+  ON_CALL(server_, OnRequest("www.third.gov", ns_t_aaaa))
+    .WillByDefault(SetReply(&server_, &failthird));
+  DNSPacket failthird4;
+  failthird4.set_response().set_aa().set_rcode(ns_r_servfail)
+    .add_question(new DNSQuestion("www.third.gov", ns_t_a));
+  ON_CALL(server_, OnRequest("www.third.gov", ns_t_a))
+    .WillByDefault(SetReply(&server_, &failthird4));
+  
+  AIResult result;
+  struct ares_addrinfo hints = {};
+  hints.ai_family = AF_UNSPEC;
+  ares_getaddrinfo(channel_, "www", NULL, &hints, AICallback, &result);
+  Process();
+  EXPECT_TRUE(result.done);
+  EXPECT_EQ(result.status, ARES_SUCCESS);
+  EXPECT_THAT(result.airesult, IncludesNumAddresses(1));
+  EXPECT_THAT(result.airesult, IncludesV4Address("2.3.4.5"));
+  ares_freeaddrinfo(result.airesult);
+}
+
+INSTANTIATE_TEST_CASE_P(AddressFamiliesAI, MockChannelTestAI,
                         ::testing::Values(std::make_pair<int, bool>(AF_INET, 
false)));
 
+INSTANTIATE_TEST_CASE_P(AddressFamiliesAI, MockUDPChannelTestAI,
+                        ::testing::ValuesIn(ares::test::families));
 
 }  // namespace test
 }  // namespace ares
-- 
2.16.4

++++++ 0003-Bugfix-for-ares_getaddrinfo-and-additional-unit-test.patch ++++++
++++ 781 lines (skipped)

++++++ 0004-Add-ares__sortaddrinfo-to-support-getaddrinfo-sorted.patch ++++++
++++ 1472 lines (skipped)

++++++ 0005-getaddrinfo-avoid-infinite-loop-in-case-of-NXDOMAIN-.patch ++++++
>From 1dc228c872974d7eafc34b53816e973e00224351 Mon Sep 17 00:00:00 2001
From: kedixa <[email protected]>
Date: Tue, 9 Apr 2019 07:37:43 +0800
Subject: [PATCH 05/10] getaddrinfo: avoid infinite loop in case of
 NXDOMAIN(#240) (#242)

There are two possible causes for infinite loops fo NXDOMAIN, based on how many 
dots are in the domain name (one for < ARES_OPT_NDOTS and one for >= 
ARES_OPT_NDOTS), where it will repeat the same query over and over as the 
hquery->next_domain doesn't increment.

Fix By: @kedixa
---
 ares_getaddrinfo.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/ares_getaddrinfo.c b/ares_getaddrinfo.c
index ebaeda8..16c8b38 100644
--- a/ares_getaddrinfo.c
+++ b/ares_getaddrinfo.c
@@ -122,7 +122,7 @@ void ares_getaddrinfo(ares_channel channel,
   hquery->callback = callback;
   hquery->arg = arg;
   hquery->timeouts = 0;
-  hquery->next_domain = 0;
+  hquery->next_domain = -1; /* see next_dns_lookup for more info  */
   hquery->remaining = 0;
 
   /* Host file lookup */
@@ -279,11 +279,20 @@ static void next_dns_lookup(struct host_query *hquery) {
   char *s = NULL;
   int is_s_allocated = 0;
   int status;
-
-  if (( as_is_first(hquery) && hquery->next_domain == 0) ||
-      (!as_is_first(hquery) && hquery->next_domain ==
-       hquery->channel->ndomains)) {
-    s = hquery->name;
+  /* if next_domain == -1 and as_is_first is true, try hquery->name */
+  if(hquery->next_domain == -1) {
+    if(as_is_first(hquery)) {
+      s = hquery->name;
+    }
+    hquery->next_domain = 0;
+  }
+  /* if as_is_first is false, try hquery->name at last */
+  if(!s && hquery->next_domain == hquery->channel->ndomains) {
+    if(!as_is_first(hquery)) {
+      s = hquery->name;
+    }
+    /* avoid infinite loop */
+    hquery->next_domain++;
   }
 
   if (!s && hquery->next_domain < hquery->channel->ndomains) {
-- 
2.16.4

++++++ 0006-getaddrinfo-callback-must-be-called-on-bad-domain-24.patch ++++++
>From 36348062003d1ef1a36148dd6d6a225f0ad65f5f Mon Sep 17 00:00:00 2001
From: kedixa <[email protected]>
Date: Thu, 2 May 2019 21:08:41 +0800
Subject: [PATCH 06/10] getaddrinfo: callback must be called on bad domain
 (#249)

Due to an order of incrementing the remaining queries and calling ares_query, 
on a bad domain
the registered callback wouldn't be called.

Bug: #248
Fixed-By: @kedixa
---
 ares_getaddrinfo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ares_getaddrinfo.c b/ares_getaddrinfo.c
index 16c8b38..c9db8a2 100644
--- a/ares_getaddrinfo.c
+++ b/ares_getaddrinfo.c
@@ -307,12 +307,12 @@ static void next_dns_lookup(struct host_query *hquery) {
 
   if (s) {
     if (hquery->ai_family == AF_INET || hquery->ai_family == AF_UNSPEC) {
-      ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery);
       hquery->remaining++;
+      ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery);
     }
     if (hquery->ai_family == AF_INET6 || hquery->ai_family == AF_UNSPEC) {
-      ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery);
       hquery->remaining++;
+      ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery);
     }
     if (is_s_allocated) {
       ares_free(s);
-- 
2.16.4

++++++ 0007-getaddrinfo-enhancements-257.patch ++++++
++++ 3591 lines (skipped)

++++++ 0008-Add-missing-limits.h-include-from-ares_getaddrinfo.c.patch ++++++
>From e65da6067e5f3524c940671dcffc966cc69f451f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20No=C3=A9?= <[email protected]>
Date: Wed, 17 Jul 2019 09:29:11 -0400
Subject: [PATCH 08/10] Add missing limits.h include from ares_getaddrinfo.c
 (#267)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This files references INT_MAX, but does not include limits.h. This can
cause a build failure on some platforms. Include limits.h if we have it.

Fix-by: Dan Noé <[email protected]>
---
 ares_getaddrinfo.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ares_getaddrinfo.c b/ares_getaddrinfo.c
index 86c9e71..dba5a00 100644
--- a/ares_getaddrinfo.c
+++ b/ares_getaddrinfo.c
@@ -48,6 +48,10 @@
 #endif
 #include <assert.h>
 
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
 #include "ares.h"
 #include "bitncmp.h"
 #include "ares_private.h"
-- 
2.16.4

++++++ 0009-Increase-portability-of-ares-test-mock-ai.cc-235.patch ++++++
>From d50b452fcbf34bddac3e59dfd53ff7d93fad7794 Mon Sep 17 00:00:00 2001
From: Christian Ammer <[email protected]>
Date: Mon, 3 Dec 2018 01:08:49 +0100
Subject: [PATCH 09/10] Increase portability of `ares-test-mock-ai.cc` (#235)

* using portable ares_inet_pton and updated includes in ares-test-mock-ai
* forgot to remove deleted ares-test-ai.cc in Makefile.inc

Fix By: Christian Ammer (@ChristianAmmer)
---
 test/Makefile.inc         | 1 -
 test/ares-test-ai.cc      | 0
 test/ares-test-mock-ai.cc | 9 ++++-----
 3 files changed, 4 insertions(+), 6 deletions(-)
 delete mode 100644 test/ares-test-ai.cc

diff --git a/test/Makefile.inc b/test/Makefile.inc
index 7952b4c..3c68d7c 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -1,7 +1,6 @@
 TESTSOURCES = ares-test-main.cc        \
   ares-test-init.cc                    \
   ares-test.cc                         \
-  ares-test-ai.cc                      \
   ares-test-ns.cc                      \
   ares-test-parse.cc                   \
   ares-test-parse-a.cc                 \
diff --git a/test/ares-test-ai.cc b/test/ares-test-ai.cc
deleted file mode 100644
index e69de29..0000000
diff --git a/test/ares-test-mock-ai.cc b/test/ares-test-mock-ai.cc
index d22b9a3..d0df867 100644
--- a/test/ares-test-mock-ai.cc
+++ b/test/ares-test-mock-ai.cc
@@ -1,11 +1,10 @@
 #include "ares-test-ai.h"
 #include "dns-proto.h"
 
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
 #endif
 
-#include <arpa/inet.h>
 #include <sstream>
 #include <vector>
 
@@ -28,7 +27,7 @@ MATCHER_P(IncludesV4Address, address, "") {
   if(!arg)
     return false;
   in_addr addressnum = {};
-  if (!inet_pton(AF_INET, address, &addressnum))
+  if (!ares_inet_pton(AF_INET, address, &addressnum))
     return false; // wrong number format?
   for (const ares_addrinfo_node* ai = arg->nodes; ai != NULL; ai = 
ai->ai_next) {
     if (ai->ai_family != AF_INET)
@@ -44,7 +43,7 @@ MATCHER_P(IncludesV6Address, address, "") {
   if(!arg)
     return false;
   in6_addr addressnum = {};
-  if (!inet_pton(AF_INET6, address, &addressnum)) {
+  if (!ares_inet_pton(AF_INET6, address, &addressnum)) {
     return false; // wrong number format?
   }
   for (const ares_addrinfo_node* ai = arg->nodes; ai != NULL; ai = 
ai->ai_next) {
-- 
2.16.4

++++++ 0010-Disable-failing-test.patch ++++++
>From affbda0162129a44fb0a7547d981f874bc1ce280 Mon Sep 17 00:00:00 2001
From: Michal Rostecki <[email protected]>
Date: Wed, 23 Oct 2019 16:59:03 +0200
Subject: [PATCH 10/10] Disable failing test

FamilyV4ServiceName passes when you run it locally, but it cannot run on
OBS.
---
 test/ares-test-mock-ai.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/ares-test-mock-ai.cc b/test/ares-test-mock-ai.cc
index d0df867..d7cc87e 100644
--- a/test/ares-test-mock-ai.cc
+++ b/test/ares-test-mock-ai.cc
@@ -666,7 +666,7 @@ TEST_P(NoRotateMultiMockTestAI, ThirdServer) {
   CheckExample();
 }
 
-TEST_P(MockChannelTestAI, FamilyV4ServiceName) {
+/* TEST_P(MockChannelTestAI, FamilyV4ServiceName) {
   DNSPacket rsp4;
   rsp4.set_response().set_aa()
     .add_question(new DNSQuestion("example.com", ns_t_a))
@@ -684,7 +684,7 @@ TEST_P(MockChannelTestAI, FamilyV4ServiceName) {
   std::stringstream ss;
   ss << result.ai_;
   EXPECT_EQ("{addr=[1.1.1.1:80], addr=[2.2.2.2:80]}", ss.str());
-}
+} */
 
 // force-tcp does currently not work, possibly test DNS server swallows
 // bytes from second query
-- 
2.16.4



Reply via email to