diff options
author | Volker Lendecke <vl@samba.org> | 2022-09-29 11:08:12 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2022-10-03 20:03:32 +0000 |
commit | 4388ba47ea25213d364402da7ddcd032845d2ad3 (patch) | |
tree | 4a86230b03dcfcae4006e2b270d82043971a7740 /libcli/smb | |
parent | 36bd73e836f733068bdc9bb5df704f825fac7d2e (diff) | |
download | samba-4388ba47ea25213d364402da7ddcd032845d2ad3.tar.gz |
libsmb: Centralize the SMB2 protocol check
Instead of checking protocol correctness in every highlevel routine,
we should rely on the lowerlevel one in smbXcli_base.c to give the
INVALID_PARAMETER error return when running on SMB1
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libcli/smb')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 29ece6a271a..aaf2d405a94 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -2997,6 +2997,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx, bool use_channel_sequence = conn->smb2.force_channel_sequence; uint16_t channel_sequence = 0; bool use_replay_flag = false; + enum protocol_types proto = smbXcli_conn_protocol(conn); req = tevent_req_create(mem_ctx, &state, struct smbXcli_req_state); @@ -3004,6 +3005,11 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx, return NULL; } + if ((proto > PROTOCOL_NONE) && (proto < PROTOCOL_SMB2_02)) { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); + return req; + } + state->ev = ev; state->conn = conn; state->session = session; |