s4:libcli/smb2: calculate the correct credit charge in smb2_getinfo_send()
authorStefan Metzmacher <metze@samba.org>
Tue, 8 Jan 2019 15:11:15 +0000 (16:11 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 28 Mar 2019 23:09:36 +0000 (23:09 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13863

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/libcli/smb2/getinfo.c

index 591309c62f77314b1ed3a3b4e1688f76946d9822..7a8fd44a8550cd60dfdfd0ac59e266c2e4f4f1e3 100644 (file)
@@ -32,6 +32,7 @@ struct smb2_request *smb2_getinfo_send(struct smb2_tree *tree, struct smb2_getin
 {
        struct smb2_request *req;
        NTSTATUS status;
+       size_t max_payload;
 
        req = smb2_request_init_tree(tree, SMB2_OP_GETINFO, 0x28, true, 
                                     io->in.input_buffer.length);
@@ -63,6 +64,9 @@ struct smb2_request *smb2_getinfo_send(struct smb2_tree *tree, struct smb2_getin
        }
        SSVAL(req->out.body, 0x0C, io->in.reserved);
 
+       max_payload = MAX(io->in.output_buffer_length, io->in.input_buffer.length);
+       req->credit_charge = (MAX(max_payload, 1) - 1)/ 65536 + 1;
+
        smb2_transport_send(req);
 
        return req;