]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2036. [bug] 'rndc recursing' could cause trigger a REQUIRE.
authorMark Andrews <marka@isc.org>
Mon, 5 Jun 2006 00:15:18 +0000 (00:15 +0000)
committerMark Andrews <marka@isc.org>
Mon, 5 Jun 2006 00:15:18 +0000 (00:15 +0000)
                        [RT #16075]

CHANGES
bin/named/client.c
bin/named/include/named/client.h
bin/named/query.c

diff --git a/CHANGES b/CHANGES
index d109d535782ecc0146c9f3c037c63505c0f08e76..b4b4f498fa4f695557f88902dc1d56a796810249 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
-2034.  [bug]           gcc: set -fno-strict-aliasing. [RT #16124]
+2036.  [bug]           'rndc recursing' could cause trigger a REQUIRE.
+                       [RT #16075]
 
+2034.  [bug]           gcc: set -fno-strict-aliasing. [RT #16124]
 
        --- 9.3.3b1 released ---
 
index 7eca8a5891e9d775ef56e92954c5d9c7268f2ebf..12dc6272d923d0d1c86012e2fb3184bd929a89e3 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: client.c,v 1.176.2.13.4.28 2006/01/04 23:50:19 marka Exp $ */
+/* $Id: client.c,v 1.176.2.13.4.29 2006/06/05 00:15:17 marka Exp $ */
 
 #include <config.h>
 
@@ -291,8 +291,17 @@ exit_check(ns_client_t *client) {
                }
                /*
                 * I/O cancel is complete.  Burn down all state
-                * related to the current request.
+                * related to the current request.  Ensure that
+                * the client is on the active list and not the
+                * recursing list.
                 */
+               LOCK(&client->manager->lock);
+               if (client->list == &client->manager->recursing) {
+                       ISC_LIST_UNLINK(*client->list, client, link);
+                       ISC_LIST_APPEND(client->manager->active, client, link);
+                       client->list = &client->manager->active;
+               }
+               UNLOCK(&client->manager->lock);
                ns_client_endrequest(client);
 
                client->state = NS_CLIENTSTATE_READING;
@@ -2431,3 +2440,20 @@ ns_client_dumprecursing(FILE *f, ns_clientmgr_t *manager) {
        }
        UNLOCK(&manager->lock);
 }
+
+void
+ns_client_qnamereplace(ns_client_t *client, dns_name_t *name) {
+
+       if (client->manager != NULL)
+               LOCK(&client->manager->lock);
+       if (client->query.restarts > 0) {
+               /*
+                * client->query.qname was dynamically allocated.
+                */
+               dns_message_puttempname(client->message,
+                                       &client->query.qname);
+       }
+       client->query.qname = name;
+       if (client->manager != NULL)
+               UNLOCK(&client->manager->lock);
+}
index 7097a3bb05b500dbe68ea4507a9051c9cca077e2..98ba32892dc2825e06163b2bf622da2d2b3aa35b 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: client.h,v 1.60.2.2.10.10 2005/07/29 00:13:08 marka Exp $ */
+/* $Id: client.h,v 1.60.2.2.10.11 2006/06/05 00:15:18 marka Exp $ */
 
 #ifndef NAMED_CLIENT_H
 #define NAMED_CLIENT_H 1
@@ -198,6 +198,12 @@ ns_client_next(ns_client_t *client, isc_result_t result);
  * return no response to the client.
  */
 
+void
+ns_client_qnamereplace(ns_client_t *client, dns_name_t *name);
+/*%
+ * Replace the qname.
+ */
+
 isc_boolean_t
 ns_client_shuttingdown(ns_client_t *client);
 /*
index 4fe866cf0b73ed9b5c6930271d76bfe3c6e08e1b..b69d66e594d711e872aac6cf17e81f1571c5c15e 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: query.c,v 1.198.2.13.4.41 2006/05/18 03:15:46 marka Exp $ */
+/* $Id: query.c,v 1.198.2.13.4.42 2006/06/05 00:15:17 marka Exp $ */
 
 #include <config.h>
 
@@ -148,18 +148,6 @@ query_next(ns_client_t *client, isc_result_t result) {
        ns_client_next(client, result);
 }
 
-static inline void
-query_maybeputqname(ns_client_t *client) {
-       if (client->query.restarts > 0) {
-               /*
-                * client->query.qname was dynamically allocated.
-                */
-               dns_message_puttempname(client->message,
-                                       &client->query.qname);
-               client->query.qname = NULL;
-       }
-}
-
 static inline void
 query_freefreeversions(ns_client_t *client, isc_boolean_t everything) {
        ns_dbversion_t *dbversion, *dbversion_next;
@@ -240,8 +228,14 @@ query_reset(ns_client_t *client, isc_boolean_t everything) {
                }
        }
 
-       query_maybeputqname(client);
-
+       if (client->query.restarts > 0) {
+               /*
+                * client->query.qname was dynamically allocated.
+                */
+               dns_message_puttempname(client->message,
+                                       &client->query.qname);
+       }
+       client->query.qname = NULL;
        client->query.attributes = (NS_QUERYATTR_RECURSIONOK |
                                    NS_QUERYATTR_CACHEOK |
                                    NS_QUERYATTR_SECURE);
@@ -3010,8 +3004,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
                        goto cleanup;
                }
                dns_rdata_freestruct(&cname);
-               query_maybeputqname(client);
-               client->query.qname = tname;
+               ns_client_qnamereplace(client, tname);
                want_restart = ISC_TRUE;
                if (!WANTRECURSION(client))
                        options |= DNS_GETDB_NOLOG;
@@ -3128,8 +3121,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
                /*
                 * Switch to the new qname and restart.
                 */
-               query_maybeputqname(client);
-               client->query.qname = fname;
+               ns_client_qnamereplace(client, fname);
                fname = NULL;
                want_restart = ISC_TRUE;
                if (!WANTRECURSION(client))