Skip to content

Commit

Permalink
Add some logging when failing to connect to an LDAP Server upon logon.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Jan 10, 2024
1 parent 2d633b2 commit cb1671c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/Models/LogonModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cb1671c

Please sign in to comment.