chiark / gitweb /
sd-pam: Drop uid so parent signal arrives at child.
authorAuke Kok <auke-jan.h.kok@intel.com>
Thu, 17 May 2012 19:17:42 +0000 (12:17 -0700)
committerLennart Poettering <lennart@poettering.net>
Mon, 21 May 2012 15:57:48 +0000 (17:57 +0200)
commit940c5210344e90428287e4f8878a9064e8869e22
treef0d8fa8d3fac1dff09e5d5b9b04e990c963b07b4
parent5b40d33761376354116a8cddb9b9fbdb6c4727d6
sd-pam: Drop uid so parent signal arrives at child.

The PAM helper thread needs to capture the death signal from the
parent, but is prohibited from doing so since when the child dies
as normal user, the kernel won't allow it to send a TERM to the
PAM helper thread which is running as root.

This causes the PAM threads to never exit, accumulating after
user sessions exit.

There is however really no need to keep the PAM threads running as
root, so, we can just setresuid() to the same user as defined in the
unit file for the parent thread (User=). This makes the TERM signal
arrive as normal. In case setresuid() fails, we ignore the error, so
we at least fall back to the current behaviour.
src/core/execute.c