]> granicus.if.org Git - shadow/commitdiff
Terminate the child before closing the PAM session.
authorNicolas François <nicolas.francois@centraliens.net>
Tue, 13 Aug 2013 17:48:53 +0000 (19:48 +0200)
committerNicolas François <nicolas.francois@centraliens.net>
Tue, 13 Aug 2013 17:48:53 +0000 (19:48 +0200)
* src/su.c: Terminate the child (if needed) before closing the PAM
session. This is probably more correct, and avoid reporting
termination from signals possibly sent by PAM modules (e.g. former
versions of pam_systemd). Debian#670132

ChangeLog
src/su.c

index 4d40562a5959bedc1e18fb983454f74421defef1..31251ac049ec5701fa6fb273eae79967c05fdb33 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-08-13  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/su.c: Terminate the child (if needed) before closing the PAM
+       session. This is probably more correct, and avoid reporting
+       termination from signals possibly sent by PAM modules (e.g. former
+       versions of pam_systemd). Debian#670132
+
 2013-08-13  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/su.c: When a SIGTSTP is caught, reset caught to 0. There is
index 43f7dc4bad0dfe109e62fff0cba738dc34eea60c..c02ea3aec1ef3b4e4ebca4243cc308427ebe89d6 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -372,6 +372,12 @@ static void prepare_pam_close_session (void)
                (void) fputs (_("Session terminated, terminating shell..."),
                              stderr);
                (void) kill (-pid_child, caught);
+
+               (void) signal (SIGALRM, kill_child);
+               (void) alarm (2);
+
+               (void) wait (&status);
+               (void) fputs (_(" ...terminated.\n"), stderr);
        }
 
        ret = pam_close_session (pamh, 0);
@@ -384,14 +390,6 @@ static void prepare_pam_close_session (void)
        (void) pam_setcred (pamh, PAM_DELETE_CRED);
        (void) pam_end (pamh, PAM_SUCCESS);
 
-       if (0 != caught) {
-               (void) signal (SIGALRM, kill_child);
-               (void) alarm (2);
-
-               (void) wait (&status);
-               (void) fputs (_(" ...terminated.\n"), stderr);
-       }
-
        exit ((0 != WIFEXITED (status)) ? WEXITSTATUS (status)
                                        : WTERMSIG (status) + 128);
        /* Only the child returns. See above. */