| | |
| | | |
| | | if (!function_exists('ldap_connect')) |
| | | raise_error(array('code' => 100, 'type' => 'ldap', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "No ldap support in this installation of PHP"), true); |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "No ldap support in this installation of PHP"), |
| | | true, true); |
| | | |
| | | if (is_resource($this->conn)) |
| | | return true; |
| | |
| | | $bind_pass = $this->prop['bind_pass']; |
| | | $bind_user = $this->prop['bind_user']; |
| | | $bind_dn = $this->prop['bind_dn']; |
| | | $base_dn = $this->prop['base_dn']; |
| | | $this->base_dn = $this->prop['base_dn']; |
| | | |
| | | // User specific access, generate the proper values to use. |
| | | if ($this->prop['user_specific']) { |
| | |
| | | } |
| | | // Replace the bind_dn and base_dn variables. |
| | | $bind_dn = strtr($bind_dn, $replaces); |
| | | $this->base_dn = strtr($base_dn, $replaces); |
| | | $this->base_dn = strtr($this->base_dn, $replaces); |
| | | |
| | | if (empty($bind_user)) { |
| | | $bind_user = $u; |
| | |
| | | } |
| | | |
| | | if (!function_exists('ldap_sasl_bind')) { |
| | | raise_error(array( |
| | | 'code' => 100, 'type' => 'ldap', |
| | | raise_error(array('code' => 100, 'type' => 'ldap', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Unable to bind: ldap_sasl_bind() not exists"), |
| | | true, true); |
| | | true, true); |
| | | } |
| | | |
| | | if (!empty($authz)) { |
| | |
| | | |
| | | $this->_debug("S: ".ldap_error($this->conn)); |
| | | |
| | | $error = array( |
| | | 'code' => ldap_errno($this->conn), 'type' => 'ldap', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Bind failed for dn=$dn: ".ldap_error($this->conn)); |
| | | raise_error($error,true); |
| | | raise_error(array( |
| | | 'code' => ldap_errno($this->conn), 'type' => 'ldap', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Bind failed for dn=$dn: ".ldap_error($this->conn)), |
| | | true); |
| | | |
| | | return false; |
| | | } |