summaryrefslogtreecommitdiffstats
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-03-04 14:07:26 +0100
committerJeremy Allison <jra@samba.org>2014-03-05 10:49:43 -0800
commit8b746f5a2137b74e28bce5370f5aa9d4bcdac6c2 (patch)
treedede0ce82f4890e40f9aa24786388b0480a75665 /source3/smbd/reply.c
parentf69be2c28e097c66907df264794706006fe0ae7f (diff)
downloadsamba-8b746f5a2137b74e28bce5370f5aa9d4bcdac6c2.tar.gz
samba-8b746f5a2137b74e28bce5370f5aa9d4bcdac6c2.tar.xz
samba-8b746f5a2137b74e28bce5370f5aa9d4bcdac6c2.zip
s3:smbd: fix the read numtoread calculation depending on the max_send.
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 4ca5f7d79e..b2d3f44b22 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3569,10 +3569,10 @@ void reply_read(struct smb_request *req)
{
connection_struct *conn = req->conn;
size_t numtoread;
+ size_t maxtoread;
ssize_t nread = 0;
char *data;
off_t startpos;
- int outsize = 0;
files_struct *fsp;
struct lock_struct lock;
struct smbd_server_connection *sconn = req->sconn;
@@ -3601,17 +3601,17 @@ void reply_read(struct smb_request *req)
numtoread = SVAL(req->vwv+1, 0);
startpos = IVAL_TO_SMB_OFF_T(req->vwv+2, 0);
- numtoread = MIN(BUFFER_SIZE-outsize,numtoread);
-
/*
- * The requested read size cannot be greater than max_recv. JRA.
+ * The requested read size cannot be greater than max_send. JRA.
*/
- if (numtoread > sconn->smb1.negprot.max_recv) {
- DEBUG(0,("reply_read: requested read size (%u) is greater than maximum allowed (%u). \
+ maxtoread = sconn->smb1.sessions.max_send - (smb_size + 5*2 + 3);
+
+ if (numtoread > maxtoread) {
+ DEBUG(0,("reply_read: requested read size (%u) is greater than maximum allowed (%u/%u). \
Returning short read of maximum allowed for compatibility with Windows 2000.\n",
- (unsigned int)numtoread,
- (unsigned int)sconn->smb1.negprot.max_recv));
- numtoread = MIN(numtoread, sconn->smb1.negprot.max_recv);
+ (unsigned int)numtoread, (unsigned int)maxtoread,
+ (unsigned int)sconn->smb1.sessions.max_send));
+ numtoread = maxtoread;
}
reply_outbuf(req, 5, numtoread+3);