1 |
commit ccff9ed69d0b26d33ce9cac8e83dab535b64d627
|
2 |
Author: Thomas Markwalder <tmark@isc.org>
|
3 |
Date: Tue Dec 5 15:12:34 2017 -0500
|
4 |
|
5 |
[46767] Plugged a socket descriptor leak in OMAPI
|
6 |
|
7 |
If disconnect is triggered by the reader closing the socket, while there
|
8 |
is data left to write, the socket would be orphaned.
|
9 |
|
10 |
omapip/buffer.c
|
11 |
omapi_connection_writea() - added logic to recall disconnect once
|
12 |
pending data has been written
|
13 |
|
14 |
omapip/message.c
|
15 |
Removed static declaration from omapi_message_unregister so you can
|
16 |
actually compile when DEBUG_PROTOCOL is defined.
|
17 |
|
18 |
Added a release note
|
19 |
|
20 |
diff --git a/omapip/buffer.c b/omapip/buffer.c
|
21 |
index 6e0621b..a21f0a8 100644
|
22 |
--- a/omapip/buffer.c
|
23 |
+++ b/omapip/buffer.c
|
24 |
@@ -565,6 +565,15 @@ isc_result_t omapi_connection_writer (omapi_object_t *h)
|
25 |
omapi_buffer_dereference (&buffer, MDL);
|
26 |
}
|
27 |
}
|
28 |
+
|
29 |
+ /* If we had data left to write when we're told to disconnect,
|
30 |
+ * we need recall disconnect, now that we're done writing.
|
31 |
+ * See rt46767. */
|
32 |
+ if (c->out_bytes == 0 && c->state == omapi_connection_disconnecting) {
|
33 |
+ omapi_disconnect (h, 1);
|
34 |
+ return ISC_R_SHUTTINGDOWN;
|
35 |
+ }
|
36 |
+
|
37 |
return ISC_R_SUCCESS;
|
38 |
}
|
39 |
|
40 |
diff --git a/omapip/message.c b/omapip/message.c
|
41 |
index ee15d82..37abbd2 100644
|
42 |
--- a/omapip/message.c
|
43 |
+++ b/omapip/message.c
|
44 |
@@ -339,7 +339,7 @@ isc_result_t omapi_message_unregister (omapi_object_t *mo)
|
45 |
}
|
46 |
|
47 |
#ifdef DEBUG_PROTOCOL
|
48 |
-static const char *omapi_message_op_name(int op) {
|
49 |
+const char *omapi_message_op_name(int op) {
|
50 |
switch (op) {
|
51 |
case OMAPI_OP_OPEN: return "OMAPI_OP_OPEN";
|
52 |
case OMAPI_OP_REFRESH: return "OMAPI_OP_REFRESH";
|