~ubuntu-branches/ubuntu/raring/lightdm/raring-updates

« back to all changes in this revision

Viewing changes to src/display.c

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2012-06-21 11:47:33 UTC
  • mto: This revision was merged to the branch mainline in revision 69.
  • Revision ID: package-import@ubuntu.com-20120621114733-nmy3ee0p1a0n5ef0
Tags: upstream-1.3.1
ImportĀ upstreamĀ versionĀ 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    /* Program to run sessions through */
68
68
    gchar *session_wrapper;
69
69
 
70
 
    /* PAM service to authenticate against */
71
 
    gchar *pam_service;
72
 
 
73
 
    /* PAM service to authenticate against for automatic logins */
74
 
    gchar *pam_autologin_service;
75
 
  
76
70
    /* TRUE if in a user session */
77
71
    gboolean in_user_session;
78
72
 
110
104
    gboolean stopped;
111
105
};
112
106
 
 
107
/* PAM services to use */
 
108
#define GREETER_SERVICE   "lightdm-greeter"
 
109
#define USER_SERVICE      "lightdm"
 
110
#define AUTOLOGIN_SERVICE "lightdm-autologin"
 
111
 
113
112
G_DEFINE_TYPE (Display, display, G_TYPE_OBJECT);
114
113
 
115
114
static void greeter_session_stopped_cb (Session *session, Display *display);
402
401
    g_signal_connect (display->priv->session, "authentication-complete", G_CALLBACK (greeter_authentication_complete_cb), display);
403
402
 
404
403
    /* Make communication link to greeter that will run on this session */
405
 
    display->priv->greeter = greeter_new (display->priv->session, display->priv->pam_service);
 
404
    display->priv->greeter = greeter_new (display->priv->session, USER_SERVICE);
406
405
    g_signal_connect (G_OBJECT (display->priv->greeter), "connected", G_CALLBACK (greeter_connected_cb), display);
407
406
    g_signal_connect (G_OBJECT (display->priv->greeter), "start-authentication", G_CALLBACK (greeter_start_authentication_cb), display);
408
407
    g_signal_connect (G_OBJECT (display->priv->greeter), "start-session", G_CALLBACK (greeter_start_session_cb), display);
448
447
    }
449
448
 
450
449
    g_signal_connect_after (display->priv->session, "stopped", G_CALLBACK (greeter_session_stopped_cb), display);
451
 
    result = greeter_start (display->priv->greeter, display->priv->pam_service, greeter_user);
 
450
    result = greeter_start (display->priv->greeter, GREETER_SERVICE, greeter_user);
452
451
    g_free (greeter_user);
453
452
 
454
453
    if (!result)
605
604
    {
606
605
        /* If guest, then start a new autologin guest session (so can setup account) */
607
606
        if (greeter_get_guest_authenticated (display->priv->greeter))
608
 
            result = autologin_guest (display, display->priv->pam_autologin_service, FALSE);
 
607
            result = autologin_guest (display, AUTOLOGIN_SERVICE, FALSE);
609
608
        /* Otherwise, use the session the greeter has authenticated */
610
609
        else
611
610
        {
773
772
    if (display->priv->autologin_guest)
774
773
    {
775
774
        g_debug ("Automatically logging in as guest");
776
 
        result = autologin_guest (display, display->priv->pam_autologin_service, TRUE);
 
775
        result = autologin_guest (display, AUTOLOGIN_SERVICE, TRUE);
777
776
    }
778
777
    else if (display->priv->autologin_user)
779
778
    {
780
779
        g_debug ("Automatically logging in user %s", display->priv->autologin_user);
781
 
        result = autologin (display, display->priv->autologin_user, display->priv->pam_autologin_service, TRUE);
 
780
        result = autologin (display, display->priv->autologin_user, AUTOLOGIN_SERVICE, TRUE);
782
781
    }
783
782
    else if (display->priv->select_user_hint)
784
783
    {
785
784
        g_debug ("Logging in user %s", display->priv->select_user_hint);
786
 
        result = autologin (display, display->priv->select_user_hint, display->priv->pam_service, TRUE);
 
785
        result = autologin (display, display->priv->select_user_hint, USER_SERVICE, TRUE);
787
786
    }
788
787
 
789
788
    /* If no session started, start a greeter */
909
908
display_init (Display *display)
910
909
{
911
910
    display->priv = G_TYPE_INSTANCE_GET_PRIVATE (display, DISPLAY_TYPE, DisplayPrivate);
912
 
    display->priv->pam_service = g_strdup ("lightdm");
913
 
    display->priv->pam_autologin_service = g_strdup ("lightdm-autologin");
914
911
}
915
912
 
916
913
static void
932
929
        g_object_unref (self->priv->greeter);
933
930
    }
934
931
    g_free (self->priv->session_wrapper);
935
 
    g_free (self->priv->pam_service);
936
 
    g_free (self->priv->pam_autologin_service);
937
932
    if (self->priv->session)
938
933
    {
939
934
        g_signal_handlers_disconnect_matched (self->priv->session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);