From d940f9d08a0074d77fbbfe2dfcd76e7037d2ec3f Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Mon, 30 Mar 2020 03:25:15 +0200 Subject: [PATCH] worker: Include setcred in setup phase --- greetd/src/session/worker.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/greetd/src/session/worker.rs b/greetd/src/session/worker.rs index 5c16c31..e5fa436 100644 --- a/greetd/src/session/worker.rs +++ b/greetd/src/session/worker.rs @@ -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)?;