diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-03-04 14:07:26 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2014-04-01 09:26:38 +0200 |
commit | 6deb0f2a505c9446657962127926d6c0df9817e7 (patch) | |
tree | 7baf350ed48c2d1da7f9fd9b0d1dfd8178b03e98 /source3/smbd | |
parent | 434e2115a15f201908c16c2f290c35098fc42d78 (diff) | |
download | samba-6deb0f2a505c9446657962127926d6c0df9817e7.tar.gz |
s3:smbd: fix the lockread numtoread calculation depending on the max_send.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f69be2c28e097c66907df264794706006fe0ae7f)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/reply.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 0ed5b51590..602eb16ab6 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3470,6 +3470,7 @@ void reply_lockread(struct smb_request *req) char *data; off_t startpos; size_t numtoread; + size_t maxtoread; NTSTATUS status; files_struct *fsp; struct byte_range_lock *br_lck = NULL; @@ -3500,14 +3501,12 @@ void reply_lockread(struct smb_request *req) numtoread = SVAL(req->vwv+1, 0); startpos = IVAL_TO_SMB_OFF_T(req->vwv+2, 0); - numtoread = MIN(BUFFER_SIZE - (smb_size + 5*2 + 3), numtoread); - /* * NB. Discovered by Menny Hamburger at Mainsoft. This is a core+ * protocol request that predates the read/write lock concept. * Thus instead of asking for a read lock here we need to ask * for a write lock. JRA. - * Note that the requested lock size is unaffected by max_recv. + * Note that the requested lock size is unaffected by max_send. */ br_lck = do_lock(req->sconn->msg_ctx, @@ -3530,15 +3529,16 @@ void reply_lockread(struct smb_request *req) } /* - * However the requested READ size IS affected by max_recv. Insanity.... JRA. + * However the requested READ size IS affected by max_send. Insanity.... JRA. */ + maxtoread = sconn->smb1.sessions.max_send - (smb_size + 5*2 + 3); - if (numtoread > sconn->smb1.negprot.max_recv) { - DEBUG(0,("reply_lockread: requested read size (%u) is greater than maximum allowed (%u). \ + if (numtoread > maxtoread) { + DEBUG(0,("reply_lockread: 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); |