Skip to content

Commit

Permalink
Set the NegotiateTargetInfo on CHALLENGE_MESSAGE; relax the check for…
Browse files Browse the repository at this point in the history
… Linux due to a bug in gss-ntlmssp
  • Loading branch information
filipnavara committed Feb 19, 2022
1 parent 78063ca commit 90620f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private byte[] GenerateChallenge(Flags flags)
// Loosely follow the flag manipulation in
// 3.2.5.1.1 Server Receives a NEGOTIATE_MESSAGE from the Client
flags &= ~(Flags.NegotiateLMKey | Flags.TargetTypeServer | Flags.TargetTypeDomain);
flags |= Flags.NegotiateNtlm | Flags.NegotiateAlwaysSign;
flags |= Flags.NegotiateNtlm | Flags.NegotiateAlwaysSign | Flags.NegotiateTargetInfo;
// Specification says to set Flags.RequestTargetName but it's valid only in NEGOTIATE_MESSAGE?!
flags |= TargetIsServer ? Flags.TargetTypeServer : Flags.TargetTypeDomain;
if (PreferUnicode && flags.HasFlag(Flags.NegotiateUnicode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ public void NtlmCorrectExchangeTest()
DoNtlmExchange(fakeNtlmServer, ntAuth);

Assert.True(fakeNtlmServer.IsAuthenticated);
// NTLMSSP on Linux doesn't send the MIC
Assert.True(fakeNtlmServer.IsMICPresent || OperatingSystem.IsLinux());
Assert.Equal("HTTP/foo", fakeNtlmServer.ClientSpecifiedSpn);
// NTLMSSP on Linux doesn't send the MIC and sends incorrect SPN (drops the service prefix)
if (!OperatingSystem.IsLinux())
{
Assert.True(fakeNtlmServer.IsMICPresent);
Assert.Equal("HTTP/foo", fakeNtlmServer.ClientSpecifiedSpn);
}
}

[ConditionalFact(nameof(IsNtlmInstalled))]
Expand Down

0 comments on commit 90620f7

Please sign in to comment.