Skip to content

Commit eb95ec7

Browse files
Merge branch '3.4' into 4.4
* 3.4: [FrameworkBundle] Fix session.attribute_bag service definition Update LdapBindAuthenticationProvider.php
2 parents b137b15 + d8d0624 commit eb95ec7

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
@@ -83,14 +83,13 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
8383
}
8484

8585
try {
86-
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
87-
8886
if ($this->queryString) {
8987
if ('' !== $this->searchDn && '' !== $this->searchPassword) {
9088
$this->ldap->bind($this->searchDn, $this->searchPassword);
9189
} else {
9290
@trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', E_USER_DEPRECATED);
9391
}
92+
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_FILTER);
9493
$query = str_replace('{username}', $username, $this->queryString);
9594
$result = $this->ldap->query($this->dnString, $query)->execute();
9695
if (1 !== $result->count()) {
@@ -99,6 +98,7 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
9998

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

0 commit comments

Comments
 (0)