Skip to content

Commit 56d80fe

Browse files
committed
Backport #5209 - Attempt to Login from Disabled Account
Add account disable log message for disabled users attempting to login
1 parent dbfe1b0 commit 56d80fe

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

CHANGELOG

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Cacti CHANGELOG
4444
-issue#5205: Cacti CSS file for Diff.css does look correct in all Cacti Themes
4545
-issue#5207: Deprecated error message during installation routine
4646
-issue#5208: Package form objects use the wrong text domain in their i18n strings
47+
-issue#5209: Add account disable log message for disabled users attempting to login
4748
-issue#5211: Undefined variable $user_id when creating new graph
4849
-issue#5223: Drop callback function sometimes puts name in the form input instead of the id
4950
-issue#5224: When poller run is exceeded by only a short period of time, Cacti does not round the number in the error

lib/auth.php

+13-6
Original file line numberDiff line numberDiff line change
@@ -4106,22 +4106,29 @@ function secpass_login_process($username) {
41064106
}
41074107

41084108
if (db_column_exists('user_auth', 'lastfail')) {
4109-
$user = db_fetch_row_prepared("SELECT id, username, lastfail, failed_attempts, `locked`, password
4109+
$user = db_fetch_row_prepared("SELECT id, username, lastfail, failed_attempts, `locked`, enabled, password
41104110
FROM user_auth
41114111
WHERE username = ?
4112-
AND realm = 0
4113-
AND enabled = 'on'",
4112+
AND realm = 0",
41144113
array($username));
41154114
} else {
4116-
$user = db_fetch_row_prepared("SELECT id, username, password
4115+
$user = db_fetch_row_prepared("SELECT id, username, password, enabled
41174116
FROM user_auth
41184117
WHERE username = ?
4119-
AND realm = 0
4120-
AND enabled = 'on'",
4118+
AND realm = 0",
41214119
array($username));
41224120
}
41234121

41244122
if (cacti_sizeof($user)) {
4123+
if ($user['enabled'] != 'on') {
4124+
$error = true;
4125+
$error_msg = __('Access Denied! Login Failed.');
4126+
4127+
cacti_log(sprintf('LOGIN FAILED: User %s, account disabled.', $username), false, 'AUTH');
4128+
4129+
return array();
4130+
}
4131+
41254132
if (trim($password) == '') {
41264133
/* error */
41274134
$error = true;

0 commit comments

Comments
 (0)