From b0be984c59bc7890f733a121fe04cf088c1fc310 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Fri, 8 Mar 2013 12:00:00 +0100 Subject: [PATCH] pkexec: Set process environment from pam_getenvlist() Various pam modules provide environment variables that are intended to be set in the environment of the pam session. pkexec needs to process the output of pam_getenvlist() to get these. https://bugs.freedesktop.org/show_bug.cgi?id=62016 --- src/programs/pkexec.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c index f42a3bb..172fefb 100644 --- a/src/programs/pkexec.c +++ b/src/programs/pkexec.c @@ -145,6 +145,7 @@ open_session (const gchar *user_to_auth) gboolean ret; gint rc; pam_handle_t *pam_h; + char **envlist; struct pam_conv conversation; ret = FALSE; @@ -176,6 +177,14 @@ open_session (const gchar *user_to_auth) ret = TRUE; + envlist = pam_getenvlist (pam_h); + if (envlist != NULL) { + int i; + for (i = 0; envlist[i]; i++) + putenv(envlist[i]); + free (envlist); + } + out: if (pam_h != NULL) pam_end (pam_h, rc); -- 1.8.1.2