[Pam-developers] pam_limits: Verify that the process found from the utmp record is still alive

Tomas Mraz tmraz at redhat.com
Mon Jan 20 14:13:10 UTC 2014


On Po, 2014-01-20 at 17:18 +0400, Dmitry V. Levin wrote:
> On Mon, Jan 20, 2014 at 09:26:52AM +0100, Tomas Mraz wrote:
> > The utmp entry for an user might be wrong for example when the process
> > that should update the entry on logout crashes. This patch by
> > Christopher Hailey tries to verify that the process that is associated
> > with the utmp record is still alive. Of course this is not perfectly
> > race-free but still better than nothing.
> > OK to commit?
> > --- Linux-PAM-1.0.4/modules/pam_limits/pam_limits.c	2009-02-20 13:27:14.000000000 +0000
> > +++ Linux-PAM-1.0.4/modules/pam_limits/pam_limits.c	2014-01-13 23:41:07.143383699 +0000

> The patch is awful.  First of all, it adds unconditional "continue"
> statement, thus rendering the whole utmp check useless.

Yes, it is awful. This will teach me to read the patches to forward to
the list after the morning coffee and not before it :) next time.

> This is not a python script, is it?
> 
> The check for process existence is added in the middle of applicability
> checks (after LIMITS_DEF_GROUP but before LIMITS_DEF_ALLGROUP).
> It should rather be added after these checks.
> 
> Only ESRCH tells that the process with the given pid doesn't exist, other
> errno codes do not mean that, so errno == ESRCH should be added to the
> check.
> 
> The log message is written in a different style that doesn't match the
> style of other messages issued by this module.  Please change it to
> something like "stale utmp entry (user=%s, pid=%d) ignored".

Corrected patch attached.

-- 
Tomas Mraz
No matter how far down the wrong road you've gone, turn back.
                                              Turkish proverb
(You'll never know whether the road is wrong though.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pam_limits-pid-verify-2.patch
Type: text/x-patch
Size: 823 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/pam-developers/attachments/20140120/69f0148c/attachment.bin>


More information about the Pam-developers mailing list