Comment 13 for bug 854261

Revision history for this message
LaƩrcio de Sousa (lbssousa) wrote :

I'm pretty close to address this problem. I've changed lightdm-gtk-greeter.c main code, introducing a new autologin_cb() callback function to be connected to signal "autologin-timeout-expired". Here is my autologin_cb() latest implementation:

static void
autologin_cb (LightDMGreeter *greeter)
{
    if (lightdm_greeter_get_is_authenticated (greeter))
    {
        /* Autologin user is likely to be aready selected in user list.
           If autologin-guest is enabled, just assume "*guest" is selected and
           there are no mistakes in lightdm.conf (e.g. setting both autologin-guest
           and autologin-user). */
        if (lightdm_greeter_get_autologin_guest_hint (greeter))
            start_session ();
        else if (lightdm_greeter_get_autologin_user_hint (greeter))
        {
            if (g_strcmp0 (lightdm_greeter_get_authentication_user (greeter),
                           lightdm_greeter_get_autologin_user_hint (greeter)) == 0)
                start_session ();
            else
            {
                /* Worst case: autologin-user is set in lightdm.conf, but "*guest"
                   is currently selected. Let's start a new authentication for
                   autologin user and hope for the best. */
                start_authentication (lightdm_greeter_get_autologin_user_hint (greeter));

                /* FIXME: wait somehow until new authentication is completed
                          before starting autologin user session. */

                /* In this current state, the following call will fail. Autologin user
                   is already authenticated, but user still needs to click on login
                   button to start session. */
                start_session ();
            }
        }
    }
    else
        lightdm_greeter_authenticate_autologin (greeter);
}

I've tested this function in all possible scenarios, and it only fails in one case, namely: if autologin-user is set, but "Guest session" is selected when autologin timeout expires. In this case, autologin user session doesn't start automatically, but it does start correctly when I click on login button after timeout, even if "Guest session" is shown in user list.