|
|
c8cd03 |
From 062b04898be720ed0855efc192847fcbc667b3e1 Mon Sep 17 00:00:00 2001
|
|
|
c8cd03 |
From: Mark Andrews <marka@isc.org>
|
|
|
c8cd03 |
Date: Thu, 7 Jul 2016 12:52:47 +1000
|
|
|
c8cd03 |
Subject: [PATCH] 4406. [bug] getrrsetbyname with a non absolute
|
|
|
c8cd03 |
name could trigger a infinite recursion bug in lwresd
|
|
|
c8cd03 |
and named with lwres configured if when combined
|
|
|
c8cd03 |
with a search list entry the resulting name is
|
|
|
c8cd03 |
too long. [RT #42694]
|
|
|
c8cd03 |
|
|
|
c8cd03 |
(cherry picked from commit 38cc2d14e218e536e0102fa70deef99461354232)
|
|
|
c8cd03 |
---
|
|
|
c8cd03 |
bin/named/lwdgrbn.c | 16 ++++++++++------
|
|
|
c8cd03 |
bin/tests/system/lwresd/lwtest.c | 8 ++++++++
|
|
|
c8cd03 |
2 files changed, 18 insertions(+), 6 deletions(-)
|
|
|
c8cd03 |
|
|
|
c8cd03 |
diff --git a/bin/named/lwdgrbn.c b/bin/named/lwdgrbn.c
|
|
|
c8cd03 |
index 584ab25..37211eb 100644
|
|
|
c8cd03 |
--- a/bin/named/lwdgrbn.c
|
|
|
c8cd03 |
+++ b/bin/named/lwdgrbn.c
|
|
|
c8cd03 |
@@ -403,14 +403,18 @@ start_lookup(ns_lwdclient_t *client) {
|
|
|
c8cd03 |
INSIST(client->lookup == NULL);
|
|
|
c8cd03 |
|
|
|
c8cd03 |
dns_fixedname_init(&absname);
|
|
|
c8cd03 |
- result = ns_lwsearchctx_current(&client->searchctx,
|
|
|
c8cd03 |
- dns_fixedname_name(&absname));
|
|
|
c8cd03 |
+
|
|
|
c8cd03 |
/*
|
|
|
c8cd03 |
- * This will return failure if relative name + suffix is too long.
|
|
|
c8cd03 |
- * In this case, just go on to the next entry in the search path.
|
|
|
c8cd03 |
+ * Perform search across all search domains until success
|
|
|
c8cd03 |
+ * is returned. Return in case of failure.
|
|
|
c8cd03 |
*/
|
|
|
c8cd03 |
- if (result != ISC_R_SUCCESS)
|
|
|
c8cd03 |
- start_lookup(client);
|
|
|
c8cd03 |
+ while (ns_lwsearchctx_current(&client->searchctx,
|
|
|
c8cd03 |
+ dns_fixedname_name(&absname)) != ISC_R_SUCCESS) {
|
|
|
c8cd03 |
+ if (ns_lwsearchctx_next(&client->searchctx) != ISC_R_SUCCESS) {
|
|
|
c8cd03 |
+ ns_lwdclient_errorpktsend(client, LWRES_R_FAILURE);
|
|
|
c8cd03 |
+ return;
|
|
|
c8cd03 |
+ }
|
|
|
c8cd03 |
+ }
|
|
|
c8cd03 |
|
|
|
c8cd03 |
result = dns_lookup_create(cm->mctx,
|
|
|
c8cd03 |
dns_fixedname_name(&absname),
|
|
|
c8cd03 |
diff --git a/bin/tests/system/lwresd/lwtest.c b/bin/tests/system/lwresd/lwtest.c
|
|
|
c8cd03 |
index 02647cb..c2be95d 100644
|
|
|
c8cd03 |
--- a/bin/tests/system/lwresd/lwtest.c
|
|
|
c8cd03 |
+++ b/bin/tests/system/lwresd/lwtest.c
|
|
|
c8cd03 |
@@ -768,6 +768,14 @@ main(void) {
|
|
|
c8cd03 |
test_getrrsetbyname("e.example1.", 1, 46, 2, 0, 1);
|
|
|
c8cd03 |
test_getrrsetbyname("", 1, 1, 0, 0, 0);
|
|
|
c8cd03 |
|
|
|
c8cd03 |
+ test_getrrsetbyname("123456789.123456789.123456789.123456789."
|
|
|
c8cd03 |
+ "123456789.123456789.123456789.123456789."
|
|
|
c8cd03 |
+ "123456789.123456789.123456789.123456789."
|
|
|
c8cd03 |
+ "123456789.123456789.123456789.123456789."
|
|
|
c8cd03 |
+ "123456789.123456789.123456789.123456789."
|
|
|
c8cd03 |
+ "123456789.123456789.123456789.123456789."
|
|
|
c8cd03 |
+ "123456789", 1, 1, 0, 0, 0);
|
|
|
c8cd03 |
+
|
|
|
c8cd03 |
if (fails == 0)
|
|
|
c8cd03 |
printf("I:ok\n");
|
|
|
c8cd03 |
return (fails);
|
|
|
c8cd03 |
--
|
|
|
c8cd03 |
2.7.4
|
|
|
c8cd03 |
|