s3:smb2_server: simplify smbd_smb2_request_verify_creditcharge() a bit.
authorStefan Metzmacher <metze@samba.org>
Mon, 25 Jun 2012 19:14:43 +0000 (21:14 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 28 Jun 2012 22:14:56 +0000 (00:14 +0200)
A credit charge of 0 is really not a special case, it just means the same
as 1.

metze

source3/smbd/smb2_server.c

index d2300a29f880d809fea269db5ad90cdd0a889b58..a6efdbe6864e3731f1bc697b3b077ebefcef729c 100644 (file)
@@ -1449,12 +1449,7 @@ NTSTATUS smbd_smb2_request_verify_creditcharge(struct smbd_smb2_request *req,
 
        inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
        credit_charge = SVAL(inhdr, SMB2_HDR_CREDIT_CHARGE);
-
-       /* requests larger than 64 KB need credit charge */
-       if (credit_charge == 0 && data_length > 65536) {
-               DEBUG(2, ("Request larger than 64KB w/o creditcharge\n"));
-               return NT_STATUS_INVALID_PARAMETER;
-       }
+       credit_charge = MAX(credit_charge, 1);
 
        needed_charge = (data_length - 1)/ 65536 + 1;