Escape distinguished name in ldap search (#1528)
This commit is contained in:
committed by
GitHub
parent
a50a59bbca
commit
d60e738bd2
@@ -157,7 +157,7 @@ class LdapManager
|
|||||||
|
|
||||||
return $this->driver->search(
|
return $this->driver->search(
|
||||||
$roleParameter['baseDn'],
|
$roleParameter['baseDn'],
|
||||||
sprintf('(&%s(%s=%s))', $filter, $roleParameter['userDnAttribute'], $dn),
|
sprintf('(&%s(%s=%s))', $filter, $roleParameter['userDnAttribute'], ldap_escape($dn, null, LDAP_ESCAPE_FILTER)),
|
||||||
[$roleParameter['nameAttribute']]
|
[$roleParameter['nameAttribute']]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,11 +356,11 @@ class LdapManagerTest extends TestCase
|
|||||||
'dn' => 'blub',
|
'dn' => 'blub',
|
||||||
'uid' => ['Karl-Heinz'],
|
'uid' => ['Karl-Heinz'],
|
||||||
// just some rubbish data
|
// just some rubbish data
|
||||||
'blub' => ['dfsdfsdf'],
|
'blub' => ['foo'],
|
||||||
'foo' => ['count' => 1, 'bar'],
|
'foo' => ['count' => 1, 'bar'],
|
||||||
'bar' => ['count' => 1, 'foo', 'xxx'],
|
'bar' => ['count' => 1, 'foo', 'xxx'],
|
||||||
'xxxxxxxx' => ['https://www.example.com'],
|
'xxxxxxxx' => ['https://www.example.com'],
|
||||||
'blub1' => ['dfsdfsdf'],
|
'blub1' => ['foo(bar)'],
|
||||||
],
|
],
|
||||||
'count' => 1,
|
'count' => 1,
|
||||||
],
|
],
|
||||||
@@ -376,7 +376,7 @@ class LdapManagerTest extends TestCase
|
|||||||
['ldap_value' => 'group4', 'role' => 'ROLE_SUPER_ADMIN'],
|
['ldap_value' => 'group4', 'role' => 'ROLE_SUPER_ADMIN'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'(&(memberuid=dfsdfsdf))'
|
'(&(memberuid=foo\28bar\29))'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user