summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-07-20 09:19:24 +0200
committerStefan Metzmacher <metze@samba.org>2012-07-23 18:19:36 +0200
commit1c144b07f658723a9ae28c61b2e66c33630b573a (patch)
treefaed1fb1d8c192b7deb3dddf2ffb99c73343ed38 /libcli
parentfd736f7f18294aa1589aacd495b2a48bbaf8715c (diff)
downloadsamba-1c144b07f658723a9ae28c61b2e66c33630b573a.tar.gz
samba-1c144b07f658723a9ae28c61b2e66c33630b573a.tar.bz2
samba-1c144b07f658723a9ae28c61b2e66c33630b573a.zip
libcli/smb: only pass the smb2 buffer to smb2cli_inbuf_parse_compound()
We should hide the transport as much as possible. metze
Diffstat (limited to 'libcli')
-rw-r--r--libcli/smb/smbXcli_base.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 9aab0ab563..dcec6ed79e 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -2723,26 +2723,22 @@ static void smb2cli_req_writev_done(struct tevent_req *subreq)
}
}
-static NTSTATUS smb2cli_inbuf_parse_compound(uint8_t *buf, TALLOC_CTX *mem_ctx,
+static NTSTATUS smb2cli_inbuf_parse_compound(struct smbXcli_conn *conn,
+ uint8_t *buf,
+ size_t buflen,
+ TALLOC_CTX *mem_ctx,
struct iovec **piov, int *pnum_iov)
{
struct iovec *iov;
- int num_iov;
- size_t buflen;
- size_t taken;
- uint8_t *first_hdr;
-
- num_iov = 0;
+ int num_iov = 0;
+ size_t taken = 0;
+ uint8_t *first_hdr = buf;
iov = talloc_array(mem_ctx, struct iovec, num_iov);
if (iov == NULL) {
return NT_STATUS_NO_MEMORY;
}
- buflen = smb_len_tcp(buf);
- taken = 0;
- first_hdr = buf + NBT_HDR_SIZE;
-
while (taken < buflen) {
size_t len = buflen - taken;
uint8_t *hdr = first_hdr + taken;
@@ -2853,8 +2849,12 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn,
NTSTATUS status;
bool defer = true;
struct smbXcli_session *last_session = NULL;
+ size_t inbuf_len = smb_len_tcp(inbuf);
- status = smb2cli_inbuf_parse_compound(inbuf, tmp_mem,
+ status = smb2cli_inbuf_parse_compound(conn,
+ inbuf + NBT_HDR_SIZE,
+ inbuf_len,
+ tmp_mem,
&iov, &num_iov);
if (!NT_STATUS_IS_OK(status)) {
return status;