summaryrefslogtreecommitdiff
path: root/lib/plugins/authldap/auth.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/authldap/auth.php')
-rw-r--r--lib/plugins/authldap/auth.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php
index 6e7bde1f0..6a967a6d4 100644
--- a/lib/plugins/authldap/auth.php
+++ b/lib/plugins/authldap/auth.php
@@ -248,7 +248,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
}
// always add the default group to the list of groups
- if(!in_array($conf['defaultgroup'], $info['grps'])) {
+ if(!$info['grps'] or !in_array($conf['defaultgroup'], $info['grps'])) {
$info['grps'][] = $conf['defaultgroup'];
}
return $info;
@@ -465,7 +465,13 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
if(defined('LDAP_OPT_NETWORK_TIMEOUT')) {
ldap_set_option($this->con, LDAP_OPT_NETWORK_TIMEOUT, 1);
}
- $bound = @ldap_bind($this->con);
+
+ if($this->getConf('binddn') && $this->getConf('bindpw')) {
+ $bound = @ldap_bind($this->con, $this->getConf('binddn'), $this->getConf('bindpw'));
+ $this->bound = 2;
+ } else {
+ $bound = @ldap_bind($this->con);
+ }
if($bound) {
break;
}
@@ -496,23 +502,23 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
* @return resource
*/
protected function _ldapsearch($link_identifier, $base_dn, $filter, $scope = 'sub', $attributes = null,
- $attrsonly = 0, $sizelimit = 0, $timelimit = 0, $deref = LDAP_DEREF_NEVER) {
+ $attrsonly = 0, $sizelimit = 0) {
if(is_null($attributes)) $attributes = array();
if($scope == 'base') {
return @ldap_read(
$link_identifier, $base_dn, $filter, $attributes,
- $attrsonly, $sizelimit, $timelimit, $deref
+ $attrsonly, $sizelimit
);
} elseif($scope == 'one') {
return @ldap_list(
$link_identifier, $base_dn, $filter, $attributes,
- $attrsonly, $sizelimit, $timelimit, $deref
+ $attrsonly, $sizelimit
);
} else {
return @ldap_search(
$link_identifier, $base_dn, $filter, $attributes,
- $attrsonly, $sizelimit, $timelimit, $deref
+ $attrsonly, $sizelimit
);
}
}