check_faillock_status

Function check_faillock_status 

Source
pub fn check_faillock_status(username: &str) -> Result<FaillockStatus, String>
Expand description

What: Check faillock status for a user.

Inputs:

  • username: Username to check faillock status for.

Output:

  • Ok(FaillockStatus) with status information, or Err(String) on error.

§Errors

  • Returns Err if the faillock command cannot be executed.

Details:

  • Executes faillock --user <username> command.
  • Parses output to count lines with “V” (valid attempts).
  • Compares with max attempts from config to determine if locked.
  • Returns status with attempt count, max attempts, lock status, and lockout duration.