From cb1671c0b6cf7584427af435be89eb17dc7bdc5a Mon Sep 17 00:00:00 2001 From: Mark Unwin Date: Wed, 10 Jan 2024 14:36:06 +1000 Subject: [PATCH] Add some logging when failing to connect to an LDAP Server upon logon. --- app/Models/LogonModel.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Models/LogonModel.php b/app/Models/LogonModel.php index 84be04452..bb7eeca6b 100644 --- a/app/Models/LogonModel.php +++ b/app/Models/LogonModel.php @@ -96,13 +96,16 @@ public function logon($username = '', $password = '') if (empty($bind)) { $error = (string)ldap_error($ldap_connection); if ($error === 'Invalid credentials') { - $message = 'Invalid user supplied credentials for LDAP server at ' . $ldap->host . ', skipping.'; + log_message('warning', 'Invalid user supplied credentials for LDAP server at ' . $ldap->host . ', skipping.'); + log_message('error', $bind_string . ' at ' . $ldap_connect_string); } else if ($error === "Can't contact LDAP server") { - $message = 'LDAP server could not be reached at ' . $ldap->host . ', skipping.'; + log_message('error', 'LDAP server could not be reached at ' . $ldap->host . ', skipping.'); + log_message('error', $bind_string . ' at ' . $ldap_connect_string); } else { - $message = 'Could not bind to LDAP server at ' . $ldap->host . ', skipping.'; + log_message('error', 'Could not bind to LDAP server at ' . $ldap->host . ', skipping.'); + log_message('error', $error); + log_message('error', $bind_string . ' at ' . $ldap_connect_string); } - log_message('warning', $message); // \Config\Services::session()->setFlashdata('warning', $message); continue; } else {