worker: Include setcred in setup phase

This commit is contained in:
Kenny Levinsen
2020-03-30 03:25:15 +02:00
parent 88979c7927
commit d940f9d08a

View File

@@ -90,6 +90,10 @@ fn worker(sock: &UnixDatagram) -> Result<(), Error> {
}
pam.acct_mgmt(PamFlag::NONE)?;
// Not the credentials you think.
pam.setcred(PamFlag::ESTABLISH_CRED)?;
// Mark authentication as a success.
SessionChildToParent::Success.send(sock)?;
// Fetch our arguments from the parent.
@@ -192,9 +196,6 @@ fn worker(sock: &UnixDatagram) -> Result<(), Error> {
// Tell PAM what TTY we're targetting, which is used by logind.
pam.set_item(PamItemType::TTY, &format!("/dev/tty{}", vt))?;
// Not the credentials you think.
pam.setcred(PamFlag::ESTABLISH_CRED)?;
// Session time!
pam.open_session(PamFlag::NONE)?;