Skip to content

Commit

Permalink
Escape DN value before using it in a search
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot committed Oct 29, 2024
1 parent cebbde4 commit 190537a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Ltb/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ function get_first_value($ldap_base, $ldap_scope, $ldap_filter, $attribute): str
public function matchDn($dn, $dnAttribute, $filter, $base, $scope): bool {

# Build filter
$search_filter = '(&' . $filter . '(' . $dnAttribute . '=' . $dn .'))';
$dn_escape = ldap_escape($dn, "", LDAP_ESCAPE_FILTER);
$search_filter = '(&' . $filter . '(' . $dnAttribute . '=' . $dn_escape .'))';

# Search with scope
$search = $this->search_with_scope($scope, $base, $search_filter, ['1.1']);
Expand Down

0 comments on commit 190537a

Please sign in to comment.