summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-08-28 10:20:36 +0200
committerMichael Adam <obnox@samba.org>2014-09-19 09:15:10 +0200
commitdfcc683e38e18da0ce7140d729cf7eb285347681 (patch)
tree550c1c1489d36129f8f022b879b6862087606c1e /libcli
parent4b6febc670812d688ce6b6edd3fa24e671959b5c (diff)
downloadsamba-dfcc683e38e18da0ce7140d729cf7eb285347681.tar.gz
libcli/smb: correctly report disconnect errors after getting STATUS_PENDING
smb2cli_req_recv() should not report STATUS_PENDING if the request isn't pending anymore (e.g. the connection was disconnected) Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/smb/smbXcli_base.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 43dd9941053..cccb61b507b 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -3349,8 +3349,6 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
}
state = tevent_req_data(req, struct smbXcli_req_state);
- state->smb2.got_async = false;
-
req_opcode = SVAL(state->smb2.hdr, SMB2_HDR_OPCODE);
if (opcode != req_opcode) {
return NT_STATUS_INVALID_NETWORK_RESPONSE;
@@ -3366,6 +3364,12 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
NT_STATUS_EQUAL(status, STATUS_PENDING)) {
uint64_t async_id = BVAL(inhdr, SMB2_HDR_ASYNC_ID);
+ if (state->smb2.got_async) {
+ /* We only expect one STATUS_PENDING response */
+ return NT_STATUS_INVALID_NETWORK_RESPONSE;
+ }
+ state->smb2.got_async = true;
+
/*
* async interim responses are not signed,
* even if the SMB2_HDR_FLAG_SIGNED flag
@@ -3376,7 +3380,6 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
SBVAL(state->smb2.hdr, SMB2_HDR_ASYNC_ID, async_id);
if (state->smb2.notify_async) {
- state->smb2.got_async = true;
tevent_req_defer_callback(req, state->ev);
tevent_req_notify_callback(req);
}
@@ -3621,7 +3624,7 @@ NTSTATUS smb2cli_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
*piov = NULL;
}
- if (state->smb2.got_async) {
+ if (tevent_req_is_in_progress(req) && state->smb2.got_async) {
return STATUS_PENDING;
}