mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-25 14:42:44 +03:00
Fixed side-effect in binary LDAP handling
- Was not stripping prefix when sending value to LDAP server in search. - Updated test to cover.
This commit is contained in:
parent
54a4c6e678
commit
01b95d91ba
@ -45,6 +45,13 @@ class LdapService extends ExternalAuthService
|
|||||||
$ldapConnection = $this->getConnection();
|
$ldapConnection = $this->getConnection();
|
||||||
$this->bindSystemUser($ldapConnection);
|
$this->bindSystemUser($ldapConnection);
|
||||||
|
|
||||||
|
// Clean attributes
|
||||||
|
foreach ($attributes as $index => $attribute) {
|
||||||
|
if (strpos($attribute, 'BIN;') === 0) {
|
||||||
|
$attributes[$index] = substr($attribute, strlen('BIN;'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find user
|
// Find user
|
||||||
$userFilter = $this->buildFilter($this->config['user_filter'], ['user' => $userName]);
|
$userFilter = $this->buildFilter($this->config['user_filter'], ['user' => $userName]);
|
||||||
$baseDn = $this->config['base_dn'];
|
$baseDn = $this->config['base_dn'];
|
||||||
|
@ -598,7 +598,7 @@ class LdapTest extends BrowserKitTest
|
|||||||
$this->mockLdap->shouldReceive('setVersion')->once();
|
$this->mockLdap->shouldReceive('setVersion')->once();
|
||||||
$this->mockLdap->shouldReceive('setOption')->times(1);
|
$this->mockLdap->shouldReceive('setOption')->times(1);
|
||||||
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(1)
|
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(1)
|
||||||
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array'))
|
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), ['cn', 'dn', 'uid', 'mail', 'cn'])
|
||||||
->andReturn(['count' => 1, 0 => [
|
->andReturn(['count' => 1, 0 => [
|
||||||
'uid' => [hex2bin('FFF8F7')],
|
'uid' => [hex2bin('FFF8F7')],
|
||||||
'cn' => [$this->mockUser->name],
|
'cn' => [$this->mockUser->name],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user