mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-22 17:25:54 +02:00
NTLM: NTLMAuthenticationClient: Store negotiate message as class variable
This commit is contained in:
parent
08748d3337
commit
7628bb6ba8
1 changed files with 4 additions and 3 deletions
|
@ -18,6 +18,7 @@ namespace SMBLibrary.Client.Authentication
|
||||||
private string m_spn;
|
private string m_spn;
|
||||||
private byte[] m_sessionKey;
|
private byte[] m_sessionKey;
|
||||||
private AuthenticationMethod m_authenticationMethod;
|
private AuthenticationMethod m_authenticationMethod;
|
||||||
|
private byte[] m_negotiateMessageBytes;
|
||||||
|
|
||||||
private bool m_isNegotiationMessageAcquired = false;
|
private bool m_isNegotiationMessageAcquired = false;
|
||||||
|
|
||||||
|
@ -64,18 +65,18 @@ namespace SMBLibrary.Client.Authentication
|
||||||
useGSSAPI = true;
|
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)
|
if (useGSSAPI)
|
||||||
{
|
{
|
||||||
SimpleProtectedNegotiationTokenInit outputToken = new SimpleProtectedNegotiationTokenInit();
|
SimpleProtectedNegotiationTokenInit outputToken = new SimpleProtectedNegotiationTokenInit();
|
||||||
outputToken.MechanismTypeList = new List<byte[]>();
|
outputToken.MechanismTypeList = new List<byte[]>();
|
||||||
outputToken.MechanismTypeList.Add(GSSProvider.NTLMSSPIdentifier);
|
outputToken.MechanismTypeList.Add(GSSProvider.NTLMSSPIdentifier);
|
||||||
outputToken.MechanismToken = negotiateMessageBytes;
|
outputToken.MechanismToken = m_negotiateMessageBytes;
|
||||||
return outputToken.GetBytes(true);
|
return outputToken.GetBytes(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return negotiateMessageBytes;
|
return m_negotiateMessageBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue