From a76ebf4b6e9951cf276ee1483785e4b3f3d54334 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Tue, 13 Jun 2023 18:23:58 -0300 Subject: openrc-pam: Grab XDG_RUNTIME_DIR from pam and re-export it for openrc Signed-off-by: Anna (navi) Figueiredo Gomes --- src/openrc-pam/openrc-pam.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/openrc-pam/openrc-pam.c b/src/openrc-pam/openrc-pam.c index eba3846b..60b517b4 100644 --- a/src/openrc-pam/openrc-pam.c +++ b/src/openrc-pam/openrc-pam.c @@ -1,13 +1,11 @@ -#include +#include #include +#include #include -#include -#include #include +#include #include -#ifdef __FreeBSD__ -#include -#endif +#include #include "einfo.h" @@ -15,6 +13,10 @@ static bool exec_openrc(pam_handle_t *pamh, const char *runlevel) { char *cmd = NULL; const char *username; struct passwd *pw = NULL; + const char *env = NULL; + + if ((env = pam_getenv(pamh, "XDG_RUNTIME_DIR")) != NULL) + setenv("XDG_RUNTIME_DIR", env, 0); if (pam_get_user(pamh, &username, "username:") != PAM_SUCCESS) return false; -- cgit v1.2.3