summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-17 22:41:00 +0100
committerJeremy Allison <jra@samba.org>2019-03-28 23:09:33 +0000
commit8dea0718f20f41031bc09851f07b09dcacf437c3 (patch)
tree29735dc31d84f81183de2175668a42537d38b99a /source4/libcli
parentc2761b00570b0b1753dd226859a8534db1221c7c (diff)
downloadsamba-8dea0718f20f41031bc09851f07b09dcacf437c3.tar.gz
samba-8dea0718f20f41031bc09851f07b09dcacf437c3.tar.bz2
samba-8dea0718f20f41031bc09851f07b09dcacf437c3.zip
s4:libcli/smb2: don't schedule idle handlers on a dead connection
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/smb2/transport.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c
index 18cc490be48..5b5bb79150d 100644
--- a/source4/libcli/smb2/transport.c
+++ b/source4/libcli/smb2/transport.c
@@ -508,6 +508,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,
transport,
@@ -526,6 +534,15 @@ void smb2_transport_idle_handler(struct smb2_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;