From 1e5c5ba101e2f48b77bfdbdca220ea8146466cb2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 22 Nov 2013 05:27:47 +0100 Subject: export env list from PAM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/pam.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/pam.c b/src/pam.c index 6a35a34..5c06670 100644 --- a/src/pam.c +++ b/src/pam.c @@ -132,6 +132,7 @@ void verify_account_pam(void) void open_session_pam(void) { int rc; + char** env; struct sigaction signal_action; do_pam(pam_setcred(handle, PAM_ESTABLISH_CRED)); @@ -155,6 +156,15 @@ void open_session_pam(void) signal_action.sa_handler = quit_pam; sigaction(SIGHUP, &signal_action, NULL); sigaction(SIGTERM, &signal_action, &signal_action_term); + + for (env = pam_getenvlist(handle); env && *env; env++) + if (putenv(*env)) + { + pam_setcred(handle, PAM_DELETE_CRED); + pam_end(handle, pam_close_session(handle, 0)); + sleep(ERROR_SLEEP); + _exit(1); + } } -- cgit v1.2.3-70-g09d2