summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@sernet.de>2008-09-08 22:53:50 +0200
committerVolker Lendecke <vl@samba.org>2008-09-08 23:32:22 +0200
commitd39e9e05ed485f93bb2709ec2494dd2c42ea1300 (patch)
tree1e60d7d9a0edfe0c47a9f93bad093b8c98a16b7d /source3/smbd/trans2.c
parentd4b41079cb6bfffa75e3d7b188ab4331f7aa32b8 (diff)
downloadsamba-d39e9e05ed485f93bb2709ec2494dd2c42ea1300.tar.gz
samba-d39e9e05ed485f93bb2709ec2494dd2c42ea1300.tar.bz2
samba-d39e9e05ed485f93bb2709ec2494dd2c42ea1300.zip
Fix calculation of useable_space for trans2 and nttrans replies
When alignment was in place, we pretended to send more data/params according to the param_offset/param_length and data_offset/data_length parameters than would actually fit into the SMB according to the NBSS length field. (This used to be commit ef3c132b8455c6fe4d0bb9f0be881040a806a4ed)
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 8d839b66b3..3c1753354b 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -744,14 +744,16 @@ void send_trans2_replies(connection_struct *conn,
+ alignment_offset
+ data_alignment_offset);
- /* useable_space can never be more than max_send minus the alignment offset. */
-
- useable_space = MIN(useable_space, max_send - (alignment_offset+data_alignment_offset));
+ if (useable_space < 0) {
+ DEBUG(0, ("send_trans2_replies failed sanity useable_space "
+ "= %d!!!", useable_space));
+ exit_server_cleanly("send_trans2_replies: Not enough space");
+ }
while (params_to_send || data_to_send) {
/* Calculate whether we will totally or partially fill this packet */
- total_sent_thistime = params_to_send + data_to_send + alignment_offset + data_alignment_offset;
+ total_sent_thistime = params_to_send + data_to_send;
/* We can never send more than useable_space */
/*
@@ -761,9 +763,10 @@ void send_trans2_replies(connection_struct *conn,
* are sent here. Fix from Marc_Jacobsen@hp.com.
*/
- total_sent_thistime = MIN(total_sent_thistime, useable_space+ alignment_offset + data_alignment_offset);
+ total_sent_thistime = MIN(total_sent_thistime, useable_space);
- reply_outbuf(req, 10, total_sent_thistime);
+ reply_outbuf(req, 10, total_sent_thistime + alignment_offset
+ + data_alignment_offset);
/* Set total params and data to be sent */
SSVAL(req->outbuf,smb_tprcnt,paramsize);