Skip to content

Commit 1460720

Browse files
meetakshi253Steve French
authored andcommitted
cifs: Add client version details to NTLM authenticate message
The NTLM authenticate message currently sets the NTLMSSP_NEGOTIATE_VERSION flag but does not populate the VERSION structure. This commit fixes this bug by ensuring that the flag is set and the version details are included in the message. Signed-off-by: Meetakshi Setiya <[email protected]> Reviewed-by: Bharath SM <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 475efd9 commit 1460720

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

fs/smb/client/ntlmssp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ typedef struct _AUTHENTICATE_MESSAGE {
133133
SECURITY_BUFFER WorkstationName;
134134
SECURITY_BUFFER SessionKey;
135135
__le32 NegotiateFlags;
136-
/* SECURITY_BUFFER for version info not present since we
137-
do not set the version is present flag */
136+
struct ntlmssp_version Version;
137+
/* SECURITY_BUFFER */
138138
char UserString[];
139139
} __attribute__((packed)) AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE;
140140

fs/smb/client/sess.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,10 +1060,16 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer,
10601060
memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);
10611061
sec_blob->MessageType = NtLmAuthenticate;
10621062

1063+
/* send version information in ntlmssp authenticate also */
10631064
flags = ses->ntlmssp->server_flags | NTLMSSP_REQUEST_TARGET |
1064-
NTLMSSP_NEGOTIATE_TARGET_INFO | NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED;
1065-
/* we only send version information in ntlmssp negotiate, so do not set this flag */
1066-
flags = flags & ~NTLMSSP_NEGOTIATE_VERSION;
1065+
NTLMSSP_NEGOTIATE_TARGET_INFO | NTLMSSP_NEGOTIATE_VERSION |
1066+
NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED;
1067+
1068+
sec_blob->Version.ProductMajorVersion = LINUX_VERSION_MAJOR;
1069+
sec_blob->Version.ProductMinorVersion = LINUX_VERSION_PATCHLEVEL;
1070+
sec_blob->Version.ProductBuild = cpu_to_le16(SMB3_PRODUCT_BUILD);
1071+
sec_blob->Version.NTLMRevisionCurrent = NTLMSSP_REVISION_W2K3;
1072+
10671073
tmp = *pbuffer + sizeof(AUTHENTICATE_MESSAGE);
10681074
sec_blob->NegotiateFlags = cpu_to_le32(flags);
10691075

0 commit comments

Comments
 (0)