-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Background and motivation
OpenLDAP offers the possibility to configure whether to perform reverse DNS lookups to canonicalize SASL host names.
This can be configured with the SASL_NOCANON option of the LDAP configuration or the LDAP_OPT_X_SASL_NOCANON option of the API.
Configuring this option can be useful, for example to workaround misconfigured DNS PTR records, as explained in ldapsearch command suddenly stopped working on my Mac on Super User.
This option is unfortunately not exposed on the LdapSessionOptions class.
API Proposal
namespace System.DirectoryServices.Protocols;
public class LdapSessionOptions
{
public bool CanonicalizeHostName { get; set; }
}API Usage
using var connection = new LdapConnection(ldapHost);
connection.SessionOptions.CanonicalizeHostName = false;Alternative Designs
I can't think of an alternative design for exposing this new property.
Also note that the implementation would be straightforward:
public bool CanonicalizeHostName
{
get => !GetBoolValueHelper(LdapOption.LDAP_OPT_X_SASL_NOCANON);
set => SetBoolValueHelper(LdapOption.LDAP_OPT_X_SASL_NOCANON, !value);
}It would require moving the GetBoolValueHelper and SetBoolValueHelper from LdapSessionOptions.Linux.cs into LdapSessionOptions.cs and define the new LDAP_OPT_X_SASL_NOCANON enum value (0x610b).
Risks
No risks are associated by introducing this new property. It's purely additional and without getting it or setting it nothing would happen.