Repository navigation
Add LdapSessionOptions.CanonicalizeHostName property (#125454) - #136867
Open
Manish-1kumar wants to merge 2 commits into
Open
Manish-1kumar wants to merge 2 commits into
Manish-1kumar wants to merge 2 commits into
Conversation
Adds the CanonicalizeHostName property to LdapSessionOptions. On Linux/Unix, maps to OpenLDAP LDAP_OPT_X_SASL_NOCANON option. On Windows, returns true on get and throws PlatformNotSupportedException on set. Fixes dotnet#125454
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-directoryservices |
Passing a 32-bit Win32 BOOL into OpenLDAP ldap_set_option(ld, option, const void *invalue) causes an ABI mismatch on 64-bit platforms, notably under the Mono Interpreter where the upper 32 bits of the pointer argument slot remain uninitialized. OpenLDAP checks if (invalue == LDAP_OPT_OFF) directly against ((void *)0). By changing the interop parameter to IntPtr and passing value ? (IntPtr)1 : IntPtr.Zero, all 64 bits are cleanly cleared for false, allowing boolean option setters such as CanonicalizeHostName to properly toggle back to true/false.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #125454
Description
Adds the approved
LdapSessionOptions.CanonicalizeHostNameproperty inSystem.DirectoryServices.Protocols:LDAP_OPT_X_SASL_NOCANON(0x610b), whereLDAP_OPT_X_SASL_NOCANONset to true means canonicalization is disabled (CanonicalizeHostName == false).trueon get (Windows always canonicalizes host names) and throwsPlatformNotSupportedExceptionon set, annotated with[UnsupportedOSPlatform(windows)]on setter as approved in API review.ref/System.DirectoryServices.Protocols.cs.LdapSessionOptionsTests.cs.Customer Impact
Allows callers on Linux to disable SASL host name canonicalization when negotiating Kerberos/GSSAPI tickets with LDAP servers.
Regression
No regression; additive API approved by API review.
Testing
System.DirectoryServices.Protocols.csprojbuilds cleanly for all targets (net12.0, net12.0-windows, net12.0-linux, net12.0-osx, etc.).ref/System.DirectoryServices.Protocols.csprojbuilds cleanly for all frameworks.CanonicalizeHostName_GetReturnsTrue_SetThrowsPlatformNotSupportedException: Passed.Risk
Low; non-breaking new property matching existing patterns in
LdapSessionOptions.