Ubuntu

Comment 53 for bug 870297

Ok, now that I've finally figured out how exactly lightdm works in this regard, I've pushed my changes to lp:~lotheac/lightdm/utmpx.

At first, I was trying to check for XDG_SESSION_CLASS_USER, but it seems that is never set. The authentication session (which talks to the greeter) has no class, and that same session is used to start the user's process (hence it needs PAM very much). If authentication fails, the authentication session is restarted. I just check if we're a greeter after authentication, and if so, skip pam_{open,close}_session and write the utmpx entry.