Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/user_ldap/lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ public function setConfiguration(array $config, ?array &$applied = null): void {

$setMethod = 'setValue';
switch ($key) {
case 'ldapAgentName':
case 'ldapAgentPassword':
$val = \filter_var($val, FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_LOW);
$setMethod = 'setRawValue';
break;
case 'homeFolderNamingRule':
Expand Down
4 changes: 4 additions & 0 deletions apps/user_ldap/tests/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public static function configurationDataProvider(): array {

$password = ' such a passw0rd ';

$dnWithCrlf = "cn=admin\r\nset foo bar\r\n,dc=example,dc=org";
$expectedDn = 'cn=adminset foo bar,dc=example,dc=org';

return [
'set general base' => ['ldapBase', $inputWithDN, $expectWithDN],
'set user base' => ['ldapBaseUsers', $inputWithDN, $expectWithDN],
Expand All @@ -69,6 +72,7 @@ public static function configurationDataProvider(): array {
'set login filter attributes' => ['ldapLoginFilterAttributes', $inputNames, $expectedNames],

'set agent password' => ['ldapAgentPassword', $password, $password],
'set agent name strips CRLF' => ['ldapAgentName', $dnWithCrlf, $expectedDn],

'set home folder, variant 1' => ['homeFolderNamingRule', $inputHomeFolder[0], $expectedHomeFolder[0]],
'set home folder, variant 2' => ['homeFolderNamingRule', $inputHomeFolder[1], $expectedHomeFolder[1]],
Expand Down
Loading