Skip to content

Commit

Permalink
Merge pull request #32499 from nextcloud/enh/noid/ldap-search-entryuu…
Browse files Browse the repository at this point in the history
…id-no-wildcard

Fix Ldap search for attributes with no substr matching rule
  • Loading branch information
blizzz authored Apr 13, 2023
2 parents eecd460 + f3cd559 commit 79013ba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -1537,14 +1537,19 @@ private function getFilterPartForSearch(string $search, $searchAttributes, strin
}
}

$originalSearch = $search;
$search = $this->prepareSearchTerm($search);
if (!is_array($searchAttributes) || count($searchAttributes) === 0) {
if ($fallbackAttribute === '') {
return '';
}
// wildcards don't work with some attributes
$filter[] = $fallbackAttribute . '=' . $originalSearch;
$filter[] = $fallbackAttribute . '=' . $search;
} else {
foreach ($searchAttributes as $attribute) {
// wildcards don't work with some attributes
$filter[] = $attribute . '=' . $originalSearch;
$filter[] = $attribute . '=' . $search;
}
}
Expand Down

0 comments on commit 79013ba

Please sign in to comment.