[systemd-devel] pam: Don't use loginuid [was: Re: Fix PAM module to not clobber XDG_RUNTIME_DIR with su]

Colin Walters walters at verbum.org
Tue Nov 19 07:42:30 PST 2013


On Mon, 2013-11-18 at 19:35 -0500, Colin Walters wrote:

> And that's what I'm testing - with Martin's patch in the loop I was
> still getting XDG_DATA_DIR for uid 1000, I'll try to debug soon.

Ok, some discussion on IRC revealed that I was only using the second
patch to s/loginuid/uid/, but we need the first patch too.

Before I continue, a quick TL;DR:  For downstreams that want to carry a
noninvasive fix for this problem, Martin's 2 patches are OK.

But I wanted to do a bit more "due diligence" on this and attempt to
understand where Lennart is coming from, and why the code is how it is
today.

Some archeology with git points to this commit:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=21c390ccd1b4f7bc962c16549df929ad518a1d37

Quite old now...and there's not a lot of explanation as to the
real-world scenario that caused it to be introduced.

There's a followup commit here:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=954449b82df7fc2d37a8d854977a1a73a65edfbd

with some more information.  Now one thing to note is: we're using the
uid of the original session as the source for all information, including
the runtime dir.

Martin's first patch is creating a situation where logind says one
thing, pam module overrides it.  But both come from the same git module,
we can fix logind.  

I'm attaching a patch (for discussion only) that needs to go on top of
Martin's "pam: Don't use loginuid" patch.

Both of our patch series currently are basically going to have the
effect that with pkexec, XDG_RUNTIME_DIR is unset.  But this is
undesirable because it forces the rest of userspace to go back to the
old dark ages when XDG_RUNTIME_DIR didn't exist and there was no
reliable mechanism for two processes of equal uid but different sessions
find each other and communicate.  (Think ssh login + gdm login).

My patch though starts to pave the way for having XDG_RUNTIME_DIR
consistently point to that of the user's uid - I am increasingly
thinking the option #3 I mention in the patch where we refcount the
runtime dir in addition to users and sessions would work.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-login-Make-XDG_RUNTIME_DIR-match-target-uid-with-pke.patch
Type: text/x-patch
Size: 3991 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131119/13374a5b/attachment.bin>


More information about the systemd-devel mailing list