diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-06-08 18:59:39 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-06-10 19:27:05 +0200 |
commit | 73128b7cc7f536f80072a19cb69527c53d9a6c2f (patch) | |
tree | b2fe2e0c2d0c1a0cae5e0b433ea5829f36eee483 /source3 | |
parent | 5d06b2197b5fd95aaf0394d1bdba957bac6c3570 (diff) | |
download | samba-73128b7cc7f536f80072a19cb69527c53d9a6c2f.tar.gz samba-73128b7cc7f536f80072a19cb69527c53d9a6c2f.tar.bz2 samba-73128b7cc7f536f80072a19cb69527c53d9a6c2f.zip |
s3:libsmb/clireadwrite: calculate cli_read_max_bufsize() correct based on max_xmit
This is important in order to support DCERPC over ncacn_np against NT4 servers,
where max_xmit is just 4356.
metze
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clireadwrite.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index c19151e5b8..e8baeba588 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -28,6 +28,11 @@ ****************************************************************************/ static size_t cli_read_max_bufsize(struct cli_state *cli) { + size_t data_offset = smb_size - 4; + size_t wct = 12; + + size_t useable_space; + if (!client_is_signing_on(cli) && !cli_encryption_on(cli) && (cli->server_posix_capabilities & CIFS_UNIX_LARGE_READ_CAP)) { return CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE; @@ -37,7 +42,13 @@ static size_t cli_read_max_bufsize(struct cli_state *cli) ? CLI_SAMBA_MAX_LARGE_READX_SIZE : CLI_WINDOWS_MAX_LARGE_READX_SIZE; } - return (cli->max_xmit - (smb_size+32)) & ~1023; + + data_offset += wct * sizeof(uint16_t); + data_offset += 1; /* pad */ + + useable_space = cli->max_xmit - data_offset; + + return useable_space; } /**************************************************************************** |