Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat conversation error as authentication failure #925

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/sudo/pam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,15 @@ pub fn attempt_authenticate<C: Converser>(
}

// there was an authentication error, we can retry
Err(PamError::Pam(PamErrorType::AuthError, _)) => {
Err(PamError::Pam(
err_type @ (PamErrorType::AuthError | PamErrorType::ConversationError),
_,
)) => {
max_tries -= 1;
if max_tries == 0 {
return Err(Error::MaxAuthAttempts(current_try));
} else if non_interactive {
if non_interactive || err_type == PamErrorType::ConversationError {
return Err(Error::InteractionRequired);
} else if max_tries == 0 {
return Err(Error::MaxAuthAttempts(current_try));
} else {
user_warn!("Authentication failed, try again.");
}
Expand Down
Loading