GNOME Bugzilla – Bug 670100
set XDG_SESSION_CLASS=greeter for greeter PAM session
Last modified: 2012-04-30 19:29:41 UTC
Created attachment 207591 [details] [review] suggested patch Other DM folks have requested that we should implement a generic way how display managers can recognize greeter PAM sessions and distuingish them from proper user logins. To accomodate for this I have now updated pam_systemd to look for the XDG_SESSION_CLASS env var. If it is set it shall encode the session type, one of "user" (which is the default if not set), "greeter" and "lock-screen". This is then passed on to systemd-logind which exposes this as properties of all sessions. It would be great if gdm would set this variable for its greeter sessions. All that's missing for that is that XDG_SESSION_CLASS is set to "greeter" in case the PAM service is "gdm-welcome". I have attached a patch that does just this, but I wouldn't be surprised if this somewhat dirty keying off "gdm-welcome" might not be acceptable. But everything else looked like a really massive code change I rather wanted to avoid.
I think you can fix this with a one line change to build_welcome_environment in gdm-welcome-session.c or am I wrong?
Hmm, but that would set the env block for the whole session, no? I think it's nicer to set this only via PAM. The effective outcome would probably be very similar, but I think it would still be nicer to set it right before the PAM conversation, because that's where we actually want the value to be set.
the whole greeter session runs after pam, so either way it's going out to the whole session.
Oh, I mean, I have no problem with leaving these env vars in for the final session, since in a way the values set are as much a property of the real session as of the PAM session. But if these env vars in build_welcome_environment() are only applied after PAM then they are definitely not an option here, since what really matters is that XDG_SESSION_CLASS is set during the invocation of pam_systemd, and are set via pam_putenv() and not in the normal environ[] block.
the env vars in build_welcome_environment are applied before PAM.
hey if there are no further objections, i'm probably just going to commit the change proposed in comment 1. I do want to get at least a tacit "that'll work for me" from you first though. Sound okay?
The following fix has been pushed: 5aa5ead welcome: set XDG_SESSION_CLASS
Created attachment 208153 [details] [review] welcome: set XDG_SESSION_CLASS This helps to identify greeter sessions. Based on a patch by Lennart Poettering <lennart@poettering.net>
Reopening the bug, apparently the env var set this way doesn't end up in the PAM env block, i.e. is never passed to pam_putenv()
it is passed to pam_putenv, but late, after pam_open_session is called.
Comment on attachment 207591 [details] [review] suggested patch I was tempted to change the order the environment was added so that it runs before run before the session stack, but that's a little too risky of a change for codefreeze day, so your patch wins.