Skip to content

Commit a8d1dd4

Browse files
Merge branch '4.4' into 5.0
* 4.4: [FrameworkBundle] Fix session.attribute_bag service definition [Routing] Remove unused properties from the Route annotation [Routing] Add missing _locale requirements Update LdapBindAuthenticationProvider.php Add reproducer to for hit after update expire cacheItem [Cache] fix FilesystemTagAwareAdapter failing when a tag link preexists
2 parents 8f34e42 + eb95ec7 commit a8d1dd4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Authentication/Provider/LdapBindAuthenticationProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
8282
}
8383

8484
try {
85-
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
86-
8785
if ($this->queryString) {
8886
if ('' !== $this->searchDn && '' !== $this->searchPassword) {
8987
$this->ldap->bind($this->searchDn, $this->searchPassword);
9088
} else {
9189
throw new LogicException('Using the "query_string" config without using a "search_dn" and a "search_password" is not supported.');
9290
}
91+
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_FILTER);
9392
$query = str_replace('{username}', $username, $this->queryString);
9493
$result = $this->ldap->query($this->dnString, $query)->execute();
9594
if (1 !== $result->count()) {
@@ -98,6 +97,7 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
9897

9998
$dn = $result[0]->getDn();
10099
} else {
100+
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
101101
$dn = str_replace('{username}', $username, $this->dnString);
102102
}
103103

0 commit comments

Comments
 (0)