summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-06-09 17:06:40 +0200
committerStefan Metzmacher <metze@samba.org>2009-06-09 19:51:01 +0200
commit6c44cc11b98c0165007af87cd98525404e573835 (patch)
treed31d7efbd0731448debadece98ba66b1f396c5c6 /source3/smbd
parent7c58a2f23734f8931cb822f71277cac7bb7ffe35 (diff)
downloadsamba-6c44cc11b98c0165007af87cd98525404e573835.tar.gz
samba-6c44cc11b98c0165007af87cd98525404e573835.tar.bz2
samba-6c44cc11b98c0165007af87cd98525404e573835.zip
s3:smbd: don't include 1 byte padding for the dynamic buffer of SMB2 responses
It seems that Windows 2008 and Windows 7 doesn't do this anymore. metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/smb2_server.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 0413832f90..42e230785c 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -206,27 +206,23 @@ static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req)
const uint8_t *inhdr = NULL;
uint8_t *outhdr = NULL;
uint8_t *outbody = NULL;
- uint8_t *outdyn = NULL;
- size_t outdyn_size = 1;
uint32_t next_command_ofs = 0;
struct iovec *current = &vector[idx];
if ((idx + 3) < count) {
/* we have a next command */
- next_command_ofs = SMB2_HDR_BODY + 8 + 8;
- outdyn_size = 8;
+ next_command_ofs = SMB2_HDR_BODY + 8;
}
inhdr = (const uint8_t *)req->in.vector[idx].iov_base;
outhdr = talloc_array(vector, uint8_t,
- SMB2_HDR_BODY + 8 + outdyn_size);
+ SMB2_HDR_BODY + 8);
if (outhdr == NULL) {
return NT_STATUS_NO_MEMORY;
}
outbody = outhdr + SMB2_HDR_BODY;
- outdyn = outbody + 8;
current[0].iov_base = (void *)outhdr;
current[0].iov_len = SMB2_HDR_BODY;
@@ -234,8 +230,8 @@ static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req)
current[1].iov_base = (void *)outbody;
current[1].iov_len = 8;
- current[2].iov_base = (void *)outdyn;
- current[2].iov_len = outdyn_size;
+ current[2].iov_base = NULL;
+ current[2].iov_len = 0;
/* setup the SMB2 header */
SIVAL(outhdr, SMB2_HDR_PROTOCOL_ID, SMB2_MAGIC);
@@ -260,12 +256,9 @@ static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req)
memset(outhdr + SMB2_HDR_SIGNATURE, 0, 16);
/* setup error body header */
- SSVAL(outbody, 0x00, 9);
+ SSVAL(outbody, 0x00, 0x08 + 1);
SSVAL(outbody, 0x02, 0);
SIVAL(outbody, 0x04, 0);
-
- /* setup the dynamic part */
- SCVAL(outdyn, 0x00, 0);
}
req->out.vector = vector;
@@ -612,8 +605,8 @@ NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
req->out.vector[i+2].iov_base = (void *)info->data;
req->out.vector[i+2].iov_len = info->length;
} else {
- req->out.vector[i+2].iov_base = (void *)(outbody + 8);
- req->out.vector[i+2].iov_len = 1;
+ req->out.vector[i+2].iov_base = NULL;
+ req->out.vector[i+2].iov_len = 0;
}
/* the error packet is the last response in the chain */
@@ -659,12 +652,8 @@ NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
req->out.vector[i+1].iov_len = body.length;
if (dyn) {
- if (dyn->length > 0) {
- req->out.vector[i+2].iov_base = (void *)dyn->data;
- req->out.vector[i+2].iov_len = dyn->length;
- } else {
- /* the dyn section is already initialized */
- }
+ req->out.vector[i+2].iov_base = (void *)dyn->data;
+ req->out.vector[i+2].iov_len = dyn->length;
} else {
req->out.vector[i+2].iov_base = NULL;
req->out.vector[i+2].iov_len = 0;
@@ -682,7 +671,6 @@ NTSTATUS smbd_smb2_request_done_ex(struct smbd_smb2_request *req,
return smbd_smb2_request_error(req, NT_STATUS_INTERNAL_ERROR);
}
- /* the error packet is the last response in the chain */
SIVAL(outhdr, SMB2_HDR_NEXT_COMMAND, next_command_ofs);
return smbd_smb2_request_reply(req);