Aleksander Machniak
2014-06-10 f67d372449a358f72c9f8d654dadda014fccf293
program/lib/Roundcube/rcube_ldap_generic.php
@@ -160,7 +160,7 @@
                $this->config['hosts'] = array($this->config['hosts']);
            foreach ($this->config['hosts'] as $host) {
                if ($this->connect($host)) {
                if (!empty($host) && $this->connect($host)) {
                    return true;
                }
            }
@@ -175,9 +175,11 @@
        $this->_debug("C: Connect to $hostname [{$this->config['name']}]");
        if ($lc = @ldap_connect($host, $this->config['port'])) {
            if ($this->config['use_tls'] === true)
                if (!ldap_start_tls($lc))
                    continue;
            if ($this->config['use_tls'] === true) {
                if (!ldap_start_tls($lc)) {
                    return false;
                }
            }
            $this->_debug("S: OK");
@@ -186,10 +188,13 @@
            $this->conn = $lc;
            if (!empty($this->config['network_timeout']))
              ldap_set_option($lc, LDAP_OPT_NETWORK_TIMEOUT, $this->config['network_timeout']);
                ldap_set_option($lc, LDAP_OPT_NETWORK_TIMEOUT, $this->config['network_timeout']);
            if (isset($this->config['referrals']))
                ldap_set_option($lc, LDAP_OPT_REFERRALS, $this->config['referrals']);
            if (isset($this->config['dereference']))
                ldap_set_option($lc, LDAP_OPT_DEREF, $this->config['dereference']);
        }
        else {
            $this->_debug("S: NOT OK");
@@ -886,9 +891,10 @@
        }
        $this->vlv_config = array();
        $config_root_dn = $this->config['config_root_dn'];
        $ldap_result = ldap_search($this->conn, $this->config['config_root_dn'], '(objectclass=vlvsearch)', array('*'), 0, 0, 0);
        $vlv_searches = new rcube_ldap_result($this->conn, $ldap_result, $this->config['config_root_dn'], '(objectclass=vlvsearch)');
        $ldap_result = ldap_search($this->conn, $config_root_dn, '(objectclass=vlvsearch)', array('*'), 0, 0, 0);
        $vlv_searches = new rcube_ldap_result($this->conn, $ldap_result, $config_root_dn, '(objectclass=vlvsearch)');
        if ($vlv_searches->count() < 1) {
            $this->_debug("D: Empty result from search for '(objectclass=vlvsearch)' on '$config_root_dn'");