Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
45443ee2
Commit
45443ee2
authored
Dec 08, 2014
by
Arthur Schiwon
Browse files
preserve an asterisk at the start when escaping a search term
parent
1362c0b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
apps/user_ldap/lib/access.php
View file @
45443ee2
...
...
@@ -1087,10 +1087,15 @@ class Access extends LDAPUtility implements user\IUserTools {
* @param string $input, the provided value
* @return string the escaped string
*/
public
function
escapeFilterPart
(
$input
)
{
public
function
escapeFilterPart
(
$input
,
$allowAsterisk
=
false
)
{
$asterisk
=
''
;
if
(
$allowAsterisk
&&
strlen
(
$input
)
>
0
&&
$input
[
0
]
===
'*'
)
{
$asterisk
=
'*'
;
$input
=
mb_substr
(
$input
,
1
,
null
,
'UTF-8'
);
}
$search
=
array
(
'*'
,
'\\'
,
'('
,
')'
);
$replace
=
array
(
'\\*'
,
'\\\\'
,
'\\('
,
'\\)'
);
return
str_replace
(
$search
,
$replace
,
$input
);
return
$asterisk
.
str_replace
(
$search
,
$replace
,
$input
);
}
/**
...
...
apps/user_ldap/user_ldap.php
View file @
45443ee2
...
...
@@ -93,7 +93,7 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
* Get a list of all users.
*/
public
function
getUsers
(
$search
=
''
,
$limit
=
10
,
$offset
=
0
)
{
$search
=
$this
->
access
->
escapeFilterPart
(
$search
);
$search
=
$this
->
access
->
escapeFilterPart
(
$search
,
true
);
$cachekey
=
'getUsers-'
.
$search
.
'-'
.
$limit
.
'-'
.
$offset
;
//check if users are cached, if so return
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment