mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-25 02:18:16 +02:00
NTLM: CHALLENGE_MESSAGE: Do not include TargetName and TargetInfo if the appropriate flags are not set
This commit is contained in:
parent
06a30bc92d
commit
adcb576976
1 changed files with 10 additions and 1 deletions
|
@ -48,12 +48,21 @@ namespace SMBLibrary.Authentication.NTLM
|
||||||
|
|
||||||
public byte[] GetBytes()
|
public byte[] GetBytes()
|
||||||
{
|
{
|
||||||
|
if ((NegotiateFlags & NegotiateFlags.TargetNameSupplied) == 0)
|
||||||
|
{
|
||||||
|
TargetName = String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((NegotiateFlags & NegotiateFlags.TargetInfo) == 0)
|
||||||
|
{
|
||||||
|
TargetInfo = new byte[0];
|
||||||
|
}
|
||||||
|
|
||||||
int fixedLength = 48;
|
int fixedLength = 48;
|
||||||
if ((NegotiateFlags & NegotiateFlags.Version) > 0)
|
if ((NegotiateFlags & NegotiateFlags.Version) > 0)
|
||||||
{
|
{
|
||||||
fixedLength += 8;
|
fixedLength += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
int payloadLength = TargetName.Length * 2 + TargetInfo.Length;
|
int payloadLength = TargetName.Length * 2 + TargetInfo.Length;
|
||||||
byte[] buffer = new byte[fixedLength + payloadLength];
|
byte[] buffer = new byte[fixedLength + payloadLength];
|
||||||
ByteWriter.WriteAnsiString(buffer, 0, AuthenticateMessage.ValidSignature, 8);
|
ByteWriter.WriteAnsiString(buffer, 0, AuthenticateMessage.ValidSignature, 8);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue