summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-12-06 13:45:35 +0100
committerKarolin Seeger <kseeger@samba.org>2014-04-01 09:26:37 +0200
commit047f88151091590f1fee08e4e45ae4874a99e6c8 (patch)
treed2a19cdab717d9a0e06069607b8a3e0f7ef165cd
parent08aa53b581bc0b0a03babafca527de481f855782 (diff)
downloadsamba-047f88151091590f1fee08e4e45ae4874a99e6c8.tar.gz
s3:smbd: use SMB_BUFFER_SIZE_MIN/MAX to limit lp_max_xmit()
The current limit of 128*1024 causes problems as the value has to be <= UINT16_MAX otherwise some clients get confused, as they want to use the MaxBufferSize value from the negprot response (uint32_t) for the MaxBufferSize value in thet session setup request (uint16_t). E.g. Windows 7 (as client) sends MaxBufferSize = 0 if the server value is > UINT16_MAX. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10422 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit a349b0bef9085fd139640ec92399bc63d8029cb9)
-rw-r--r--source3/smbd/process.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 48dbfa1e8cb..02a219eec8f 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3367,6 +3367,7 @@ void smbd_process(struct tevent_context *ev_ctx,
const char *remaddr = NULL;
char *rhost;
int ret;
+ int tmp;
conn = talloc_zero(ev_ctx, struct smbXsrv_connection);
if (conn == NULL) {
@@ -3655,7 +3656,11 @@ void smbd_process(struct tevent_context *ev_ctx,
sconn->nbt.got_session = false;
- sconn->smb1.negprot.max_recv = MIN(lp_max_xmit(),BUFFER_SIZE);
+ tmp = lp_max_xmit();
+ tmp = MAX(tmp, SMB_BUFFER_SIZE_MIN);
+ tmp = MIN(tmp, SMB_BUFFER_SIZE_MAX);
+
+ sconn->smb1.negprot.max_recv = tmp;
sconn->smb1.sessions.done_sesssetup = false;
sconn->smb1.sessions.max_send = BUFFER_SIZE;