libcli/smb: calculate the credit charge on the input and output dyn_len
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Aug 2013 07:50:29 +0000 (09:50 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 15 Aug 2013 07:07:06 +0000 (09:07 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/smb/smbXcli_base.c

index 3b24f9a07aafb1acb3c77ab96278f449cac6f1c9..7d7df144f7e7ecf27af2908e93851e5134e6737b 100644 (file)
@@ -246,6 +246,11 @@ struct smbXcli_req_state {
                 */
                struct iovec *recv_iov;
 
+               /*
+                * the expected max for the response dyn_len
+                */
+               uint32_t max_dyn_len;
+
                uint16_t credit_charge;
 
                bool should_sign;
@@ -2788,7 +2793,12 @@ NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs,
                }
 
                if (state->conn->smb2.server.capabilities & SMB2_CAP_LARGE_MTU) {
-                       charge = (MAX(state->smb2.dyn_len, 1) - 1)/ 65536 + 1;
+                       uint32_t max_dyn_len = 1;
+
+                       max_dyn_len = MAX(max_dyn_len, state->smb2.dyn_len);
+                       max_dyn_len = MAX(max_dyn_len, state->smb2.max_dyn_len);
+
+                       charge = (max_dyn_len - 1)/ 65536 + 1;
                } else {
                        charge = 1;
                }