summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-11-28 17:48:44 +0100
committerStefan Metzmacher <metze@samba.org>2011-11-29 16:00:07 +0100
commitf0d8038ed8030655223fc03251dbd2245b7ec402 (patch)
treec28f0056ccb2087bb438a59b1205942058a6f126
parent8c7e7ee91beda577ec6a9acf36a856a3dadb30c6 (diff)
downloadsamba-f0d8038ed8030655223fc03251dbd2245b7ec402.tar.gz
samba-f0d8038ed8030655223fc03251dbd2245b7ec402.tar.bz2
samba-f0d8038ed8030655223fc03251dbd2245b7ec402.zip
smbXcli: rebuild smb1.recv_iov array if we expect more than one response
metze
-rw-r--r--libcli/smb/smbXcli_base.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index b8be9c143f..e49a989095 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -1677,6 +1677,20 @@ static NTSTATUS smb1cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
smbXcli_req_unset_pending(req);
+ if (state->smb1.recv_iov == NULL) {
+ /*
+ * For requests with more than
+ * one response, we have to readd the
+ * recv_iov array.
+ */
+ state->smb1.recv_iov = talloc_zero_array(state,
+ struct iovec,
+ 3);
+ if (tevent_req_nomem(state->smb1.recv_iov, req)) {
+ return NT_STATUS_OK;
+ }
+ }
+
state->smb1.recv_cmd = cmd;
state->smb1.recv_status = status;
state->inbuf = talloc_move(state->smb1.recv_iov, &inbuf);
@@ -1725,6 +1739,20 @@ static NTSTATUS smb1cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
continue;
}
+ if (state->smb1.recv_iov == NULL) {
+ /*
+ * For requests with more than
+ * one response, we have to readd the
+ * recv_iov array.
+ */
+ state->smb1.recv_iov = talloc_zero_array(state,
+ struct iovec,
+ 3);
+ if (tevent_req_nomem(state->smb1.recv_iov, req)) {
+ continue;
+ }
+ }
+
state->smb1.recv_cmd = cmd;
if (i == (num_responses - 1)) {
@@ -1819,6 +1847,7 @@ NTSTATUS smb1cli_req_recv(struct tevent_req *req,
if (state->inbuf != NULL) {
recv_iov = state->smb1.recv_iov;
+ state->smb1.recv_iov = NULL;
hdr = (uint8_t *)recv_iov[0].iov_base;
wct = recv_iov[1].iov_len/2;
vwv = (uint16_t *)recv_iov[1].iov_base;