mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-06-07 05:42:42 -04:00
refactoring
This commit is contained in:
parent
4d1f8c44d2
commit
7f2ba0980d
1 changed files with 8 additions and 2 deletions
|
@ -164,12 +164,18 @@ pam_faillock_output_count="$(echo "$pam_faillock_output" | wc -l)"
|
|||
## 4
|
||||
|
||||
## Do not count the first two informational textual output lines (starting with "user:" and "When") if present,
|
||||
## whilst ensuring failed_login_counter is not set to a negative value.
|
||||
failed_login_counter=$( [ $(( pam_faillock_output_count - 2 )) -gt 0 ] && echo $(( pam_faillock_output_count - 2 )) || echo "0" )
|
||||
failed_login_counter=$(( pam_faillock_output_count - 2 ))
|
||||
|
||||
## example failed_login_counter:
|
||||
## 2
|
||||
|
||||
## Ensuring failed_login_counter is not set to a negative value.
|
||||
## https://github.com/Kicksecure/security-misc/pull/305
|
||||
if [ "$failed_login_counter" -le "0" ]; then
|
||||
true "$0: WARNING: Failed login counter is negative. Resetting to 0."
|
||||
failed_login_counter=0
|
||||
fi
|
||||
|
||||
if [ "$failed_login_counter" = "0" ]; then
|
||||
true "$0: INFO: Failed login counter is 0, ok."
|
||||
exit 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue