aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-20 15:00:03 -0500
committerTed Gould <ted@gould.cx>2012-08-20 15:00:03 -0500
commita41b90c57c3402144dd43727007a8389cca538be (patch)
tree38d60e7d6aa63cd31c1e87808a4aa2f82f2921d2
parent761081e28e867a313dcf648a3a22082c375f75b0 (diff)
downloadlibpam-freerdp2-a41b90c57c3402144dd43727007a8389cca538be.tar.gz
libpam-freerdp2-a41b90c57c3402144dd43727007a8389cca538be.tar.bz2
libpam-freerdp2-a41b90c57c3402144dd43727007a8389cca538be.zip
First make sure we clean up
-rw-r--r--src/pam-freerdp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pam-freerdp.c b/src/pam-freerdp.c
index 189c82f..1307990 100644
--- a/src/pam-freerdp.c
+++ b/src/pam-freerdp.c
@@ -176,13 +176,19 @@ done:
return retval;
}
+pid_t session_pid = 0;
/* Open Session. Here we need to fork a little process so that we can
give the credentials to the session itself so that it can startup the
xfreerdp viewer for the login */
PAM_EXTERN int
pam_sm_open_session (pam_handle_t *pamh, int flags, int argc, const char **argv)
{
- return PAM_IGNORE;
+ if (session_pid != 0) {
+ kill(session_pid, SIGKILL);
+ session_pid = 0;
+ }
+
+ return PAM_IGNORE;
}
/* Close Session. Make sure our little guy has died so he doesn't become
@@ -190,6 +196,11 @@ pam_sm_open_session (pam_handle_t *pamh, int flags, int argc, const char **argv)
PAM_EXTERN int
pam_sm_close_session (pam_handle_t *pamh, int flags, int argc, const char **argv)
{
+ if (session_pid != 0) {
+ kill(session_pid, SIGKILL);
+ session_pid = 0;
+ }
+
return PAM_IGNORE;
}