summaryrefslogtreecommitdiffstats
path: root/lib/Auth
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-04-18 18:09:23 +0200
committerAleksander Machniak <machniak@kolabsys.com>2014-04-18 18:09:23 +0200
commit1027d0435fdba234501a304d22a39c12f79bbe61 (patch)
treebf98fd6592e78e9b24bf99602a4cf446ff2892c1 /lib/Auth
parenteaca5181d46f5176b2215885a2dd611667d36b07 (diff)
downloadwebadmin-1027d0435fdba234501a304d22a39c12f79bbe61.tar.gz
Update to current version of Net_LDAP3
Diffstat (limited to 'lib/Auth')
-rw-r--r--lib/Auth/LDAP.php23
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index bfba321..0c03be0 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -293,7 +293,6 @@ class LDAP extends Net_LDAP3 {
foreach ($replica_hosts as $replica_host) {
$ldap = new Net_LDAP3($this->config);
$ldap->config_set("log_hook", array($this, "_log"));
- $ldap->config_set('host', $replica_host);
$ldap->config_set('hosts', array($replica_host));
$ldap->connect();
$ldap->bind($_SESSION['user']->user_bind_dn, $_SESSION['user']->user_bind_pw);
@@ -526,6 +525,7 @@ class LDAP extends Net_LDAP3 {
$this->bind($_SESSION['user']->user_bind_dn, $_SESSION['user']->user_bind_pw);
+ $root_dn = $this->config_get('root_dn');
$mail_attrs = $this->conf->get_list('mail_attributes') ?: array('mail', 'alias');
$search = array('operator' => 'OR');
@@ -536,9 +536,8 @@ class LDAP extends Net_LDAP3 {
);
}
- $this->config_set('return_attributes', $mail_attrs);
-
- $result = $this->search_entries($this->config_get('root_dn'), '(objectclass=*)', 'sub', null, $search);
+ $result = $this->search_entries($root_dn, '(objectclass=*)', 'sub', $mail_attrs,
+ array('search' => $search));
if ($result && $result->count() > 0) {
return $result->entries(true);
@@ -1079,13 +1078,11 @@ class LDAP extends Net_LDAP3 {
$attributes = array('*');
}
- $this->config_set('return_attributes', $attributes);
-
- $result = $this->search_entries($base_dn, $filter, $scope, null, $search);
+ $result = $this->search_entries($base_dn, $filter, $scope, $attributes, array('search' => $search));
$entries = $this->sort_and_slice($result, $params);
return array(
- 'list' => $entries,
+ 'list' => $entries,
'count' => is_object($result) ? $result->count() : 0,
);
}
@@ -1489,22 +1486,20 @@ class LDAP extends Net_LDAP3 {
private function _read($entry_dn, $attributes = array('*'))
{
- $this->config_set('return_attributes', $attributes);
-
- $result = $this->search($entry_dn, '(objectclass=*)', 'base');
+ $result = $this->search($entry_dn, '(objectclass=*)', 'base', $attributes);
if ($result) {
$this->_log(LOG_DEBUG, "Auth::LDAP::_read() result: " . var_export($result->entries(true), true));
return $result->entries(true);
- } else {
+ }
+ else {
return false;
}
}
private function _search($base_dn, $filter = '(objectclass=*)', $attributes = array('*'))
{
- $this->config_set('return_attributes', $attributes);
- $result = $this->search($base_dn, $filter);
+ $result = $this->search($base_dn, $filter, 'sub', $attributes);
$this->_log(LOG_DEBUG, "Auth::LDAP::_search on $base_dn with $filter for attributes: " . var_export($attributes, true) . " with result: " . var_export($result, true));
return $result;
}