[Pkg-shadow-devel] Bug#670132: Happens when the session is closed

Tollef Fog Heen tfheen at err.no
Sat Jun 30 06:25:02 UTC 2012


Hiya,

so, what happens is that systemd (and upstart, I suspect) sends SIGTERM
to su when the pam session is closed.

src/su.c:prepare_pam_close_session ends with:

        (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. */
}

signal + alarm there is to ensure that any signals in the pam cleanup
phase causes the termination of the child, but this is already done by
systemd.

I think just dropping the fputs should be reasonable enough.
Alternatively, I can make systemd not send SIGTERM to the session
leader.  I'm not entirely sure why it does that in the first place, but
I've asked upstream to comment.

-- 
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are





More information about the Pkg-shadow-devel mailing list