From ce95c98fbbf7592b1b74127a4b87fcd607a25c1a Mon Sep 17 00:00:00 2001 From: Trivalik Date: Tue, 15 Jun 2021 21:31:51 +0200 Subject: [PATCH] catch DirectoryOperationException to check Negotiate as for LdapException (#52748) resolves https://github.com/dotnet/runtime/issues/51222 Co-authored-by: Trivalik --- .../src/System/DirectoryServices/AccountManagement/Context.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Context.cs b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Context.cs index ce5e870eea2..1947b66f588 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Context.cs +++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/Context.cs @@ -264,6 +264,10 @@ public bool Validate(string userName, string password) // we don't return false here even if we failed with ERROR_LOGON_FAILURE. We must check Negotiate // because there might be cases in which SSL fails and Negotiate succeeds } + catch (DirectoryOperationException) + { + // see LdapException + } BindLdap(networkCredential, defaultContextOptionsNegotiate); _lastBindMethod = AuthMethod.Negotiate; -- GitLab