From 3d57010659ef8af2f87512631d04dee35a603e25 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 17 Feb 2013 22:39:40 +0100 Subject: [PATCH] TODO s4:libcli/raw: don't schedule idle handlers on a dead connection --- source4/libcli/raw/clitransport.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index d0dd1f9dee6a..f07b092eb8d4 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -137,6 +137,14 @@ static void idle_handler(struct tevent_context *ev, transport->idle.func(transport, transport->idle.private_data); + if (transport->idle.func == NULL) { + return; + } + + if (!smbXcli_conn_is_connected(transport->conn)) { + return; + } + next = timeval_current_ofs_usec(transport->idle.period); transport->idle.te = tevent_add_timer(transport->ev, @@ -156,6 +164,15 @@ _PUBLIC_ void smbcli_transport_idle_handler(struct smbcli_transport *transport, void *private_data) { TALLOC_FREE(transport->idle.te); + ZERO_STRUCT(transport->idle); + + if (idle_func == NULL) { + return; + } + + if (!smbXcli_conn_is_connected(transport->conn)) { + return; + } transport->idle.func = idle_func; transport->idle.private_data = private_data; -- 2.34.1