summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-08 18:21:15 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-08 18:21:15 +0100
commit977e104cd423d63145e2d0e11ce4fc34c475becc (patch)
tree76a41b48600c5caabc395ba9044aef3257cffae1 /apps
parentdfbb24aa92369c3e0297e7342a15ade6073898db (diff)
parent26d0f42dac7c4d38d91cd7c8cf589808dcd40b03 (diff)
downloadnextcloud-server-977e104cd423d63145e2d0e11ce4fc34c475becc.tar.gz
nextcloud-server-977e104cd423d63145e2d0e11ce4fc34c475becc.zip
Merge pull request #21553 from owncloud/gwdg-master
Respect user enumeration
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/access.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 693a420a74d..7d2d355f9b4 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -1193,7 +1193,7 @@ class Access extends LDAPUtility implements user\IUserTools {
$searchWords = explode(' ', trim($search));
$wordFilters = array();
foreach($searchWords as $word) {
- $word .= '*';
+ $word = $this->prepareSearchTerm($word);
//every word needs to appear at least once
$wordMatchOneAttrFilters = array();
foreach($searchAttributes as $attr) {
@@ -1226,7 +1226,8 @@ class Access extends LDAPUtility implements user\IUserTools {
);
}
}
- $search = empty($search) ? '*' : $search.'*';
+
+ $search = $this->prepareSearchTerm($search);
if(!is_array($searchAttributes) || count($searchAttributes) === 0) {
if(empty($fallbackAttribute)) {
return '';
@@ -1244,6 +1245,22 @@ class Access extends LDAPUtility implements user\IUserTools {
}
/**
+ * returns the search term depending on whether we are allowed
+ * list users found by ldap with the current input appended by
+ * a *
+ * @return string
+ */
+ private function prepareSearchTerm($term) {
+ $config = \OC::$server->getConfig();
+
+ $allowEnum = $config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes');
+
+ $result = empty($term) ? '*' :
+ $allowEnum !== 'no' ? $term . '*' : $term;
+ return $result;
+ }
+
+ /**
* returns the filter used for counting users
* @return string
*/