| | |
| | | $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; |
| | | } |
| | | } |
| | |
| | | $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"); |
| | | |
| | |
| | | $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"); |
| | |
| | | } |
| | | |
| | | $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'"); |