1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2024-12-23 02:04:46 +02:00

[Web] fix ldap filter if empty

This commit is contained in:
FreddleSpl0it 2024-02-20 11:21:25 +01:00
parent 78e7266368
commit d22cafacc8
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5

View File

@ -493,11 +493,14 @@ function ldap_mbox_login($user, $pass, $iam_settings, $extra = null){
}
try {
$user_res = $iam_provider->query()
$ldap_query = $iam_provider->query()
->where($iam_settings['username_field'], '=', $user)
->whereRaw($iam_settings['filter'])
->select([$iam_settings['username_field'], $iam_settings['attribute_field'], 'displayname', 'distinguishedname'])
->firstOrFail();
->select([$iam_settings['username_field'], $iam_settings['attribute_field'], 'displayname', 'distinguishedname']);
if (!empty($iam_settings['filter'])) {
$ldap_query = $ldap_query->whereRaw($iam_settings['filter']);
}
$user_res = $ldap_query->firstOrFail();
} catch (Exception $e) {
return false;
}