From 85b393a199c633acaec68591c2b3940fdb5fbf99 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 5 Sep 2011 18:22:57 +0200 Subject: s3:smb2cli: SMB2_WRITE needs one dyn byte to that the structure size check works. Windows generates NT_STATUS_INVALID_PARAMETER otherwise. metze --- source3/libsmb/smb2cli_write.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source3/libsmb') 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); } -- cgit