Skip to content

Commit b7cc717

Browse files
authored
Fix empty LdapException.ServerErrorMessage (#115192)
1 parent 34fae1f commit b7cc717

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Linux.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public void StartNewTlsSessionContext()
8686
SetIntValueHelper(LdapOption.LDAP_OPT_X_TLS_NEWCTX, 0);
8787
}
8888

89+
// In practice, this apparently rarely if ever contains useful text
90+
internal string ServerErrorMessage => GetStringValueHelper(LdapOption.LDAP_OPT_ERROR_STRING, true);
91+
8992
private bool GetBoolValueHelper(LdapOption option)
9093
{
9194
if (_connection._disposed) throw new ObjectDisposedException(GetType().Name);

src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.Windows.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@ public ReferralChasingOptions ReferralChasing
5151
SetIntValueHelper(LdapOption.LDAP_OPT_REFERRALS, (int)value);
5252
}
5353
}
54+
55+
// In practice, this apparently rarely if ever contains useful text
56+
internal string ServerErrorMessage => GetStringValueHelper(LdapOption.LDAP_OPT_SERVER_ERROR, true);
5457
}
5558
}

src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,6 @@ public VerifyServerCertificateCallback VerifyServerCertificate
522522
}
523523
}
524524

525-
// In practice, this apparently rarely if ever contains useful text
526-
internal string ServerErrorMessage => GetStringValueHelper(LdapOption.LDAP_OPT_SERVER_ERROR, true);
527-
528525
internal DereferenceAlias DerefAlias
529526
{
530527
get => (DereferenceAlias)GetIntValueHelper(LdapOption.LDAP_OPT_DEREF);

0 commit comments

Comments
 (0)