tls support for ldap, use "tls://host" instead of hostname

This commit is contained in:
Ralf Becker 2010-08-26 20:30:01 +00:00
parent f91095f2ec
commit ff867f4daf

View File

@ -105,6 +105,10 @@ class ldap
$passwd = $GLOBALS['egw_info']['server']['ldap_root_pw']; $passwd = $GLOBALS['egw_info']['server']['ldap_root_pw'];
} }
if (($use_tls = substr($host,0,6) == 'tls://'))
{
$host = parse_url($host,PHP_URL_HOST);
}
// connects to ldap server // connects to ldap server
if(!$this->ds = ldap_connect($host)) if(!$this->ds = ldap_connect($host))
{ {
@ -128,6 +132,7 @@ class ldap
{ {
$supportedLDAPVersion = 2; $supportedLDAPVersion = 2;
} }
if ($use_tls) ldap_start_tls($this->ds);
if(!isset($this->ldapServerInfo[$host])) if(!isset($this->ldapServerInfo[$host]))
{ {
@ -255,6 +260,7 @@ class ldap
$this->ldapServerInfo = (array) unserialize($GLOBALS['egw']->session->appsession('ldapServerInfo')); $this->ldapServerInfo = (array) unserialize($GLOBALS['egw']->session->appsession('ldapServerInfo'));
} }
} }
/** /**
* save the session data * save the session data
*/ */