diff options
author | Stefan Metzmacher <metze@samba.org> | 2015-05-29 16:14:40 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2015-06-12 17:08:18 +0200 |
commit | 006042ac126261e87089fb9835c28789e8aeae1b (patch) | |
tree | c5245e028f673e2ef9791fdf311f44091583a64e /libcli/smb | |
parent | f3982eb2c7f1d17a013dacfd430a3752e6ef4ae4 (diff) | |
download | samba-006042ac126261e87089fb9835c28789e8aeae1b.tar.gz |
libcli/smb: make sure we remove the writev_send() request when a request is destroyed
This way smbXcli_conn_disconnect() removes all tevent_fd structures attached to
the sock_fd before closing it.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11316
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'libcli/smb')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 04f8c96656d..c8ae5b06a90 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -222,6 +222,8 @@ struct smbXcli_req_state { uint8_t *inbuf; + struct tevent_req *write_req; + struct { /* Space for the header including the wct */ uint8_t hdr[HDR_VWV]; @@ -838,6 +840,8 @@ void smbXcli_req_unset_pending(struct tevent_req *req) size_t num_pending = talloc_array_length(conn->pending); size_t i; + TALLOC_FREE(state->write_req); + if (state->smb1.mid != 0) { /* * This is a [nt]trans[2] request which waits @@ -896,6 +900,8 @@ static void smbXcli_req_cleanup(struct tevent_req *req, tevent_req_data(req, struct smbXcli_req_state); + TALLOC_FREE(state->write_req); + switch (req_state) { case TEVENT_REQ_RECEIVED: /* @@ -1614,6 +1620,8 @@ static NTSTATUS smb1cli_req_writev_submit(struct tevent_req *req, return NT_STATUS_NO_MEMORY; } tevent_req_set_callback(subreq, smb1cli_req_writev_done, req); + state->write_req = subreq; + return NT_STATUS_OK; } @@ -1670,6 +1678,8 @@ static void smb1cli_req_writev_done(struct tevent_req *subreq) ssize_t nwritten; int err; + state->write_req = NULL; + nwritten = writev_recv(subreq, &err); TALLOC_FREE(subreq); if (nwritten == -1) { @@ -3204,6 +3214,8 @@ skip_credits: return NT_STATUS_NO_MEMORY; } tevent_req_set_callback(subreq, smb2cli_req_writev_done, reqs[0]); + state->write_req = subreq; + return NT_STATUS_OK; } @@ -3265,6 +3277,8 @@ static void smb2cli_req_writev_done(struct tevent_req *subreq) ssize_t nwritten; int err; + state->write_req = NULL; + nwritten = writev_recv(subreq, &err); TALLOC_FREE(subreq); if (nwritten == -1) { |