-
Notifications
You must be signed in to change notification settings - Fork 165
ldap: Fix autodiscovery for Active Directory #86
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
base: develop
Are you sure you want to change the base?
ldap: Fix autodiscovery for Active Directory #86
Conversation
This patch adds support for automatically discovering the closest domain controller (LDAP server) by asynchronously connecting to all domain controllers advertised in DNS, sorted by priority and weight, in parallel and using the first server to respond. The protocol is described by Microsoft at https://technet.microsoft.com/en-us/library/cc978016.aspx
72a39e8
to
39d1cb2
Compare
auth-ldap/authentication.php
Outdated
$sockets = array(); | ||
reset($servers); | ||
$closest = null; | ||
$loops = 60; # 6 seconds max |
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.
Actually, with 2ms loop timing, this is 120ms (which is probably a long enough delay)
auth-ldap/authentication.php
Outdated
if (!in_array($error, array(SOCKET_EINPROGRESS, SOCKET_EALREADY))) { | ||
// Bad mojo | ||
socket_close($sk); | ||
unset($sockets,$i); |
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.
unset($sockets[$i]);
@greezybacon: What is the status of this feature/pr several years after? |
There are a couple problems with the current autodiscover protocol in the plugin:
This patch adds support for automatically discovering the closest domain controller (LDAP server) by asynchronously connecting to all domain controllers advertised in DNS, sorted by priority and weight, in parallel and using the first server to respond.
The protocol is described by Microsoft at
https://technet.microsoft.com/en-us/library/cc978016.aspx