diff options
author | Ralph Boehme <slow@samba.org> | 2017-02-27 16:14:39 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-03-03 21:55:27 +0100 |
commit | 8cbdc6a6dfe22a777e3420a6471726604fcafe60 (patch) | |
tree | c239e6981c55c780b8e2182fca39ec17033e33c3 /libcli | |
parent | ac71bb3eb45fc87365206a5f6f9083c42972b25a (diff) | |
download | samba-8cbdc6a6dfe22a777e3420a6471726604fcafe60.tar.gz |
libcli/smb: add max_credits arg to smbXcli_negprot_send()
This allows source4/torture code to set the option for tests by
preparing a struct smbcli_options with max_credits set to some value and
pass that to a torture_smb2_connection_ext().
This will be used in subsequent smbtorture test for SMB2 creditting.
Behaviour of existing upper layers is unchanged, they simply pass the
wanted max credits value to smbXcli_negprot_send() instead of
retrofitting it with a call to smb2cli_conn_set_max_credits().
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 20 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 3 |
2 files changed, 10 insertions, 13 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index a7b24f01497..70285e63173 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -4092,7 +4092,8 @@ struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn, uint32_t timeout_msec, enum protocol_types min_protocol, - enum protocol_types max_protocol) + enum protocol_types max_protocol, + uint16_t max_credits) { struct tevent_req *req, *subreq; struct smbXcli_negprot_state *state; @@ -4125,6 +4126,10 @@ struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx, conn->max_protocol = max_protocol; conn->protocol = PROTOCOL_NONE; + if (max_protocol >= PROTOCOL_SMB2_02) { + conn->smb2.max_credits = max_credits; + } + if ((min_protocol < PROTOCOL_SMB2_02) && (max_protocol < PROTOCOL_SMB2_02)) { /* @@ -4147,16 +4152,6 @@ struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx, */ conn->dispatch_incoming = smb2cli_conn_dispatch_incoming; - /* - * As we're starting with an SMB2 negprot, emulate Windows - * and ask for 31 credits in the initial SMB2 negprot. - * If we don't and leave requested credits at - * zero, MacOSX servers return zero credits on - * the negprot reply and we fail to connect. - */ - smb2cli_conn_set_max_credits(conn, - WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK); - subreq = smbXcli_negprot_smb2_subreq(state); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); @@ -5137,7 +5132,8 @@ NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn, goto fail; } req = smbXcli_negprot_send(frame, ev, conn, timeout_msec, - min_protocol, max_protocol); + min_protocol, max_protocol, + WINDOWS_CLIENT_PURE_SMB2_NEGPROT_INITIAL_CREDIT_ASK); if (req == NULL) { goto fail; } diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index 702eedf5dba..6041ae53d07 100644 --- a/libcli/smb/smbXcli_base.h +++ b/libcli/smb/smbXcli_base.h @@ -436,7 +436,8 @@ struct tevent_req *smbXcli_negprot_send(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn, uint32_t timeout_msec, enum protocol_types min_protocol, - enum protocol_types max_protocol); + enum protocol_types max_protocol, + uint16_t max_credits); NTSTATUS smbXcli_negprot_recv(struct tevent_req *req); NTSTATUS smbXcli_negprot(struct smbXcli_conn *conn, uint32_t timeout_msec, |