[Pkg-samba-maint] [samba] 08/11: CVE-2017-12151: s3:libsmb: add cli_state_is_encryption_on() helper function

Mathieu Parent sathieu at moszumanska.debian.org
Thu Sep 21 07:28:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

sathieu pushed a commit to branch jessie
in repository samba.

commit a84b80e9cf576571ae5611f7c2cff4d2546b7941
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 14 12:13:18 2017 +0200

    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 at samba.org>
---
 source3/libsmb/clientgen.c | 13 +++++++++++++
 source3/libsmb/proto.h     |  1 +
 2 files changed, 14 insertions(+)

diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 79e1392..17198b8 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -400,6 +400,19 @@ uint16_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)
 {
 	uint16_t tid = cli_state_get_tid(cli);
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index db5e874..dde3f2a 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -178,6 +178,7 @@ const char *cli_state_remote_realm(struct cli_state *cli);
 uint16_t cli_state_get_vc_num(struct cli_state *cli);
 uint16_t cli_setpid(struct cli_state *cli, uint16_t pid);
 uint16_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);
 uint16_t cli_state_get_tid(struct cli_state *cli);
 uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-samba/samba.git




More information about the Pkg-samba-maint mailing list