diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2012-05-11 15:42:05 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2012-05-11 15:42:57 +0200 |
commit | 7efa7171e34a39e35cfb44459089fbfcaa4cfdc3 (patch) | |
tree | 2abdc9c1e85aacabbf520fbaa475db6f8251d05b /apps/user_ldap/group_ldap.php | |
parent | 3fd2e0d2cef04699d07e6f6bf5cfec93f6aabfd8 (diff) | |
download | nextcloud-server-7efa7171e34a39e35cfb44459089fbfcaa4cfdc3.tar.gz nextcloud-server-7efa7171e34a39e35cfb44459089fbfcaa4cfdc3.zip |
LDAP: wrong assumptions for case (in)sensitivity, implement far better solution
Diffstat (limited to 'apps/user_ldap/group_ldap.php')
-rwxr-xr-x | apps/user_ldap/group_ldap.php | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index 34141e51f40..168476a78ec 100755 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -47,9 +47,8 @@ class OC_GROUP_LDAP extends OC_Group_Backend { return false; } //usually, LDAP attributes are said to be case insensitive. But there are exceptions of course. - $read = ($members = OC_LDAP::readAttribute($dn_group, $this->ldapGroupMemberAssocAttr)) - || ($members = OC_LDAP::readAttribute($dn_group, strtolower($this->ldapGroupMemberAssocAttr))); - if(!$read) { + $members = OC_LDAP::readAttribute($dn_group, $this->ldapGroupMemberAssocAttr); + if(!$members) { return false; } @@ -101,11 +100,6 @@ class OC_GROUP_LDAP extends OC_Group_Backend { $this->ldapGroupMemberAssocAttr.'='.$uid )); $groups = OC_LDAP::fetchListOfGroups($filter, array(OC_LDAP::conf('ldapGroupDisplayName'),'dn')); - if(count($groups) == 0) { - //usually, LDAP attributes are said to be case insensitive. But there are exceptions... So we try it once more - $filter = str_replace($this->ldapGroupMemberAssocAttr, strtolower($this->ldapGroupMemberAssocAttr), $filter); - $groups = OC_LDAP::fetchListOfGroups($filter, array(OC_LDAP::conf('ldapGroupDisplayName'),'dn')); - } $userGroups = OC_LDAP::ownCloudGroupNames($groups); return array_unique($userGroups, SORT_LOCALE_STRING); @@ -121,10 +115,8 @@ class OC_GROUP_LDAP extends OC_Group_Backend { return array(); } - //usually, LDAP attributes are said to be case insensitive. But there are exceptions of course. - $read = ($members = OC_LDAP::readAttribute($groupDN, $this->ldapGroupMemberAssocAttr)) - || ($members = OC_LDAP::readAttribute($groupDN, strtolower($this->ldapGroupMemberAssocAttr))); - if(!$read) { + $members = OC_LDAP::readAttribute($groupDN, $this->ldapGroupMemberAssocAttr); + if(!$members) { return array(); } |