pub struct Pam { /* private fields */ }Expand description
Authentication through a PAM service, from cx.pam(service), as a lock
screen does. A clone is cheap and shares it.
libpam blocks, so each attempt runs on a thread of its own, and the
loop hears from it only while it runs: an idle Pam wakes nothing. When
the context that made it goes, an attempt still running is refused its
answer, so its thread ends.
Implementations§
Source§impl Pam
impl Pam
Sourcepub fn start(&self, user: Option<&str>)
pub fn start(&self, user: Option<&str>)
Starts authenticating user, or with None the user the shell runs
as, found by its uid. An attempt already running is aborted first.
Ending an attempt while PAM waits for an answer, by aborting it,
starting another or dropping its context, counts as a failed login
where pam_faillock counts failures, and enough of them lock the
account. So take the password first, start on Enter, and answer as
soon as PAM asks.
Sourcepub fn respond(&self, text: impl Into<String>)
pub fn respond(&self, text: impl Into<String>)
Answers the question asked, and the state turns
Busy. The answer is never logged, and its bytes
are zeroed once handed on, but the copy made for libpam is freed
unzeroed. With no question waiting, it is dropped, and that is
logged.
Sourcepub fn state(&self) -> ReadSignal<PamState>
pub fn state(&self) -> ReadSignal<PamState>
Where the attempt is.
Sourcepub fn messages(&self) -> ReadSignal<Vec<PamMessage>>
pub fn messages(&self) -> ReadSignal<Vec<PamMessage>>
The info and error lines PAM sent during the attempt, oldest first. Each start empties it.