]> 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:19 +0000 (03:03 +0000)
committerMark Andrews <marka@isc.org>
Fri, 4 Aug 2006 03:03:19 +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 3983b8017c11d3eca50ef94d42ec2cb095cda56f..7e193d427431a459d149ae72bee6817d6e6dce98 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
 
        --- 9.2.7rc1 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 e9c6f077054c9f471e602513a692fa1131f4db96..0e80ac2e3a52a6d56b3e21a69049866b721f8d9d 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rndc.c,v 1.77.2.8 2006/03/02 00:37:17 marka Exp $ */
+/* $Id: rndc.c,v 1.77.2.9 2006/08/04 03:03:19 marka Exp $ */
 
 /*
  * Principal Author: DCL
@@ -203,6 +203,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
@@ -253,9 +258,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);
-       isc_app_shutdown();
+       if (sends == 0 && recvs == 0) {
+               isc_socket_detach(&sock);
+               isc_task_shutdown(task);
+               RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS);
+       }
 }
 
 static void
index 00258b36c5484c3549611b9505538bfd10f76918..b6fae8b358f567e0d8e1134eccee03a888b2b2f1 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: socket.c,v 1.5.2.29 2006/01/07 00:23:32 marka Exp $ */
+/* $Id: socket.c,v 1.5.2.30 2006/08/04 03:03:19 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) {