Fix: better compatibility with all hostname syntax
This commit is contained in:
parent
73eba91756
commit
4767819b7a
@ -177,20 +177,10 @@ class Ldap
|
||||
if ($connected) break;
|
||||
if (empty($host)) continue;
|
||||
|
||||
if (preg_match('/^ldap/',$host))
|
||||
{
|
||||
if ($this->serverPing($host) === true) {
|
||||
$this->connection = ldap_connect($host);
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->serverPing($host, $this->serverPort) === true) {
|
||||
$this->connection = ldap_connect($host,$this->serverPort);
|
||||
}
|
||||
else continue;
|
||||
if ($this->serverPing($host, $this->serverPort) === true) {
|
||||
$this->connection = ldap_connect($host, $this->serverPort);
|
||||
}
|
||||
else continue;
|
||||
|
||||
if (is_resource($this->connection))
|
||||
{
|
||||
@ -742,6 +732,10 @@ class Ldap
|
||||
if (preg_match('/^ldaps:\/\/([^\/]+)\/?$/',$host, $regs)) {
|
||||
$host = 'ssl://'.$regs[1];
|
||||
}
|
||||
// Remove ldap://
|
||||
if (preg_match('/^ldap:\/\/([^\/]+)\/?$/',$host, $regs)) {
|
||||
$host = $regs[1];
|
||||
}
|
||||
$op = @fsockopen($host, $port, $errno, $errstr, $timeout);
|
||||
if (!$op) return false; //DC is N/A
|
||||
else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user