Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
977e104c
Commit
977e104c
authored
9 years ago
by
Thomas Müller
Browse files
Options
Downloads
Plain Diff
Merge pull request #21553 from owncloud/gwdg-master
Respect user enumeration
parents
dfbb24aa
26d0f42d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/user_ldap/lib/access.php
+19
-2
19 additions, 2 deletions
apps/user_ldap/lib/access.php
with
19 additions
and
2 deletions
apps/user_ldap/lib/access.php
+
19
−
2
View file @
977e104c
...
@@ -1193,7 +1193,7 @@ class Access extends LDAPUtility implements user\IUserTools {
...
@@ -1193,7 +1193,7 @@ class Access extends LDAPUtility implements user\IUserTools {
$searchWords
=
explode
(
' '
,
trim
(
$search
));
$searchWords
=
explode
(
' '
,
trim
(
$search
));
$wordFilters
=
array
();
$wordFilters
=
array
();
foreach
(
$searchWords
as
$word
)
{
foreach
(
$searchWords
as
$word
)
{
$word
.
=
'*'
;
$word
=
$this
->
prepareSearchTerm
(
$word
)
;
//every word needs to appear at least once
//every word needs to appear at least once
$wordMatchOneAttrFilters
=
array
();
$wordMatchOneAttrFilters
=
array
();
foreach
(
$searchAttributes
as
$attr
)
{
foreach
(
$searchAttributes
as
$attr
)
{
...
@@ -1226,7 +1226,8 @@ class Access extends LDAPUtility implements user\IUserTools {
...
@@ -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
(
!
is_array
(
$searchAttributes
)
||
count
(
$searchAttributes
)
===
0
)
{
if
(
empty
(
$fallbackAttribute
))
{
if
(
empty
(
$fallbackAttribute
))
{
return
''
;
return
''
;
...
@@ -1243,6 +1244,22 @@ class Access extends LDAPUtility implements user\IUserTools {
...
@@ -1243,6 +1244,22 @@ class Access extends LDAPUtility implements user\IUserTools {
return
$this
->
combineFilterWithOr
(
$filter
);
return
$this
->
combineFilterWithOr
(
$filter
);
}
}
/**
* 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
* returns the filter used for counting users
* @return string
* @return string
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment