]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4406. [bug] getrrsetbyname with a non absolute name could
authorMark Andrews <marka@isc.org>
Thu, 7 Jul 2016 02:52:47 +0000 (12:52 +1000)
committerMark Andrews <marka@isc.org>
Thu, 7 Jul 2016 02:54:37 +0000 (12:54 +1000)
                        trigger a infinite recursion bug in lwresd
                        and named with lwres configured if when combined
                        with a search list entry the resulting name is
                        too long. [RT #42694]

(cherry picked from commit 38cc2d14e218e536e0102fa70deef99461354232)

CHANGES
bin/named/lwdgrbn.c
bin/tests/system/lwresd/lwtest.c

diff --git a/CHANGES b/CHANGES
index 6216c57a82596238346dbed0a8ee96f08b31dacf..84cbe0a2e5b2c147b63e4c1a960989f4611aadee 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+4406.  [bug]           getrrsetbyname with a non absolute name could
+                       trigger a infinite recursion bug in lwresd
+                       and named with lwres configured if when combined
+                       with a search list entry the resulting name is
+                       too long. [RT #42694]
+
 4405.  [bug]           Change 4342 introduced a regression where you could
                        not remove a delegation in a NSEC3 signed zone using
                        OPTOUT via nsupdate. [RT #42702]
index 584ab25b10e273a288cbfface34df67f741cbc0d..37211eb55e40192eaa4e5da2e92a958e8ae3a9d9 100644 (file)
@@ -403,14 +403,18 @@ start_lookup(ns_lwdclient_t *client) {
        INSIST(client->lookup == NULL);
 
        dns_fixedname_init(&absname);
-       result = ns_lwsearchctx_current(&client->searchctx,
-                                       dns_fixedname_name(&absname));
+
        /*
-        * This will return failure if relative name + suffix is too long.
-        * In this case, just go on to the next entry in the search path.
+        * Perform search across all search domains until success
+        * is returned. Return in case of failure.
         */
-       if (result != ISC_R_SUCCESS)
-               start_lookup(client);
+       while (ns_lwsearchctx_current(&client->searchctx,
+                       dns_fixedname_name(&absname)) != ISC_R_SUCCESS) {
+               if (ns_lwsearchctx_next(&client->searchctx) != ISC_R_SUCCESS) {
+                       ns_lwdclient_errorpktsend(client, LWRES_R_FAILURE);
+                       return;
+               }
+       }
 
        result = dns_lookup_create(cm->mctx,
                                   dns_fixedname_name(&absname),
index 02647cb0d2b0fb555b2b7f6404e85d90785657b7..c2be95de7f9257f682d75d9ed51446c52c1cd8a9 100644 (file)
@@ -768,6 +768,14 @@ main(void) {
        test_getrrsetbyname("e.example1.", 1, 46, 2, 0, 1);
        test_getrrsetbyname("", 1, 1, 0, 0, 0);
 
+       test_getrrsetbyname("123456789.123456789.123456789.123456789."
+                           "123456789.123456789.123456789.123456789."
+                           "123456789.123456789.123456789.123456789."
+                           "123456789.123456789.123456789.123456789."
+                           "123456789.123456789.123456789.123456789."
+                           "123456789.123456789.123456789.123456789."
+                           "123456789", 1, 1, 0, 0, 0);
+
        if (fails == 0)
                printf("I:ok\n");
        return (fails);