summaryrefslogtreecommitdiff
path: root/lib/plugins/authldap/auth.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2014-02-14 09:49:55 +0100
committerAndreas Gohr <andi@splitbrain.org>2014-02-14 11:57:47 +0100
commit9f72d639a21d95cbc5fb211dc4e9bc0584efb0c5 (patch)
tree3ffb7a346690453e59ed5c64f17b0ff4773da59f /lib/plugins/authldap/auth.php
parentfcceebc15bef73a680d6051ddfd097fd8ee9737e (diff)
downloadrpg-9f72d639a21d95cbc5fb211dc4e9bc0584efb0c5.tar.gz
rpg-9f72d639a21d95cbc5fb211dc4e9bc0584efb0c5.tar.bz2
authldap: handle bad groupkey gracefully
Diffstat (limited to 'lib/plugins/authldap/auth.php')
-rw-r--r--lib/plugins/authldap/auth.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php
index 98858cb40..94f3be8d2 100644
--- a/lib/plugins/authldap/auth.php
+++ b/lib/plugins/authldap/auth.php
@@ -241,10 +241,17 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
ldap_free_result($sr);
if(is_array($result)) foreach($result as $grp) {
- if(!empty($grp[$this->getConf('groupkey')][0])) {
- $groupkey = (is_array($grp[$this->getConf('groupkey')][0])) ? $grp[$this->getConf('groupkey')][0] : $grp[$this->getConf('groupkey')];
- $this->_debug('LDAP usergroup: '.htmlspecialchars($groupkey), 0, __LINE__, __FILE__);
- $info['grps'][] = $groupkey;
+ if(!empty($grp[$this->getConf('groupkey')])) {
+ $group = $grp[$this->getConf('groupkey')];
+ if(is_array($group)){
+ $group = $group[0];
+ } else {
+ $this->_debug('groupkey did not return a detailled result', 0, __LINE__, __FILE__);
+ }
+ if($group === '') continue;
+
+ $this->_debug('LDAP usergroup: '.htmlspecialchars($group), 0, __LINE__, __FILE__);
+ $info['grps'][] = $group;
}
}
}