Skip to content

Commit c50346d

Browse files
committed
http.sys: Fix definition of HTTP_SERVER_AUTHENTICATION_INFO
Previous definition of this structure had improper declarations for the `ReceiveMutualAuth`, `ReceiveContextHandle`, DisableNTLMCredentialCaching` and `ExFlags` fields. In the native version of the structure, these fields are byte-sized (they are either BOOLEAN or UCHAR, and BOOLEAN is defined as "typedef BYTE BOOLEAN" in winnt.h). The previous version of the interop structure declared them as `bool` or `ulong`. In turn, that was causing improper structure marshalling and an invalid (larger) structure size passed to HttpSetUrlGroupProperty(). Perhaps, this hasn't been noticed so far because the actual code only fills in the `AuthSchemes` field that occurs earlier in the struct layout. And perhaps the HttpSetUrlGroupProperty() function currently can accept the larger structure sizes (for future compatibility), so it hasn't been returning an error. Fix this issue by redeclaring all those fields as `byte`. Note that we don't anything fancier like `[MarshalAs(UnmanagedType.U1)] bool` to be consistent with other existing declarations of BOOLEAN fields, for example in the existing definition of HTTP_SSL_CLIENT_CERT_INFO. For reference, this is the definition of the structure in http.h: ``` typedef struct _HTTP_SERVER_AUTHENTICATION_INFO { HTTP_PROPERTY_FLAGS Flags; ULONG AuthSchemes; BOOLEAN ReceiveMutualAuth; BOOLEAN ReceiveContextHandle; BOOLEAN DisableNTLMCredentialCaching; UCHAR ExFlags; HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS DigestParams; HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS BasicParams; } HTTP_SERVER_AUTHENTICATION_INFO; ```
1 parent dccbaba commit c50346d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Shared/HttpSys/NativeInterop/HttpApiTypes.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,10 +599,10 @@ internal struct HTTP_SERVER_AUTHENTICATION_INFO
599599
{
600600
internal HTTP_FLAGS Flags;
601601
internal HTTP_AUTH_TYPES AuthSchemes;
602-
internal bool ReceiveMutualAuth;
603-
internal bool ReceiveContextHandle;
604-
internal bool DisableNTLMCredentialCaching;
605-
internal ulong ExFlags;
602+
internal byte ReceiveMutualAuth;
603+
internal byte ReceiveContextHandle;
604+
internal byte DisableNTLMCredentialCaching;
605+
internal byte ExFlags;
606606
HTTP_SERVER_AUTHENTICATION_DIGEST_PARAMS DigestParams;
607607
HTTP_SERVER_AUTHENTICATION_BASIC_PARAMS BasicParams;
608608
}

0 commit comments

Comments
 (0)