fixed support for readx greater than 64k
authorAndrew Tridgell <tridge@samba.org>
Tue, 4 Aug 2009 06:01:11 +0000 (16:01 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 4 Aug 2009 06:01:11 +0000 (16:01 +1000)
This fixes bug 6547, where smbclient in S3 reads more than 64k at a
time with readx.

source4/ntvfs/posix/pvfs_read.c
source4/smb_server/smb/reply.c

index d9080d632d076f24fd4761f2bff879c395c41703..75fba3c90d9bbbc1cd1c051756a7d162d1398786 100644 (file)
@@ -59,8 +59,8 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
        }
 
        maxcnt = rd->readx.in.maxcnt;
-       if (maxcnt > UINT16_MAX && req->ctx->protocol < PROTOCOL_SMB2) {
-               maxcnt = 0;
+       if (maxcnt > 2*UINT16_MAX && req->ctx->protocol < PROTOCOL_SMB2) {
+               return NT_STATUS_INVALID_PARAMETER;
        }
 
        status = pvfs_check_lock(pvfs, f, req->smbpid, 
index ec7b6783fd437eb559c26b8598ded370262ad427..0433d3582f4e24d8922a98bc0f66b49ec4c7f836 100644 (file)
@@ -831,7 +831,8 @@ static void reply_read_and_X_send(struct ntvfs_request *ntvfs)
        SMBSRV_VWV_RESERVED(4, 1);
        SSVAL(req->out.vwv, VWV(5), io->readx.out.nread);
        SSVAL(req->out.vwv, VWV(6), PTR_DIFF(io->readx.out.data, req->out.hdr));
-       SMBSRV_VWV_RESERVED(7, 5);
+       SSVAL(req->out.vwv, VWV(7), (io->readx.out.nread>>16));
+       SMBSRV_VWV_RESERVED(8, 4);
 
        smbsrv_chain_reply(req);
 }