summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-12-19 18:15:30 +0100
committerVolker Lendecke <vl@samba.org>2008-12-19 18:15:30 +0100
commitae1d6020f0a6565959287c229fb7ecd7f5f40231 (patch)
tree870e5b0d39752b8309ed6e46db94a67fd1d741fb /source3
parentfa5f11279bda32dcb9a85c74b2b4a967a8e52104 (diff)
downloadsamba-ae1d6020f0a6565959287c229fb7ecd7f5f40231.tar.gz
samba-ae1d6020f0a6565959287c229fb7ecd7f5f40231.tar.bz2
samba-ae1d6020f0a6565959287c229fb7ecd7f5f40231.zip
Fix setting smb_len for huge write&x calls
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/async_smb.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 52bfc75009..82a919455a 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -552,6 +552,7 @@ bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
void cli_chain_uncork(struct cli_state *cli)
{
struct cli_request *req = cli->chain_accumulator;
+ size_t smblen;
SMB_ASSERT(req != NULL);
@@ -561,7 +562,19 @@ void cli_chain_uncork(struct cli_state *cli)
cli->chain_accumulator = NULL;
SSVAL(req->outbuf, smb_mid, req->mid);
- smb_setlen((char *)req->outbuf, talloc_get_size(req->outbuf) - 4);
+
+ smblen = talloc_get_size(req->outbuf) - 4;
+
+ smb_setlen((char *)req->outbuf, smblen);
+
+ if (smblen > 0x1ffff) {
+ /*
+ * This is a POSIX 14 word large write. Overwrite just the
+ * size field, the '0xFFSMB' has been set by smb_setlen which
+ * _smb_setlen_large does not do.
+ */
+ _smb_setlen_large(((char *)req->outbuf), smblen);
+ }
cli_calculate_sign_mac(cli, (char *)req->outbuf);