1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

libcli/smb: calculate the credit charge on the input and output dyn_len

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2013-08-13 09:50:29 +02:00
parent 1229881df6
commit 318735fd5e

View File

@ -246,6 +246,11 @@ struct smbXcli_req_state {
*/ */
struct iovec *recv_iov; struct iovec *recv_iov;
/*
* the expected max for the response dyn_len
*/
uint32_t max_dyn_len;
uint16_t credit_charge; uint16_t credit_charge;
bool should_sign; 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) { 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 { } else {
charge = 1; charge = 1;
} }