From b4a69d9a0abda9619331b40e2fca54c8ade7676c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 6 Oct 2014 14:19:39 +0200 Subject: [PATCH] libcli/smb: fix smb2cli_validate_negotiate_info with min=PROTOCOL_NT1 max=PROTOCOL_SMB2_02 If the connection starts with a SMB Negprot, the server only implies the selected dialect, but not the clients security mode. Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Bug: https://bugzilla.samba.org/show_bug.cgi?id=10866 (cherry picked from commit 3eef853f741d9349e45a1a87e453c52bf56c4774) --- libcli/smb/smbXcli_base.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index ac81f7a..8a8bbd0 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -4649,7 +4649,11 @@ struct tevent_req *smb2cli_validate_negotiate_info_send(TALLOC_CTX *mem_ctx, } else { memset(buf+4, 0, 16); /* ClientGuid */ } - SCVAL(buf, 20, conn->smb2.client.security_mode); + if (state->conn->min_protocol >= PROTOCOL_SMB2_02) { + SCVAL(buf, 20, conn->smb2.client.security_mode); + } else { + SCVAL(buf, 20, 0); + } SCVAL(buf, 21, 0); /* reserved */ for (i=0; i < ARRAY_SIZE(smb2cli_prots); i++) { -- 1.9.1