1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-01-02 03:38:23 +02:00

[Web] check if $iam_provider is null on ldap_mbox_login

This commit is contained in:
FreddleSpl0it 2024-10-09 12:34:39 +02:00
parent 0b9b8c9060
commit f9304dcd9b
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5

View File

@ -2,7 +2,7 @@
function check_login($user, $pass, $app_passwd_data = false, $extra = null) { function check_login($user, $pass, $app_passwd_data = false, $extra = null) {
global $pdo; global $pdo;
global $redis; global $redis;
$is_internal = $extra['is_internal']; $is_internal = $extra['is_internal'];
$role = $extra['role']; $role = $extra['role'];
@ -194,7 +194,7 @@ function user_login($user, $pass, $extra = null){
$result = ldap_mbox_login($user, $pass, $iam_settings, array('is_internal' => $is_internal, 'create' => true)); $result = ldap_mbox_login($user, $pass, $iam_settings, array('is_internal' => $is_internal, 'create' => true));
if ($result !== false) return $result; if ($result !== false) return $result;
} }
} }
if ($row['active'] != 1) { if ($row['active'] != 1) {
return false; return false;
} }
@ -313,7 +313,7 @@ function user_login($user, $pass, $extra = null){
} }
break; break;
} }
return false; return false;
} }
function apppass_login($user, $pass, $app_passwd_data, $extra = null){ function apppass_login($user, $pass, $app_passwd_data, $extra = null){
@ -364,7 +364,7 @@ function apppass_login($user, $pass, $app_passwd_data, $extra = null){
':user' => $user, ':user' => $user,
)); ));
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($rows as $row) { foreach ($rows as $row) {
if ($protocol && $row[$protocol . '_access'] != '1'){ if ($protocol && $row[$protocol . '_access'] != '1'){
continue; continue;
@ -476,7 +476,7 @@ function keycloak_mbox_login_rest($user, $pass, $iam_settings, $extra = null){
} }
function ldap_mbox_login($user, $pass, $iam_settings, $extra = null){ function ldap_mbox_login($user, $pass, $iam_settings, $extra = null){
global $pdo; global $pdo;
$iam_provider = identity_provider(); $iam_provider = identity_provider();
$is_internal = $extra['is_internal']; $is_internal = $extra['is_internal'];
$create = $extra['create']; $create = $extra['create'];
@ -491,6 +491,9 @@ function ldap_mbox_login($user, $pass, $iam_settings, $extra = null){
} }
return false; return false;
} }
if (!$iam_provider) {
return false;
}
try { try {
$ldap_query = $iam_provider->query(); $ldap_query = $iam_provider->query();