summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-05 18:22:57 +0200
committerStefan Metzmacher <metze@samba.org>2011-09-07 08:33:15 +0200
commit85b393a199c633acaec68591c2b3940fdb5fbf99 (patch)
tree8992bd20e718c8d0b19f00d6bd63f55ab177315b /source3/libsmb
parent42609036be8068a143169cbf18f42b0ac7f6575f (diff)
downloadsamba-85b393a199c633acaec68591c2b3940fdb5fbf99.tar.gz
samba-85b393a199c633acaec68591c2b3940fdb5fbf99.tar.bz2
samba-85b393a199c633acaec68591c2b3940fdb5fbf99.zip
s3:smb2cli: SMB2_WRITE needs one dyn byte to that the structure size check works.
Windows generates NT_STATUS_INVALID_PARAMETER otherwise. metze
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/smb2cli_write.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source3/libsmb/smb2cli_write.c b/source3/libsmb/smb2cli_write.c
index 98d754a9b0..d512f0092b 100644
--- a/source3/libsmb/smb2cli_write.c
+++ b/source3/libsmb/smb2cli_write.c
@@ -27,6 +27,7 @@
struct smb2cli_write_state {
uint8_t fixed[48];
+ uint8_t dyn_pad[1];
};
static void smb2cli_write_done(struct tevent_req *subreq);
@@ -45,6 +46,8 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
struct tevent_req *req, *subreq;
struct smb2cli_write_state *state;
uint8_t *fixed;
+ const uint8_t *dyn;
+ size_t dyn_len;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_write_state);
@@ -63,13 +66,21 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
SIVAL(fixed, 36, remaining_bytes);
SIVAL(fixed, 44, flags);
+ if (length > 0) {
+ dyn = data;
+ dyn_len = length;
+ } else {
+ dyn = state->dyn_pad;;
+ dyn_len = sizeof(state->dyn_pad);
+ }
+
subreq = smb2cli_req_send(state, ev, cli, SMB2_OP_WRITE,
0, 0, /* flags */
cli->smb2.pid,
cli->smb2.tid,
cli->smb2.uid,
state->fixed, sizeof(state->fixed),
- data, length);
+ dyn, dyn_len);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}