Update ldap.class.php

This commit is contained in:
Laurent Destailleur
2018-03-19 12:37:53 +01:00
committed by GitHub
parent 890d0b6685
commit eb7886ecff

View File

@@ -739,8 +739,7 @@ class Ldap
function serverPing($host, $port=389, $timeout=1) function serverPing($host, $port=389, $timeout=1)
{ {
// Replace ldaps:// by ssl:// // Replace ldaps:// by ssl://
if (preg_match('/^ldaps/',$host)) { if (preg_match('/^ldaps:\/\/([^\/]+)\/?$/',$host, $regs)) {
preg_match('/^ldaps:\/\/([^\/]+)\/?$/', $host, $regs);
$host = 'ssl://'.$regs[1]; $host = 'ssl://'.$regs[1];
} }
$op = @fsockopen($host, $port, $errno, $errstr, $timeout); $op = @fsockopen($host, $port, $errno, $errstr, $timeout);