aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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);
+ }
}