summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube_ldap.php20
-rw-r--r--program/lib/Roundcube/rcube_ldap_generic.php10
2 files changed, 21 insertions, 9 deletions
diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index 09fdde238..061e49b60 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -194,7 +194,7 @@ class rcube_ldap extends rcube_addressbook
$this->cache = $rcube->get_cache('LDAP.' . asciiwords($this->prop['name']), 'db', 600);
// initialize ldap wrapper object
- $this->prop['attributes'] = array_unique(array_merge(array_values($this->fieldmap), $fetch_attributes));
+ $this->prop['attributes'] = array_merge(array_values($this->fieldmap), $fetch_attributes);
$this->ldap = new rcube_ldap_generic($this->prop, true);
$this->ldap->set_cache($this->cache);
@@ -567,7 +567,7 @@ class rcube_ldap extends rcube_addressbook
return $group_members;
// read these attributes for all members
- $attrib = $count ? array('dn') : $this->prop['attributes'];
+ $attrib = $count ? array('dn','objectClass') : $this->prop['attributes'];
$attrib[] = 'member';
$attrib[] = 'uniqueMember';
$attrib[] = 'memberURL';
@@ -613,11 +613,11 @@ class rcube_ldap extends rcube_addressbook
// add search filter if any
$filter = $this->filter ? '(&(' . $m[3] . ')(' . $this->filter . '))' : $m[3];
- $attrs = $count ? array('dn') : $this->prop['attributes'];
+ $attrs = $count ? array('dn','objectClass') : $this->prop['attributes'];
if ($result = $this->ldap->search($m[1], $filter, $m[2], $attrs, $this->group_data)) {
$entries = $result->entries();
for ($j = 0; $j < $entries['count']; $j++) {
- if ($nested_group_members = $this->list_group_members($entries[$j]['dn'], $count))
+ if (self::is_group_entry($entries[$j]) && ($nested_group_members = $this->list_group_members($entries[$j]['dn'], $count)))
$group_members = array_merge($group_members, $nested_group_members);
else
$group_members[] = $entries[$j];
@@ -1286,7 +1286,7 @@ class rcube_ldap extends rcube_addressbook
$out[$this->primary_key] = self::dn_encode($rec['dn']);
// determine record type
- if (array_intersect(array('groupofuniquenames','kolabgroupofuniquenames'), array_map('strtolower', (array)$rec['objectclass']))) {
+ if (self::is_group_entry($rec)) {
$out['_type'] = 'group';
$out['readonly'] = true;
$fieldmap['name'] = $this->prop['groups']['name_attr'];
@@ -1408,6 +1408,16 @@ class rcube_ldap extends rcube_addressbook
return (isset($aliases[$name]) ? $aliases[$name] : $name) . $suffix;
}
+ /**
+ * Determines whether the given LDAP entry is a group record
+ */
+ private static function is_group_entry($entry)
+ {
+ return array_intersect(
+ array('group', 'groupofnames', 'kolabgroupofnames', 'groupofuniquenames','kolabgroupofuniquenames','groupofurls'),
+ array_map('strtolower', (array)$entry['objectclass'])
+ );
+ }
/**
* Prints debug info to the log
diff --git a/program/lib/Roundcube/rcube_ldap_generic.php b/program/lib/Roundcube/rcube_ldap_generic.php
index e28426a4e..451fb0c4f 100644
--- a/program/lib/Roundcube/rcube_ldap_generic.php
+++ b/program/lib/Roundcube/rcube_ldap_generic.php
@@ -835,15 +835,15 @@ class rcube_ldap_generic
// get vlv config
$vlv_config = $this->_read_vlv_config();
- if ($vlv = $this->$vlv_config[$base_dn]) {
+ if ($vlv = $vlv_config[$base_dn]) {
$this->_debug("D: Found a VLV for base_dn: " . $base_dn);
- if ($vlv['filter'] == $filter) {
+ if ($vlv['filter'] == strtolower($filter)) {
$this->_debug("D: Filter matches");
if ($vlv['scope'] == $scope) {
// Not passing any sort attributes means you don't care
if (empty($sort_attrs) || in_array($sort_attrs, $vlv['sort'])) {
- return $vlv['sort'];
+ return $vlv['sort'][0];
}
}
else {
@@ -909,7 +909,7 @@ class rcube_ldap_generic
$this->vlv_config[$vlv_search_attrs['vlvbase']] = array(
'scope' => self::scopeint2str($vlv_search_attrs['vlvscope']),
- 'filter' => $vlv_search_attrs['vlvfilter'],
+ 'filter' => strtolower($vlv_search_attrs['vlvfilter']),
'sort' => $_vlv_sort,
);
}
@@ -919,6 +919,8 @@ class rcube_ldap_generic
$this->cache->set('vlvconfig', $this->vlv_config);
$this->_debug("D: Refreshed VLV config: " . var_export($this->vlv_config, true));
+
+ return $this->vlv_config;
}