allow to specify a port with tls too: "tls://host[:port]/" or "ldaps://host[:port]/" or "ldap://host[:port]/" or just "host"

This commit is contained in:
Ralf Becker 2012-03-01 13:09:35 +00:00
parent ef21cdae30
commit 68b5c2d204

View File

@ -16,8 +16,8 @@
* LDAP connection handling
*
* Please note for SSL or TLS connections hostname has to be:
* - SSL: "ldaps://host"
* - TLS: "tls://host"
* - SSL: "ldaps://host[:port]/"
* - TLS: "tls://host[:port]/"
* Both require certificats installed on the webserver, otherwise the connection will fail!
*/
class ldap
@ -112,10 +112,11 @@ class ldap
if (($use_tls = substr($host,0,6) == 'tls://'))
{
$port = parse_url($host,PHP_URL_PORT);
$host = parse_url($host,PHP_URL_HOST);
}
// connects to ldap server
if(!$this->ds = ldap_connect($host))
if(!$this->ds = ldap_connect($host, $port))
{
/* log does not exist in setup(, yet) */
if(isset($GLOBALS['egw']->log))