rwrap: fix resolv wrapper with ipv6 addresses and old glibc versions
authorStefan Metzmacher <metze@samba.org>
Thu, 14 Feb 2019 14:46:22 +0000 (15:46 +0100)
committerAndreas Schneider <asn@samba.org>
Fri, 20 Mar 2020 12:20:57 +0000 (13:20 +0100)
commit2cc59200e35fe6251871d60a53f8a0886ec82fb5
treea4d7da7d190b7e276f36f5574fb76cd09c403333
parent396e83a1537a6f5df1cbe8aa152180c36cd18764
rwrap: fix resolv wrapper with ipv6 addresses and old glibc versions

The handling of __res_state._u._ext was different before
this glibc commit (e.g. glibc-2.19):

  commit 2212c1420c92a33b0e0bd9a34938c9814a56c0f7
  Author:     Andreas Schwab <schwab@suse.de>
  AuthorDate: Thu Feb 19 15:52:08 2015 +0100
  Commit:     Andreas Schwab <schwab@suse.de>
  CommitDate: Thu May 21 15:16:37 2015 +0200

      Simplify handling of nameserver configuration in resolver

      Remove use of ext.nsmap member of struct __res_state and always use
      an identity mapping betwen the nsaddr_list array and the ext.nsaddrs
      array.  The fact that a nameserver has an IPv6 address is signalled by
      setting nsaddr_list[].sin_family to zero.

As a result of fixing this, it's now possible to run 'test_res_init'
even without using resolv_wrapper.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
src/resolv_wrapper.c
tests/test_res_init.c