diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index e432395e3e922a..fa79e2845b4dad 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -18,6 +18,7 @@ public static partial class PlatformDetection public static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); public static bool IsOpenSUSE => IsDistroAndVersion("opensuse"); public static bool IsUbuntu => IsDistroAndVersion("ubuntu"); + public static bool IsUbuntu26 => IsDistroAndVersion("ubuntu", 26); public static bool IsUbuntu24 => IsDistroAndVersion("ubuntu", 24); public static bool IsUbuntu24OrHigher => IsDistroAndVersionOrHigher("ubuntu", 24); public static bool IsDebian => IsDistroAndVersion("debian"); diff --git a/src/libraries/System.Net.Security/tests/UnitTests/NegotiateAuthenticationTests.cs b/src/libraries/System.Net.Security/tests/UnitTests/NegotiateAuthenticationTests.cs index fbb75382a44782..433c3dfe269ae6 100644 --- a/src/libraries/System.Net.Security/tests/UnitTests/NegotiateAuthenticationTests.cs +++ b/src/libraries/System.Net.Security/tests/UnitTests/NegotiateAuthenticationTests.cs @@ -17,13 +17,23 @@ namespace System.Net.Security.Tests { public class NegotiateAuthenticationTests { - private static bool IsNtlmAvailable => Capability.IsNtlmInstalled() || OperatingSystem.IsAndroid() || OperatingSystem.IsTvOS(); + // Ubuntu 24 and 26 ship with broekn gss-ntlmssp 1.2 + private static bool UseManagedNtlm => PlatformDetection.IsUbuntu24 || PlatformDetection.IsUbuntu26; + private static bool IsNtlmAvailable => UseManagedNtlm || Capability.IsNtlmInstalled() || OperatingSystem.IsAndroid() || OperatingSystem.IsTvOS(); private static bool IsNtlmUnavailable => !IsNtlmAvailable; private static NetworkCredential s_testCredentialRight = new NetworkCredential("rightusername", "rightpassword"); private static NetworkCredential s_testCredentialWrong = new NetworkCredential("rightusername", "wrongpassword"); private static readonly byte[] s_Hello = "Hello"u8.ToArray(); + static NegotiateAuthenticationTests() + { + if (UseManagedNtlm) + { + AppContext.SetSwitch("System.Net.Security.UseManagedNtlm", true); + } + } + [Fact] public void Constructor_Overloads_Validation() { @@ -85,7 +95,6 @@ public void Package_Supported_NTLM() } [ConditionalFact(nameof(IsNtlmUnavailable))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/111639", typeof(PlatformDetection), nameof(PlatformDetection.IsUbuntu24OrHigher))] public void Package_Unsupported_NTLM() { NegotiateAuthenticationClientOptions clientOptions = new NegotiateAuthenticationClientOptions { Package = "NTLM", Credential = s_testCredentialRight, TargetName = "HTTP/foo" };