]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2067. [bug] 'rndc' could close the socket too early triggering
authorMark Andrews <marka@isc.org>
Fri, 4 Aug 2006 03:03:08 +0000 (03:03 +0000)
committerMark Andrews <marka@isc.org>
Fri, 4 Aug 2006 03:03:08 +0000 (03:03 +0000)
                        a INSIST under Windows. [RT #16317]

CHANGES
bin/rndc/rndc.c
lib/isc/win32/socket.c

diff --git a/CHANGES b/CHANGES
index 4355eb0d7c16cf1ba9ce06903bfd4d77afe3af75..a51d2899f471ed1dfe56a621bfe84ed7c4e5e6d8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
 
        --- 9.3.3rc1 released ---
 
+2067.  [bug]           'rndc' could close the socket too early triggering
+                       a INSIST under Windows. [RT #16317]
+
 2065.  [bug]           libbind: probe for HPUX prototypes for
                        endprotoent_r() and endservent_r().  [RT 16313]
 
index 011ecf11dfeef677fb6c0b2603bfd5b5d2350350..a5e912ddfd42ed65df7906e18e2445e719e63110 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rndc.c,v 1.77.2.5.2.18 2006/07/20 03:48:05 marka Exp $ */
+/* $Id: rndc.c,v 1.77.2.5.2.19 2006/08/04 03:03:08 marka Exp $ */
 
 /*
  * Principal Author: DCL
@@ -154,6 +154,11 @@ rndc_senddone(isc_task_t *task, isc_event_t *event) {
        if (sevent->result != ISC_R_SUCCESS)
                fatal("send failed: %s", isc_result_totext(sevent->result));
        isc_event_free(&event);
+       if (sends == 0 && recvs == 0) {
+               isc_socket_detach(&sock);
+               isc_task_shutdown(task);
+               RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS);
+       }
 }
 
 static void
@@ -204,9 +209,11 @@ rndc_recvdone(isc_task_t *task, isc_event_t *event) {
 
        isc_event_free(&event);
        isccc_sexpr_free(&response);
-       isc_socket_detach(&sock);
-       isc_task_shutdown(task);
-       RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS);
+       if (sends == 0 && recvs == 0) {
+               isc_socket_detach(&sock);
+               isc_task_shutdown(task);
+               RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS);
+       }
 }
 
 static void
index 17368f877f57e51879282c944e323fba2c349d81..aa053910836f98a80e9ac83eb18f9b21043e581e 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: socket.c,v 1.5.2.13.2.18 2006/01/07 00:23:33 marka Exp $ */
+/* $Id: socket.c,v 1.5.2.13.2.19 2006/08/04 03:03:08 marka Exp $ */
 
 /* This code has been rewritten to take advantage of Windows Sockets
  * I/O Completion Ports and Events. I/O Completion Ports is ONLY
@@ -1695,14 +1695,15 @@ destroy_socket(isc_socket_t **sockp) {
        socket_log(sock, NULL, CREATION, isc_msgcat, ISC_MSGSET_SOCKET,
                   ISC_MSG_DESTROYING, "destroying socket %d", sock->fd);
 
+       LOCK(&manager->lock);
+
+       LOCK(&sock->lock);
+
        INSIST(ISC_LIST_EMPTY(sock->accept_list));
        INSIST(ISC_LIST_EMPTY(sock->recv_list));
        INSIST(ISC_LIST_EMPTY(sock->send_list));
        INSIST(sock->connect_ev == NULL);
 
-       LOCK(&manager->lock);
-
-       LOCK(&sock->lock);
        socket_close(sock);
        if (sock->pending_recv != 0 || sock->pending_send != 0 ||
            sock->pending_close != 0) {