summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2015-05-29 15:48:26 +0200
committerStefan Metzmacher <metze@samba.org>2015-06-12 17:08:18 +0200
commitf3982eb2c7f1d17a013dacfd430a3752e6ef4ae4 (patch)
treecb10ed5f46ad00de841678ea0ff407770e125cfd /libcli
parent59338434274799db1ac60b082a6453bd924c5f4c (diff)
downloadsamba-f3982eb2c7f1d17a013dacfd430a3752e6ef4ae4.tar.gz
libcli/smb: add smb1 requests to the pending array before writev_send()
This way we have a change to destroy the pending writev_send request before closing the socket in smbXcli_conn_disconnect(). 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')
-rw-r--r--libcli/smb/smbXcli_base.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 43642e799c4..04f8c96656d 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -666,14 +666,9 @@ uint32_t smb1cli_conn_max_xmit(struct smbXcli_conn *conn)
bool smb1cli_conn_req_possible(struct smbXcli_conn *conn)
{
- size_t pending;
+ size_t pending = talloc_array_length(conn->pending);
uint16_t possible = conn->smb1.server.max_mux;
- pending = tevent_queue_length(conn->outgoing);
- if (pending >= possible) {
- return false;
- }
- pending += talloc_array_length(conn->pending);
if (pending >= possible) {
return false;
}
@@ -1607,6 +1602,10 @@ static NTSTATUS smb1cli_req_writev_submit(struct tevent_req *req,
state->conn->dispatch_incoming = smb1cli_conn_dispatch_incoming;
}
+ if (!smbXcli_req_set_pending(req)) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
tevent_req_set_cancel_fn(req, smbXcli_req_cancel);
subreq = writev_send(state, state->ev, state->conn->outgoing,
@@ -1674,9 +1673,9 @@ static void smb1cli_req_writev_done(struct tevent_req *subreq)
nwritten = writev_recv(subreq, &err);
TALLOC_FREE(subreq);
if (nwritten == -1) {
+ /* here, we need to notify all pending requests */
NTSTATUS status = map_nt_error_from_unix_common(err);
smbXcli_conn_disconnect(state->conn, status);
- tevent_req_nterror(req, status);
return;
}
@@ -1685,11 +1684,6 @@ static void smb1cli_req_writev_done(struct tevent_req *subreq)
tevent_req_done(req);
return;
}
-
- if (!smbXcli_req_set_pending(req)) {
- tevent_req_nterror(req, NT_STATUS_NO_MEMORY);
- return;
- }
}
static void smbXcli_conn_received(struct tevent_req *subreq)