aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-11-22 05:27:47 +0100
committerMattias Andrée <maandree@operamail.com>2013-11-22 05:27:47 +0100
commit1e5c5ba101e2f48b77bfdbdca220ea8146466cb2 (patch)
treed357c8d1484f59dc34715d8f3ad0f8944a170ed7 /src
parentwhoops (diff)
downloadlibpassphrase-1e5c5ba101e2f48b77bfdbdca220ea8146466cb2.tar.gz
libpassphrase-1e5c5ba101e2f48b77bfdbdca220ea8146466cb2.tar.bz2
libpassphrase-1e5c5ba101e2f48b77bfdbdca220ea8146466cb2.tar.xz
export env list from PAM
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/pam.c10
1 files changed, 10 insertions, 0 deletions
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);
+ }
}