diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-12-06 13:53:45 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-03-05 10:06:24 -0800 |
commit | 2ec49cf57c88735be962b0681b487df5efe7ed6b (patch) | |
tree | 0a0f501d76cd5ca746742e9d5044030fe7d59db3 | |
parent | cce1eaea91088efd742891befdaafade0c1fdce6 (diff) | |
download | samba-2ec49cf57c88735be962b0681b487df5efe7ed6b.tar.gz |
s3:smbd: take less than SMB_BUFFER_SIZE_MIN ('500') as header overhead in ipc.c
We're now sure that sconn->smb1.sessions.max_send is >= SMB_BUFFER_SIZE_MIN.
in order to garantee some progress we need to make sure our assumed
header overhead is less than SMB_BUFFER_SIZE_MIN.
Assuming 372 bytes for the SMBtrans headers should still be more than
enough.
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>
-rw-r--r-- | source3/smbd/ipc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 91d5047c4c6..dbb259cedc2 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -109,12 +109,14 @@ void send_trans_reply(connection_struct *conn, int lparam = rparam ? rparam_len : 0; struct smbd_server_connection *sconn = req->sconn; int max_send = sconn->smb1.sessions.max_send; + /* HACK: make sure we send at least 128 byte in one go */ + int hdr_overhead = SMB_BUFFER_SIZE_MIN - 128; if (buffer_too_large) DEBUG(5,("send_trans_reply: buffer %d too large\n", ldata )); - this_lparam = MIN(lparam,max_send - 500); /* hack */ - this_ldata = MIN(ldata,max_send - (500+this_lparam)); + this_lparam = MIN(lparam,max_send - hdr_overhead); + this_ldata = MIN(ldata,max_send - (hdr_overhead+this_lparam)); align = ((this_lparam)%4); @@ -163,9 +165,9 @@ void send_trans_reply(connection_struct *conn, while (tot_data_sent < ldata || tot_param_sent < lparam) { this_lparam = MIN(lparam-tot_param_sent, - max_send - 500); /* hack */ + max_send - hdr_overhead); this_ldata = MIN(ldata -tot_data_sent, - max_send - (500+this_lparam)); + max_send - (hdr_overhead+this_lparam)); if(this_lparam < 0) this_lparam = 0; |