From 81e1058e20bcfc1efab2b39dd7642d8dbbe0cb3b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Aug 2013 10:44:34 -0700 Subject: As SMB3 has transport level encryption, allow smbclient -e to force encryted SMB3 transport. Signed-off-by: Jeremy Allison Reviewed-by: Michael Adam --- source3/libsmb/clidfs.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 1d92843f48..57126e6233 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -48,7 +48,23 @@ NTSTATUS cli_cm_force_encryption(struct cli_state *c, const char *domain, const char *sharename) { - NTSTATUS status = cli_force_encryption(c, + NTSTATUS status; + + if (smbXcli_conn_protocol(c->conn) >= PROTOCOL_SMB2_02) { + status = smb2cli_session_encryption_on(c->smb2.session); + if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_SUPPORTED)) { + d_printf("Encryption required and " + "server doesn't support " + "SMB3 encryption - failing connect\n"); + } else if (!NT_STATUS_IS_OK(status)) { + d_printf("Encryption required and " + "setup failed with error %s.\n", + nt_errstr(status)); + } + return status; + } + + status = cli_force_encryption(c, username, password, domain); -- cgit