]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nss_dns: Do not replace root domain with empty string
authorFlorian Weimer <fweimer@redhat.com>
Thu, 11 Apr 2019 09:37:47 +0000 (11:37 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 11 Apr 2019 09:37:47 +0000 (11:37 +0200)
The purpose of the bp[0] == '.' check is unclear.  Only the root domain
starts with '.'.  The empty string is accepted as a domain name in many
places, denoting the root, but using it implicitly is confusing.

ChangeLog
resolv/nss_dns/dns-host.c
resolv/nss_dns/dns-network.c

index 1d0ba7165c9427bf07a323e4bf40d3e3292d2caf..1cb1255ab94a1d703271cb512d4cac4471b30bdb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-04-11  Florian Weimer  <fweimer@redhat.com>
+
+       * resolv/nss_dns/dns-network.c (getanswer_r): Do not replace root
+       domain with empty string.
+       * resolv/nss_dns/dns-host.c (getanswer_r): Likewise.
+
 2019-04-11  Florian Weimer  <fweimer@redhat.com>
 
        * include/alloc_buffer.h (alloc_buffer_alloc_bytes): Update
index a18b8a6bf4a32ff38fed152df20ec54cd6b55251..9c15f25f283ffd881dc209993c40085f7ec31cbb 100644 (file)
@@ -706,9 +706,6 @@ getanswer_r (struct resolv_context *ctx,
       n = -1;
     }
 
-  if (n > 0 && bp[0] == '.')
-    bp[0] = '\0';
-
   if (__glibc_unlikely (n < 0))
     {
       *errnop = errno;
index 4b81b1bfdc120ed2590f6dfd18dd1b5f63d10003..21688c19b2f06ee08bbc689345984d392166a216 100644 (file)
@@ -345,9 +345,6 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
          n = -1;
        }
 
-      if (n > 0 && bp[0] == '.')
-       bp[0] = '\0';
-
       if (n < 0 || res_dnok (bp) == 0)
        break;
       cp += n;