[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Fri Jun 10 12:38:02 MDT 2011
The branch, master has been updated
via fdfb5e9 s3:libsmb: remove unused cli_state_seqnum infrastructure
via f0ba1af s3:libsmb/clireadwrite: calculate cli_write_max_bufsize() correct based on max_xmit
via 73128b7 s3:libsmb/clireadwrite: calculate cli_read_max_bufsize() correct based on max_xmit
via 5d06b21 s3:libsmb/clitrans: correctly transfer the seqnum between secondary and primary requests
via 1dd24ac s3:libsmb/clitrans: fix handling of multi pdu [nt]trans[s][2] calls
via 10bb088 s3:libsmb/clitrans: use subreq2 as variable for the secondary requests
via 5146c9b s3:libsmb/clitrans: move MID handling to the end of cli_trans_send() and add a comment
via 0a8fd50 s3:libsmb/clitrans: correctly marshall [nt]trans[s][2] requests
via 6f7af1b s3:libsmb/clitrans: marshall SMBnttrans[2] as the others
via 428a86c s3:libsmb/clitrans: use uint32_t for param and data variables
via 2ae565b s3:libsmb/clitrans: remove unused secondary_request_ctx
via 3dd1ebd s3:libsmb/async_smb: add helpers to get and set the seqnum for signing
via a25936f s3:libsmb/async_smb: don't remove pending requests if the mid is set
via 173fc25 s3:libsmb/async_smb: call cli_smb_req_unset_pending() instead of destructor directly
via 49cdf17 s3:libsmb/async_smb: let cli_smb_recv() initialize output values for one way requests
via f3ba1f4 Bump the smbd vfs interface version to 29. Samba 3.6.0 will ship with interface 28.
from 730ea92 s3:net conf addshare: do not stat-check the share path.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit fdfb5e95fee67bb7bb3942270031d9260e0505b0
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jun 9 11:59:58 2011 +0200
s3:libsmb: remove unused cli_state_seqnum infrastructure
metze
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Fri Jun 10 20:37:54 CEST 2011 on sn-devel-104
commit f0ba1afe5f7dbafaf22c3028864de0f3910f675f
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 19:01:13 2011 +0200
s3:libsmb/clireadwrite: calculate cli_write_max_bufsize() correct based on max_xmit
This is important in order to support DCERPC over ncacn_np against NT4 servers,
where max_xmit is just 4356.
metze
commit 73128b7cc7f536f80072a19cb69527c53d9a6c2f
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 18:59:39 2011 +0200
s3:libsmb/clireadwrite: calculate cli_read_max_bufsize() correct based on max_xmit
This is important in order to support DCERPC over ncacn_np against NT4 servers,
where max_xmit is just 4356.
metze
commit 5d06b2197b5fd95aaf0394d1bdba957bac6c3570
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jun 9 11:57:55 2011 +0200
s3:libsmb/clitrans: correctly transfer the seqnum between secondary and primary requests
This is needed to implement SMB signing correct.
metze
commit 1dd24ac06a7472f53b06bc0aaa54cb22c8da0f78
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 10:31:23 2011 +0200
s3:libsmb/clitrans: fix handling of multi pdu [nt]trans[s][2] calls
We now keep the primary request open for the whole logical request.
The primary request is the one that gets all incoming replies.
While secondary requests are handled as separate one-way requests.
metze
commit 10bb088cf1e005fd047c09afcf6b5b8999d416fe
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 16:41:11 2011 +0200
s3:libsmb/clitrans: use subreq2 as variable for the secondary requests
metze
commit 5146c9ba9df063d6611abe356f9262adb027b091
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 16:11:00 2011 +0200
s3:libsmb/clitrans: move MID handling to the end of cli_trans_send() and add a comment
metze
commit 0a8fd50bd806e925a915c74cb86733481b2144f6
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 00:44:34 2011 +0200
s3:libsmb/clitrans: correctly marshall [nt]trans[s][2] requests
We need to align params and data to 4 byte offsets.
This also correctly recalculates the useable space after each step.
metze
commit 6f7af1b0388d30c8a06c495713066b90ded00780
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jun 9 12:22:59 2011 +0200
s3:libsmb/clitrans: marshall SMBnttrans[2] as the others
This is just to make the code more readable
and easier to notice how many words we're using in vwv.
metze
commit 428a86c92b5b35e28c7d6921f2999616cdc1bc20
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 17:08:00 2011 +0200
s3:libsmb/clitrans: use uint32_t for param and data variables
SMBnttrans uses 32-bit values there.
metze
commit 2ae565b681a6307886b888ee5b576c12916eb0db
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 00:37:24 2011 +0200
s3:libsmb/clitrans: remove unused secondary_request_ctx
metze
commit 3dd1ebd21ee99d130f6dd30326ddafe3f00a50d0
Author: Stefan Metzmacher <metze at samba.org>
Date: Thu Jun 9 11:49:48 2011 +0200
s3:libsmb/async_smb: add helpers to get and set the seqnum for signing
This will be used for correct signing in [nt]trans[2][s] requests.
metze
commit a25936f1b1300a76b08a6bd435bd7ccc388279d5
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 10:20:25 2011 +0200
s3:libsmb/async_smb: don't remove pending requests if the mid is set
If the mid was set explicitly, it means the request expects more than
one reply, so leave it in the pending array.
metze
commit 173fc258e443d97e4ea37f2bee99c21ad15ab484
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 14:14:24 2011 +0200
s3:libsmb/async_smb: call cli_smb_req_unset_pending() instead of destructor directly
metze
commit 49cdf171a5198495aead9ace43963e805331e20b
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Jun 8 00:40:54 2011 +0200
s3:libsmb/async_smb: let cli_smb_recv() initialize output values for one way requests
metze
commit f3ba1f4112b1216239e6c13a9d898e6bdbd86785
Author: Jeremy Allison <jra at samba.org>
Date: Tue May 31 21:03:22 2011 -0700
Bump the smbd vfs interface version to 29. Samba 3.6.0 will ship
with interface 28.
-----------------------------------------------------------------------
Summary of changes:
source3/include/async_smb.h | 2 +
source3/include/client.h | 8 --
source3/include/vfs.h | 3 +-
source3/libsmb/async_smb.c | 51 +++++++++-
source3/libsmb/clientgen.c | 32 ------
source3/libsmb/clireadwrite.c | 33 +++++--
source3/libsmb/clitrans.c | 227 +++++++++++++++++++++++++++++++----------
source3/libsmb/proto.h | 4 -
8 files changed, 248 insertions(+), 112 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index a8852b2..1685d49 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -51,6 +51,8 @@ void cli_smb_req_unset_pending(struct tevent_req *req);
bool cli_smb_req_set_pending(struct tevent_req *req);
uint16_t cli_smb_req_mid(struct tevent_req *req);
void cli_smb_req_set_mid(struct tevent_req *req, uint16_t mid);
+uint32_t cli_smb_req_seqnum(struct tevent_req *req);
+void cli_smb_req_set_seqnum(struct tevent_req *req, uint32_t seqnum);
struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
struct cli_state *cli,
uint8_t smb_command, uint8_t additional_flags,
diff --git a/source3/include/client.h b/source3/include/client.h
index 7d66bf9..a853e90 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -46,13 +46,6 @@ struct print_job_info {
time_t t;
};
-struct cli_state_seqnum {
- struct cli_state_seqnum *prev, *next;
- uint16_t mid;
- uint32_t seqnum;
- bool persistent;
-};
-
struct cli_state {
/**
* A list of subsidiary connections for DFS.
@@ -103,7 +96,6 @@ struct cli_state {
size_t max_xmit;
size_t max_mux;
char *outbuf;
- struct cli_state_seqnum *seqnum;
char *inbuf;
unsigned int bufsize;
int initialised;
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 145b52c..5c7e4e5 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -135,7 +135,8 @@
/* Leave at 28 - not yet released. Add fdopendir. JRA. */
/* Leave at 28 - not yet released. Rename open function to open_fn. - gd */
/* Leave at 28 - not yet released. Make getwd function always return malloced memory. JRA. */
-#define SMB_VFS_INTERFACE_VERSION 28
+/* Bump to version 29 - Samba 3.6.0 will ship with interface version 28. */
+#define SMB_VFS_INTERFACE_VERSION 29
/*
All intercepted VFS operations must be declared as static functions inside module source
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 2ce6410..145e0ae 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -153,6 +153,14 @@ void cli_smb_req_unset_pending(struct tevent_req *req)
int num_pending = talloc_array_length(cli->pending);
int i;
+ if (state->mid != 0) {
+ /*
+ * This is a [nt]trans[2] request which waits
+ * for more than one reply.
+ */
+ return;
+ }
+
if (num_pending == 1) {
/*
* The pending read_smb tevent_req is a child of
@@ -193,6 +201,13 @@ void cli_smb_req_unset_pending(struct tevent_req *req)
static int cli_smb_req_destructor(struct tevent_req *req)
{
+ struct cli_smb_state *state = tevent_req_data(
+ req, struct cli_smb_state);
+ /*
+ * Make sure we really remove it from
+ * the pending array on destruction.
+ */
+ state->mid = 0;
cli_smb_req_unset_pending(req);
return 0;
}
@@ -255,6 +270,20 @@ void cli_smb_req_set_mid(struct tevent_req *req, uint16_t mid)
state->mid = mid;
}
+uint32_t cli_smb_req_seqnum(struct tevent_req *req)
+{
+ struct cli_smb_state *state = tevent_req_data(
+ req, struct cli_smb_state);
+ return state->seqnum;
+}
+
+void cli_smb_req_set_seqnum(struct tevent_req *req, uint32_t seqnum)
+{
+ struct cli_smb_state *state = tevent_req_data(
+ req, struct cli_smb_state);
+ state->seqnum = seqnum;
+}
+
static size_t iov_len(const struct iovec *iov, int count)
{
size_t result = 0;
@@ -627,7 +656,7 @@ static void cli_smb_received(struct tevent_req *subreq)
if (state->chained_requests == NULL) {
state->inbuf = talloc_move(state, &inbuf);
talloc_set_destructor(req, NULL);
- cli_smb_req_destructor(req);
+ cli_smb_req_unset_pending(req);
state->chain_num = 0;
state->chain_length = 1;
tevent_req_done(req);
@@ -671,7 +700,7 @@ static void cli_smb_received(struct tevent_req *subreq)
while (talloc_array_length(cli->pending) > 0) {
req = cli->pending[0];
talloc_set_destructor(req, NULL);
- cli_smb_req_destructor(req);
+ cli_smb_req_unset_pending(req);
tevent_req_nterror(req, status);
}
}
@@ -694,6 +723,24 @@ NTSTATUS cli_smb_recv(struct tevent_req *req,
}
if (state->inbuf == NULL) {
+ if (min_wct != 0) {
+ return NT_STATUS_INVALID_NETWORK_RESPONSE;
+ }
+ if (pinbuf) {
+ *pinbuf = NULL;
+ }
+ if (pwct) {
+ *pwct = 0;
+ }
+ if (pvwv) {
+ *pvwv = NULL;
+ }
+ if (pnum_bytes) {
+ *pnum_bytes = 0;
+ }
+ if (pbytes) {
+ *pbytes = NULL;
+ }
/* This was a request without a reply */
return NT_STATUS_OK;
}
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 1122bbb..d3b66b6 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -68,37 +68,6 @@ bool cli_ucs2(struct cli_state *cli)
return ((cli->capabilities & CAP_UNICODE) != 0);
}
-bool cli_state_seqnum_persistent(struct cli_state *cli,
- uint16_t mid)
-{
- struct cli_state_seqnum *c;
-
- for (c = cli->seqnum; c; c = c->next) {
- if (c->mid == mid) {
- c->persistent = true;
- return true;
- }
- }
-
- return false;
-}
-
-bool cli_state_seqnum_remove(struct cli_state *cli,
- uint16_t mid)
-{
- struct cli_state_seqnum *c;
-
- for (c = cli->seqnum; c; c = c->next) {
- if (c->mid == mid) {
- DLIST_REMOVE(cli->seqnum, c);
- TALLOC_FREE(c);
- return true;
- }
- }
-
- return false;
-}
-
/****************************************************************************
Setup basics in a outgoing packet.
****************************************************************************/
@@ -233,7 +202,6 @@ struct cli_state *cli_initialise_ex(int signing_state)
cli->bufsize = CLI_BUFFER_SIZE+4;
cli->max_xmit = cli->bufsize;
cli->outbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN);
- cli->seqnum = 0;
cli->inbuf = (char *)SMB_MALLOC(cli->bufsize+SAFETY_MARGIN);
cli->oplock_handler = cli_oplock_ack;
cli->case_sensitive = false;
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index c19151e..14b6401 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -28,6 +28,11 @@
****************************************************************************/
static size_t cli_read_max_bufsize(struct cli_state *cli)
{
+ size_t data_offset = smb_size - 4;
+ size_t wct = 12;
+
+ size_t useable_space;
+
if (!client_is_signing_on(cli) && !cli_encryption_on(cli)
&& (cli->server_posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) {
return CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE;
@@ -37,13 +42,21 @@ static size_t cli_read_max_bufsize(struct cli_state *cli)
? CLI_SAMBA_MAX_LARGE_READX_SIZE
: CLI_WINDOWS_MAX_LARGE_READX_SIZE;
}
- return (cli->max_xmit - (smb_size+32)) & ~1023;
+
+ data_offset += wct * sizeof(uint16_t);
+ data_offset += 1; /* pad */
+
+ useable_space = cli->max_xmit - data_offset;
+
+ return useable_space;
}
/****************************************************************************
Calculate the recommended write buffer size
****************************************************************************/
-static size_t cli_write_max_bufsize(struct cli_state *cli, uint16_t write_mode)
+static size_t cli_write_max_bufsize(struct cli_state *cli,
+ uint16_t write_mode,
+ uint8_t wct)
{
if (write_mode == 0 &&
!client_is_signing_on(cli) &&
@@ -62,13 +75,15 @@ static size_t cli_write_max_bufsize(struct cli_state *cli, uint16_t write_mode)
if (((cli->capabilities & CAP_LARGE_WRITEX) == 0)
|| client_is_signing_on(cli)
|| strequal(cli->dev, "LPT1:")) {
+ size_t data_offset = smb_size - 4;
+ size_t useable_space;
- /*
- * Printer devices are restricted to max_xmit writesize in
- * Vista and XPSP3 as are signing connections.
- */
+ data_offset += wct * sizeof(uint16_t);
+ data_offset += 1; /* pad */
+
+ useable_space = cli->max_xmit - data_offset;
- return (cli->max_xmit - (smb_size+32)) & ~1023;
+ return useable_space;
}
return CLI_WINDOWS_MAX_LARGE_WRITEX_SIZE;
@@ -784,7 +799,7 @@ struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
struct cli_write_andx_state *state;
bool bigoffset = ((cli->capabilities & CAP_LARGE_FILES) != 0);
uint8_t wct = bigoffset ? 14 : 12;
- size_t max_write = cli_write_max_bufsize(cli, mode);
+ size_t max_write = cli_write_max_bufsize(cli, mode, wct);
uint16_t *vwv;
req = tevent_req_create(mem_ctx, &state, struct cli_write_andx_state);
@@ -1137,7 +1152,7 @@ struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
state->pending = 0;
state->next_offset = start_offset;
- state->chunk_size = cli_write_max_bufsize(cli, mode);
+ state->chunk_size = cli_write_max_bufsize(cli, mode, 14);
if (window_size == 0) {
window_size = cli->max_mux * state->chunk_size;
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c
index 99a358f..dd8063b 100644
--- a/source3/libsmb/clitrans.c
+++ b/source3/libsmb/clitrans.c
@@ -32,7 +32,6 @@ struct cli_trans_state {
struct event_context *ev;
uint8_t cmd;
uint16_t mid;
- uint32_t seqnum;
const char *pipe_name;
uint8_t *pipe_name_conv;
size_t pipe_name_conv_len;
@@ -52,13 +51,29 @@ struct cli_trans_state {
struct trans_recvblob rdata;
uint16_t recv_flags2;
- TALLOC_CTX *secondary_request_ctx;
-
- struct iovec iov[4];
+ struct iovec iov[6];
uint8_t pad[4];
+ uint8_t zero_pad[4];
uint16_t vwv[32];
+
+ struct tevent_req *primary_subreq;
};
+static void cli_trans_cleanup_primary(struct cli_trans_state *state)
+{
+ if (state->primary_subreq) {
+ cli_smb_req_set_mid(state->primary_subreq, 0);
+ cli_smb_req_unset_pending(state->primary_subreq);
+ TALLOC_FREE(state->primary_subreq);
+ }
+}
+
+static int cli_trans_state_destructor(struct cli_trans_state *state)
+{
+ cli_trans_cleanup_primary(state);
+ return 0;
+}
+
static NTSTATUS cli_pull_trans(uint8_t *inbuf,
uint8_t wct, uint16_t *vwv,
uint16_t num_bytes, uint8_t *bytes,
@@ -173,9 +188,12 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
struct iovec *iov = state->iov;
uint8_t *pad = state->pad;
uint16_t *vwv = state->vwv;
- uint16_t param_offset;
- uint16_t this_param = 0;
- uint16_t this_data = 0;
+ uint32_t param_offset;
+ uint32_t this_param = 0;
+ uint32_t param_pad;
+ uint32_t data_offset;
+ uint32_t this_data = 0;
+ uint32_t data_pad;
uint32_t useable_space;
uint8_t cmd;
@@ -223,7 +241,18 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
break;
}
- useable_space = state->cli->max_xmit - smb_size - sizeof(uint16_t)*wct;
+ param_offset += wct * sizeof(uint16_t);
+ useable_space = state->cli->max_xmit - param_offset;
+
+ param_pad = param_offset % 4;
+ if (param_pad > 0) {
+ param_pad = MIN(param_pad, useable_space);
+ iov[0].iov_base = (void *)state->zero_pad;
+ iov[0].iov_len = param_pad;
+ iov += 1;
+ param_offset += param_pad;
+ }
+ useable_space = state->cli->max_xmit - param_offset;
if (state->param_sent < state->num_param) {
this_param = MIN(state->num_param - state->param_sent,
@@ -233,27 +262,41 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
iov += 1;
}
+ data_offset = param_offset + this_param;
+ useable_space = state->cli->max_xmit - data_offset;
+
+ data_pad = data_offset % 4;
+ if (data_pad > 0) {
+ data_pad = MIN(data_pad, useable_space);
+ iov[0].iov_base = (void *)state->zero_pad;
+ iov[0].iov_len = data_pad;
+ iov += 1;
+ data_offset += data_pad;
+ }
+ useable_space = state->cli->max_xmit - data_offset;
+
if (state->data_sent < state->num_data) {
this_data = MIN(state->num_data - state->data_sent,
- useable_space - this_param);
+ useable_space);
iov[0].iov_base = (void *)(state->data + state->data_sent);
iov[0].iov_len = this_data;
iov += 1;
}
- param_offset += wct * sizeof(uint16_t);
-
DEBUG(10, ("num_setup=%u, max_setup=%u, "
"param_total=%u, this_param=%u, max_param=%u, "
"data_total=%u, this_data=%u, max_data=%u, "
- "param_offset=%u, param_disp=%u, data_disp=%u\n",
+ "param_offset=%u, param_pad=%u, param_disp=%u, "
+ "data_offset=%u, data_pad=%u, data_disp=%u\n",
(unsigned)state->num_setup, (unsigned)state->max_setup,
(unsigned)state->num_param, (unsigned)this_param,
(unsigned)state->rparam.max,
(unsigned)state->num_data, (unsigned)this_data,
(unsigned)state->rdata.max,
- (unsigned)param_offset,
- (unsigned)state->param_sent, (unsigned)state->data_sent));
+ (unsigned)param_offset, (unsigned)param_pad,
+ (unsigned)state->param_sent,
+ (unsigned)data_offset, (unsigned)data_pad,
+ (unsigned)state->data_sent));
switch (cmd) {
case SMBtrans:
@@ -270,7 +313,7 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
SSVAL(vwv + 9, 0, this_param);
SSVAL(vwv +10, 0, param_offset);
SSVAL(vwv +11, 0, this_data);
- SSVAL(vwv +12, 0, param_offset + this_param);
+ SSVAL(vwv +12, 0, data_offset);
SCVAL(vwv +13, 0, state->num_setup);
SCVAL(vwv +13, 1, 0); /* reserved */
memcpy(vwv + 14, state->setup,
@@ -284,40 +327,40 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
SSVAL(vwv + 3, 0, param_offset);
SSVAL(vwv + 4, 0, state->param_sent);
SSVAL(vwv + 5, 0, this_data);
- SSVAL(vwv + 6, 0, param_offset + this_param);
+ SSVAL(vwv + 6, 0, data_offset);
SSVAL(vwv + 7, 0, state->data_sent);
if (cmd == SMBtranss2) {
SSVAL(vwv + 8, 0, state->fid);
}
break;
case SMBnttrans:
- SCVAL(vwv, 0, state->max_setup);
- SSVAL(vwv, 1, 0); /* reserved */
- SIVAL(vwv, 3, state->num_param);
- SIVAL(vwv, 7, state->num_data);
- SIVAL(vwv, 11, state->rparam.max);
- SIVAL(vwv, 15, state->rdata.max);
- SIVAL(vwv, 19, this_param);
- SIVAL(vwv, 23, param_offset);
- SIVAL(vwv, 27, this_data);
- SIVAL(vwv, 31, param_offset + this_param);
- SCVAL(vwv, 35, state->num_setup);
- SSVAL(vwv, 36, state->function);
+ SCVAL(vwv + 0, 0, state->max_setup);
+ SSVAL(vwv + 0, 1, 0); /* reserved */
+ SIVAL(vwv + 1, 1, state->num_param);
+ SIVAL(vwv + 3, 1, state->num_data);
+ SIVAL(vwv + 5, 1, state->rparam.max);
+ SIVAL(vwv + 7, 1, state->rdata.max);
+ SIVAL(vwv + 9, 1, this_param);
+ SIVAL(vwv +11, 1, param_offset);
+ SIVAL(vwv +13, 1, this_data);
+ SIVAL(vwv +15, 1, data_offset);
+ SCVAL(vwv +17, 1, state->num_setup);
+ SSVAL(vwv +18, 0, state->function);
memcpy(vwv + 19, state->setup,
sizeof(uint16_t) * state->num_setup);
break;
case SMBnttranss:
- SSVAL(vwv, 0, 0); /* reserved */
- SCVAL(vwv, 2, 0); /* reserved */
- SIVAL(vwv, 3, state->num_param);
- SIVAL(vwv, 7, state->num_data);
- SIVAL(vwv, 11, this_param);
- SIVAL(vwv, 15, param_offset);
- SIVAL(vwv, 19, state->param_sent);
- SIVAL(vwv, 23, this_data);
- SIVAL(vwv, 27, param_offset + this_param);
- SIVAL(vwv, 31, state->data_sent);
- SCVAL(vwv, 35, 0); /* reserved */
+ SSVAL(vwv + 0, 0, 0); /* reserved */
+ SCVAL(vwv + 1, 0, 0); /* reserved */
+ SIVAL(vwv + 1, 1, state->num_param);
+ SIVAL(vwv + 3, 1, state->num_data);
+ SIVAL(vwv + 5, 1, this_param);
+ SIVAL(vwv + 7, 1, param_offset);
+ SIVAL(vwv + 9, 1, state->param_sent);
+ SIVAL(vwv +11, 1, this_data);
+ SIVAL(vwv +13, 1, data_offset);
+ SIVAL(vwv +15, 1, state->data_sent);
+ SCVAL(vwv +17, 1, 0); /* reserved */
break;
}
@@ -414,17 +457,30 @@ struct tevent_req *cli_trans_send(
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
- state->mid = cli_smb_req_mid(subreq);
status = cli_smb_req_send(subreq);
if (!NT_STATUS_IS_OK(status)) {
tevent_req_nterror(req, status);
return tevent_req_post(req, state->ev);
}
- cli_state_seqnum_persistent(cli, state->mid);
tevent_req_set_callback(subreq, cli_trans_done, req);
+
+ /*
+ * Now get the MID of the primary request
+ * and mark it as persistent. This means
+ * we will able to send and receive multiple
+ * SMB pdus using this MID in both directions
--
Samba Shared Repository
More information about the samba-cvs
mailing list