From 06a30bc92ddcbacd8c22b9320d41a4640b893fd9 Mon Sep 17 00:00:00 2001 From: Tal Aloni Date: Fri, 1 Sep 2017 18:40:53 +0300 Subject: [PATCH] NTLM: NEGOTIATE_MESSAGE: Do not include DomainName and WorkstationName if the appropriate flags are not set --- .../Authentication/NTLM/Structures/NegotiateMessage.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SMBLibrary/Authentication/NTLM/Structures/NegotiateMessage.cs b/SMBLibrary/Authentication/NTLM/Structures/NegotiateMessage.cs index 1cace34..87bd8f4 100644 --- a/SMBLibrary/Authentication/NTLM/Structures/NegotiateMessage.cs +++ b/SMBLibrary/Authentication/NTLM/Structures/NegotiateMessage.cs @@ -46,6 +46,16 @@ namespace SMBLibrary.Authentication.NTLM public byte[] GetBytes() { + if ((NegotiateFlags & NegotiateFlags.DomainNameSupplied) == 0) + { + DomainName = String.Empty; + } + + if ((NegotiateFlags & NegotiateFlags.WorkstationNameSupplied) == 0) + { + Workstation = String.Empty; + } + int fixedLength = 32; if ((NegotiateFlags & NegotiateFlags.Version) > 0) {