-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Change LoadDomainInfo to honor requested LDAP port #89787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change LoadDomainInfo to honor requested LDAP port #89787
Conversation
dotnet#65894 LoadDomainInfo builds an LDAP Uri that ignores the requested port. If LDAPS/636 is requested, traffic still goes to 389 for this request.
Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 Issue DetailsLoadDomainInfo builds an LDAP Uri that ignores the requested port. If LDAPS/636 is requested, traffic still goes to 389 for this request. For environments where port 389 is blocked, this causes calls such as GroupPrincipal.GetMembers() to fail. This PR will use the specified port for the call, 389 if no port is specified, or 636 if LDAPS is specified.
|
Fixing CA1311
PTAL @jay98014 and @kumarravi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have validated this PR on my local set up and made sure this fixes the issue, hence approving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving based on approval from @kumarravik78c
|
||
// Pull the requested port number | ||
Uri ldapUri = new Uri(this.ctxBase.Path); | ||
int port = ldapUri.Port != -1 ? ldapUri.Port : (ldapUri.Scheme.ToUpperInvariant() == "LDAPS" ? 636 : 389); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String.Equals(..., StringComparison.OrdinalIgnoreCase) avoids an unnecessary allocation.
Fixes #65894
LoadDomainInfo builds an LDAP Uri that ignores the requested port. If LDAPS/636 is requested, traffic still goes to 389 for this request. For environments where port 389 is blocked, this causes calls such as GroupPrincipal.GetMembers() to fail when the group is Domain Local or Universal. We do not seem to call LoadDomainInfo for Global groups.
This PR will use the specified port for the call, 389 if no port is specified, or 636 if LDAPS is specified.