| | |
| | | $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; |
| | | } |
| | | } |
| | |
| | | $method = 'DIGEST-MD5'; |
| | | } |
| | | |
| | | $this->_debug("C: SASL Bind [mech: $method, authc: $authc, authz: $authz, pass: $pass]"); |
| | | $this->_debug("C: SASL Bind [mech: $method, authc: $authc, authz: $authz, pass: **** [" . strlen($pass) . "]"); |
| | | |
| | | if (ldap_sasl_bind($this->conn, NULL, $pass, $method, NULL, $authc, $authz)) { |
| | | $this->_debug("S: OK"); |
| | |
| | | return false; |
| | | } |
| | | |
| | | $this->_debug("C: Bind $dn [pass: $pass]"); |
| | | $this->_debug("C: Bind $dn, pass: **** [" . strlen($pass) . "]"); |
| | | |
| | | if (@ldap_bind($this->conn, $dn, $pass)) { |
| | | $this->_debug("S: OK"); |
| | |
| | | * Turn an LDAP entry into a regular PHP array with attributes as keys. |
| | | * |
| | | * @param array $entry Attributes array as retrieved from ldap_get_attributes() or ldap_get_entries() |
| | | * |
| | | * @return array Hash array with attributes as keys |
| | | */ |
| | | public static function normalize_entry($entry) |
| | | { |
| | | if (!isset($entry['count'])) { |
| | | return $entry; |
| | | } |
| | | |
| | | $rec = array(); |
| | | |
| | | for ($i=0; $i < $entry['count']; $i++) { |
| | | $attr = $entry[$i]; |
| | | if ($entry[$attr]['count'] == 1) { |