diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-06-09 15:04:53 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-06-09 16:49:30 +0200 |
commit | 5b99fa5c4fb1a21caa6da747f8ee9db737990432 (patch) | |
tree | 6b267227253020dc4a9d1431cd0eca744f01fd7d /source4/libcli/smb2 | |
parent | d777879aaa3d86cd31fe5d1e0bbd15b9ee02e5cb (diff) | |
download | samba-5b99fa5c4fb1a21caa6da747f8ee9db737990432.tar.gz samba-5b99fa5c4fb1a21caa6da747f8ee9db737990432.tar.bz2 samba-5b99fa5c4fb1a21caa6da747f8ee9db737990432.zip |
s4:libcli/smb2: only add the 1 byte dynamic buffer padding for non compounded requests
metze
Diffstat (limited to 'source4/libcli/smb2')
-rw-r--r-- | source4/libcli/smb2/request.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index c351fd2fcb..7482cf1f2c 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -65,6 +65,7 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_ uint64_t seqnum; uint32_t hdr_offset; uint32_t flags = 0; + bool compound = false; if (body_dynamic_present) { if (body_dynamic_size == 0) { @@ -95,6 +96,7 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_ ZERO_STRUCT(req->in); if (transport->compound.missing > 0) { + compound = true; transport->compound.missing -= 1; req->out = transport->compound.buffer; ZERO_STRUCT(transport->compound.buffer); @@ -148,7 +150,7 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_ * if we have a dynamic part, make sure the first byte * which is always be part of the packet is initialized */ - if (body_dynamic_size) { + if (body_dynamic_size && !compound) { req->out.size += 1; SCVAL(req->out.dynamic, 0, 0); } @@ -257,7 +259,9 @@ size_t smb2_padding_size(uint32_t offset, size_t n) static size_t smb2_padding_fix(struct smb2_request_buffer *buf) { if (buf->dynamic == (buf->body + buf->body_fixed)) { - return 1; + if (buf->dynamic != (buf->buffer + buf->size)) { + return 1; + } } return 0; } |