From 7628bb6ba8b304b817d13db24fb192f3a6fc854b Mon Sep 17 00:00:00 2001 From: Tal Aloni Date: Sat, 30 Dec 2023 16:02:59 +0200 Subject: [PATCH] NTLM: NTLMAuthenticationClient: Store negotiate message as class variable --- .../Client/Authentication/NTLMAuthenticationClient.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SMBLibrary/Client/Authentication/NTLMAuthenticationClient.cs b/SMBLibrary/Client/Authentication/NTLMAuthenticationClient.cs index a265c35..a415039 100644 --- a/SMBLibrary/Client/Authentication/NTLMAuthenticationClient.cs +++ b/SMBLibrary/Client/Authentication/NTLMAuthenticationClient.cs @@ -18,6 +18,7 @@ namespace SMBLibrary.Client.Authentication private string m_spn; private byte[] m_sessionKey; private AuthenticationMethod m_authenticationMethod; + private byte[] m_negotiateMessageBytes; private bool m_isNegotiationMessageAcquired = false; @@ -64,18 +65,18 @@ namespace SMBLibrary.Client.Authentication useGSSAPI = true; } - byte[] negotiateMessageBytes = NTLMAuthenticationHelper.GetNegotiateMessage(m_domainName, m_userName, m_password, m_authenticationMethod); + m_negotiateMessageBytes = NTLMAuthenticationHelper.GetNegotiateMessage(m_domainName, m_userName, m_password, m_authenticationMethod); if (useGSSAPI) { SimpleProtectedNegotiationTokenInit outputToken = new SimpleProtectedNegotiationTokenInit(); outputToken.MechanismTypeList = new List(); outputToken.MechanismTypeList.Add(GSSProvider.NTLMSSPIdentifier); - outputToken.MechanismToken = negotiateMessageBytes; + outputToken.MechanismToken = m_negotiateMessageBytes; return outputToken.GetBytes(true); } else { - return negotiateMessageBytes; + return m_negotiateMessageBytes; } }