dotnet/runtime
GitHub で見るUnsupported LdapConnection.SessionOptions throws LdapException with Message "The LDAP server is unavailable" on Linux
Open
#84,825 opened on 2023年4月14日
area-System.DirectoryServiceshelp wanted
Repository metrics
- Stars
- (17,886 stars)
- PR merge metrics
- (平均マージ 12d 11h) (30d で 661 merged PRs)
説明
Description
Unsupported LdapConnection.SessionOptions throws LdapException with Message "The LDAP server is unavailable" on Linux. This is very misleading.
Reproduction Steps
Run this Code:
var ldapDirectoryIdentifier = new LdapDirectoryIdentifier("server", 389);
using var conn = new LdapConnection(ldapDirectoryIdentifier);
conn.SessionOptions.AutoReconnect = true;
Expected behavior
A PlatformNotSupportedExeption or NotImplementedExeption must be thrown. When getting just return null or an empty string if possible.
Actual behavior
On set or get on an unsupported property LdapException with message "The LDAP server is unavailable" is thrown on Linux. See Quick Watch below
| Name | Value | Type | |
|---|---|---|---|
| ◢ | conn.SessionOptions | {System.DirectoryServices.Protocols.LdapSessionOptions} | System.DirectoryServices.Protocols.LdapSessionOptions |
| ▶ AutoReconnect | 'conn.SessionOptions.AutoReconnect' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | bool {System.DirectoryServices.Protocols.LdapException} | |
| ▶ DomainName | 'conn.SessionOptions.DomainName' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | string {System.DirectoryServices.Protocols.LdapException} | |
| HostName | "dc02.mydomain.de:389" | string | |
| ▶ HostReachable | 'conn.SessionOptions.HostReachable' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | bool {System.DirectoryServices.Protocols.LdapException} | |
| ▶ LocatorFlag | 'conn.SessionOptions.LocatorFlag' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | System.DirectoryServices.Protocols.LocatorFlags {System.DirectoryServices.Protocols.LdapException} | |
| ▶ PingKeepAliveTimeout | 'conn.SessionOptions.PingKeepAliveTimeout' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | System.TimeSpan {System.DirectoryServices.Protocols.LdapException} | |
| ▶ PingLimit | 'conn.SessionOptions.PingLimit' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | int {System.DirectoryServices.Protocols.LdapException} | |
| ▶ PingWaitTimeout | 'conn.SessionOptions.PingWaitTimeout' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | System.TimeSpan {System.DirectoryServices.Protocols.LdapException} | |
| ProtocolVersion | 2 | int | |
| QueryClientCertificate | null | System.DirectoryServices.Protocols.QueryClientCertificateCallback | |
| ▶ ReferralCallback | {System.DirectoryServices.Protocols.ReferralCallback} | System.DirectoryServices.Protocols.ReferralCallback | |
| ReferralChasing | All | System.DirectoryServices.Protocols.ReferralChasingOptions | |
| ▶ ReferralHopLimit | 'conn.SessionOptions.ReferralHopLimit' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | int {System.DirectoryServices.Protocols.LdapException} | |
| ▶ RootDseCache | 'conn.SessionOptions.RootDseCache' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | bool {System.DirectoryServices.Protocols.LdapException} | |
| SaslMethod | "GSS-SPNEGO" | string | |
| Sealing | false | bool | |
| SecureSocketLayer | false | bool | |
| ▶ SecurityContext | {System.DirectoryServices.Protocols.SecurityHandle} | object {System.DirectoryServices.Protocols.SecurityHandle} | |
| ▶ SendTimeout | 'conn.SessionOptions.SendTimeout' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | System.TimeSpan {System.DirectoryServices.Protocols.LdapException} | |
| Signing | false | bool | |
| ▶ SslInformation | 'conn.SessionOptions.SslInformation' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | System.DirectoryServices.Protocols.SecurityPackageContextConnectionInformation {System.DirectoryServices.Protocols.LdapException} | |
| SspiFlag | 0 | int | |
| ▶ TcpKeepAlive | 'conn.SessionOptions.TcpKeepAlive' threw an exception of type 'System.DirectoryServices.Protocols.LdapException' | bool {System.DirectoryServices.Protocols.LdapException} | |
| VerifyServerCertificate | null | System.DirectoryServices.Protocols.VerifyServerCertificateCallback |
Regression?
No response
Known Workarounds
No response
Configuration
.NET 6.0.14 System.DirectoryServices.Protocols 7.0.0 Both WSL2 with Windows10 and 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
Other information
No response