Skip to content

Commit a898099

Browse files
committed
Always set NTLMSSP_NEGOTIATE_VERSION
Setting the NTLMSSP_NEGOTIATE_VERSION flag makes most clients generate a MIC correctly, while lack of version causes some clients to omit a required empty version struct on the wire, which in turn causes MIC checks to fail. Signed-off-by: Simo Sorce <[email protected]>
1 parent fde4878 commit a898099

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Diff for: src/gss_ntlmssp.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
NTLMSSP_NEGOTIATE_NTLM | \
1919
NTLMSSP_REQUEST_TARGET | \
2020
NTLMSSP_NEGOTIATE_OEM | \
21-
NTLMSSP_NEGOTIATE_UNICODE)
21+
NTLMSSP_NEGOTIATE_UNICODE | \
22+
NTLMSSP_NEGOTIATE_VERSION)
2223

2324
#define NTLMSSP_DEFAULT_SERVER_FLAGS ( \
2425
NTLMSSP_NEGOTIATE_ALWAYS_SIGN | \

Diff for: src/gss_sec_ctx.c

+12
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,18 @@ uint32_t gssntlm_accept_sec_context(uint32_t *minor_status,
673673

674674
/* leave only the crossing between requested and allowed flags */
675675
ctx->neg_flags &= in_flags;
676+
677+
/* Try to force the use of NTLMSSP_NEGOTIATE_VERSION even if the
678+
* client did not advertize it in their negotiate message, but
679+
* should be capable of providing it.
680+
* This is what Windows Server 2022 also does, and addresses
681+
* issues with older clients that incorrectly deal with MIC
682+
* calculations in absence of this flag. */
683+
if ((ctx->neg_flags & (NTLMSSP_NEGOTIATE_ALWAYS_SIGN |
684+
NTLMSSP_NEGOTIATE_SEAL |
685+
NTLMSSP_NEGOTIATE_SIGN))) {
686+
ctx->neg_flags |= NTLMSSP_NEGOTIATE_VERSION;
687+
}
676688
} else {
677689
/* If there is no negotiate message set datagram mode */
678690
ctx->neg_flags |= NTLMSSP_NEGOTIATE_DATAGRAM | \

0 commit comments

Comments
 (0)