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

CVE-2017-12151: s3:libsmb: add cli_state_is_encryption_on() helper function

This allows to check if the current cli_state uses encryption
(either via unix extentions or via SMB3).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12996

Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Stefan Metzmacher 2017-08-14 12:13:18 +02:00 committed by Karolin Seeger
parent ee4418e73f
commit ace72741ad
2 changed files with 14 additions and 0 deletions

View File

@ -321,6 +321,19 @@ uint32_t cli_getpid(struct cli_state *cli)
return cli->smb1.pid;
}
bool cli_state_is_encryption_on(struct cli_state *cli)
{
if (smbXcli_conn_protocol(cli->conn) < PROTOCOL_SMB2_02) {
return smb1cli_conn_encryption_on(cli->conn);
}
if (cli->smb2.tcon == NULL) {
return false;
}
return smb2cli_tcon_is_encryption_on(cli->smb2.tcon);
}
bool cli_state_has_tcon(struct cli_state *cli)
{
uint32_t tid;

View File

@ -200,6 +200,7 @@ void cli_shutdown(struct cli_state *cli);
uint16_t cli_state_get_vc_num(struct cli_state *cli);
uint32_t cli_setpid(struct cli_state *cli, uint32_t pid);
uint32_t cli_getpid(struct cli_state *cli);
bool cli_state_is_encryption_on(struct cli_state *cli);
bool cli_state_has_tcon(struct cli_state *cli);
uint32_t cli_state_get_tid(struct cli_state *cli);
uint32_t cli_state_set_tid(struct cli_state *cli, uint32_t tid);