1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
|
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include "greeter.h"
#include "ldm-marshal.h"
enum {
CONNECTED,
START_AUTHENTICATION,
START_SESSION,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
struct GreeterPrivate
{
/* Session running on */
Session *session;
/* PAM service to authenticate with */
gchar *pam_service;
/* Buffer for data read from greeter */
guint8 *read_buffer;
gsize n_read;
/* Hints for the greeter */
GHashTable *hints;
/* Default session to use */
gchar *default_session;
/* Sequence number of current PAM session */
guint32 authentication_sequence_number;
/* PAM session being constructed by the greeter */
Session *authentication_session;
/* TRUE if a user has been authenticated and the session requested to start */
gboolean start_session;
/* TRUE if can log into guest accounts */
gboolean allow_guest;
/* TRUE if logging into guest session */
gboolean guest_account_authenticated;
/* Communication channels to communicate with */
GIOChannel *to_greeter_channel;
GIOChannel *from_greeter_channel;
};
G_DEFINE_TYPE (Greeter, greeter, G_TYPE_OBJECT);
/* Messages from the greeter to the server */
typedef enum
{
GREETER_MESSAGE_CONNECT = 0,
GREETER_MESSAGE_AUTHENTICATE,
GREETER_MESSAGE_AUTHENTICATE_AS_GUEST,
GREETER_MESSAGE_CONTINUE_AUTHENTICATION,
GREETER_MESSAGE_START_SESSION,
GREETER_MESSAGE_CANCEL_AUTHENTICATION,
GREETER_MESSAGE_SET_LANGUAGE
} GreeterMessage;
/* Messages from the server to the greeter */
typedef enum
{
SERVER_MESSAGE_CONNECTED = 0,
SERVER_MESSAGE_PROMPT_AUTHENTICATION,
SERVER_MESSAGE_END_AUTHENTICATION,
SERVER_MESSAGE_SESSION_RESULT
} ServerMessage;
static gboolean read_cb (GIOChannel *source, GIOCondition condition, gpointer data);
Greeter *
greeter_new (Session *session, const gchar *pam_service)
{
Greeter *greeter;
greeter = g_object_new (GREETER_TYPE, NULL);
greeter->priv->session = g_object_ref (session);
greeter->priv->pam_service = g_strdup (pam_service);
return greeter;
}
void
greeter_set_allow_guest (Greeter *greeter, gboolean allow_guest)
{
greeter->priv->allow_guest = allow_guest;
}
void
greeter_set_hint (Greeter *greeter, const gchar *name, const gchar *value)
{
g_hash_table_insert (greeter->priv->hints, g_strdup (name), g_strdup (value));
}
static guint32
int_length ()
{
return 4;
}
#define HEADER_SIZE (sizeof (guint32) * 2)
#define MAX_MESSAGE_LENGTH 1024
static void
write_message (Greeter *greeter, guint8 *message, gsize message_length)
{
GError *error = NULL;
g_io_channel_write_chars (greeter->priv->to_greeter_channel, (gchar *) message, message_length, NULL, &error);
if (error)
g_warning ("Error writing to greeter: %s", error->message);
g_clear_error (&error);
g_io_channel_flush (greeter->priv->to_greeter_channel, NULL);
}
static void
write_int (guint8 *buffer, gint buffer_length, guint32 value, gsize *offset)
{
if (*offset + 4 >= buffer_length)
return;
buffer[*offset] = value >> 24;
buffer[*offset+1] = (value >> 16) & 0xFF;
buffer[*offset+2] = (value >> 8) & 0xFF;
buffer[*offset+3] = value & 0xFF;
*offset += 4;
}
static void
write_string (guint8 *buffer, gint buffer_length, const gchar *value, gsize *offset)
{
gint length;
if (value)
length = strlen (value);
else
length = 0;
write_int (buffer, buffer_length, length, offset);
if (*offset + length >= buffer_length)
return;
if (length > 0)
{
memcpy (buffer + *offset, value, length);
*offset += length;
}
}
static void
write_header (guint8 *buffer, gint buffer_length, guint32 id, guint32 length, gsize *offset)
{
write_int (buffer, buffer_length, id, offset);
write_int (buffer, buffer_length, length, offset);
}
static guint32
string_length (const gchar *value)
{
if (value == NULL)
return int_length ();
else
return int_length () + strlen (value);
}
static void
handle_connect (Greeter *greeter, const gchar *version)
{
guint8 message[MAX_MESSAGE_LENGTH];
gsize offset = 0;
guint32 length;
GHashTableIter iter;
gpointer key, value;
g_debug ("Greeter connected version=%s", version);
length = string_length (VERSION);
g_hash_table_iter_init (&iter, greeter->priv->hints);
while (g_hash_table_iter_next (&iter, &key, &value))
length += string_length (key) + string_length (value);
write_header (message, MAX_MESSAGE_LENGTH, SERVER_MESSAGE_CONNECTED, length, &offset);
write_string (message, MAX_MESSAGE_LENGTH, VERSION, &offset);
g_hash_table_iter_init (&iter, greeter->priv->hints);
while (g_hash_table_iter_next (&iter, &key, &value))
{
write_string (message, MAX_MESSAGE_LENGTH, key, &offset);
write_string (message, MAX_MESSAGE_LENGTH, value, &offset);
}
write_message (greeter, message, offset);
g_signal_emit (greeter, signals[CONNECTED], 0);
}
static void
pam_messages_cb (Session *session, Greeter *greeter)
{
int i;
guint32 size;
guint8 message[MAX_MESSAGE_LENGTH];
const struct pam_message *messages;
int messages_length;
gsize offset = 0;
int n_prompts = 0;
messages = session_get_messages (session);
messages_length = session_get_messages_length (session);
/* Respond to d-bus query with messages */
g_debug ("Prompt greeter with %d message(s)", messages_length);
size = int_length () + string_length (session_get_username (session)) + int_length ();
for (i = 0; i < messages_length; i++)
size += int_length () + string_length (messages[i].msg);
write_header (message, MAX_MESSAGE_LENGTH, SERVER_MESSAGE_PROMPT_AUTHENTICATION, size, &offset);
write_int (message, MAX_MESSAGE_LENGTH, greeter->priv->authentication_sequence_number, &offset);
write_string (message, MAX_MESSAGE_LENGTH, session_get_username (session), &offset);
write_int (message, MAX_MESSAGE_LENGTH, messages_length, &offset);
for (i = 0; i < messages_length; i++)
{
write_int (message, MAX_MESSAGE_LENGTH, messages[i].msg_style, &offset);
write_string (message, MAX_MESSAGE_LENGTH, messages[i].msg, &offset);
if (messages[i].msg_style == PAM_PROMPT_ECHO_OFF || messages[i].msg_style == PAM_PROMPT_ECHO_ON)
n_prompts++;
}
write_message (greeter, message, offset);
/* Continue immediately if nothing to respond with */
// FIXME: Should probably give the greeter a chance to ack the message
if (n_prompts == 0)
{
struct pam_response *response;
response = calloc (messages_length, sizeof (struct pam_response));
session_respond (greeter->priv->authentication_session, response);
}
}
static void
send_end_authentication (Greeter *greeter, guint32 sequence_number, const gchar *username, int result)
{
guint8 message[MAX_MESSAGE_LENGTH];
gsize offset = 0;
write_header (message, MAX_MESSAGE_LENGTH, SERVER_MESSAGE_END_AUTHENTICATION, int_length () + string_length (username) + int_length (), &offset);
write_int (message, MAX_MESSAGE_LENGTH, sequence_number, &offset);
write_string (message, MAX_MESSAGE_LENGTH, username, &offset);
write_int (message, MAX_MESSAGE_LENGTH, result, &offset);
write_message (greeter, message, offset);
}
static void
authentication_complete_cb (Session *session, Greeter *greeter)
{
int result;
g_debug ("Authenticate result for user %s: %s", session_get_username (session), session_get_authentication_result_string (session));
result = session_get_authentication_result (session);
if (session_get_is_authenticated (session))
{
if (session_get_user (session))
g_debug ("User %s authorized", session_get_username (session));
else
{
g_debug ("User %s authorized, but no account of that name exists", session_get_username (session));
result = PAM_USER_UNKNOWN;
}
}
send_end_authentication (greeter, greeter->priv->authentication_sequence_number, session_get_username (session), result);
}
static void
reset_session (Greeter *greeter)
{
if (greeter->priv->authentication_session)
{
g_signal_handlers_disconnect_matched (greeter->priv->authentication_session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, greeter);
session_stop (greeter->priv->authentication_session);
g_object_unref (greeter->priv->authentication_session);
greeter->priv->authentication_session = NULL;
}
greeter->priv->guest_account_authenticated = FALSE;
}
static void
handle_login (Greeter *greeter, guint32 sequence_number, const gchar *username)
{
if (username[0] == '\0')
{
g_debug ("Greeter start authentication");
username = NULL;
}
else
g_debug ("Greeter start authentication for %s", username);
reset_session (greeter);
greeter->priv->authentication_sequence_number = sequence_number;
g_signal_emit (greeter, signals[START_AUTHENTICATION], 0, username, &greeter->priv->authentication_session);
if (!greeter->priv->authentication_session)
{
send_end_authentication (greeter, sequence_number, "", PAM_USER_UNKNOWN);
return;
}
g_signal_connect (G_OBJECT (greeter->priv->authentication_session), "got-messages", G_CALLBACK (pam_messages_cb), greeter);
g_signal_connect (G_OBJECT (greeter->priv->authentication_session), "authentication-complete", G_CALLBACK (authentication_complete_cb), greeter);
/* Run the session process */
session_start (greeter->priv->authentication_session, greeter->priv->pam_service, username, TRUE, TRUE);
}
static void
handle_login_as_guest (Greeter *greeter, guint32 sequence_number)
{
g_debug ("Greeter start authentication for guest account");
reset_session (greeter);
if (!greeter->priv->allow_guest)
{
g_debug ("Guest account is disabled");
send_end_authentication (greeter, sequence_number, "", PAM_USER_UNKNOWN);
return;
}
greeter->priv->guest_account_authenticated = TRUE;
send_end_authentication (greeter, sequence_number, "", PAM_SUCCESS);
}
static void
handle_continue_authentication (Greeter *greeter, gchar **secrets)
{
int messages_length;
const struct pam_message *messages;
struct pam_response *response;
int i, j, n_prompts = 0;
/* Not in authentication */
if (greeter->priv->authentication_session == NULL)
return;
messages_length = session_get_messages_length (greeter->priv->authentication_session);
messages = session_get_messages (greeter->priv->authentication_session);
/* Check correct number of responses */
for (i = 0; i < messages_length; i++)
{
int msg_style = messages[i].msg_style;
if (msg_style == PAM_PROMPT_ECHO_OFF || msg_style == PAM_PROMPT_ECHO_ON)
n_prompts++;
}
if (g_strv_length (secrets) != n_prompts)
{
session_respond_error (greeter->priv->authentication_session, PAM_CONV_ERR);
return;
}
g_debug ("Continue authentication");
/* Build response */
response = calloc (messages_length, sizeof (struct pam_response));
for (i = 0, j = 0; i < messages_length; i++)
{
int msg_style = messages[i].msg_style;
if (msg_style == PAM_PROMPT_ECHO_OFF || msg_style == PAM_PROMPT_ECHO_ON)
{
response[i].resp = strdup (secrets[j]); // FIXME: Need to convert from UTF-8
j++;
}
}
session_respond (greeter->priv->authentication_session, response);
}
static void
handle_cancel_authentication (Greeter *greeter)
{
/* Not in authentication */
if (greeter->priv->authentication_session == NULL)
return;
g_debug ("Cancel authentication");
reset_session (greeter);
}
static void
handle_start_session (Greeter *greeter, const gchar *session)
{
gboolean result;
guint8 message[MAX_MESSAGE_LENGTH];
gsize offset = 0;
if (strcmp (session, "") == 0)
session = NULL;
if (greeter->priv->guest_account_authenticated || session_get_is_authenticated (greeter->priv->authentication_session))
{
if (session)
g_debug ("Greeter requests session %s", session);
else
g_debug ("Greeter requests default session");
greeter->priv->start_session = TRUE;
g_signal_emit (greeter, signals[START_SESSION], 0, session, &result);
}
else
{
g_debug ("Ignoring start session request, user is not authorized");
result = FALSE;
}
write_header (message, MAX_MESSAGE_LENGTH, SERVER_MESSAGE_SESSION_RESULT, int_length (), &offset);
write_int (message, MAX_MESSAGE_LENGTH, result ? 0 : 1, &offset);
write_message (greeter, message, offset);
}
static void
handle_set_language (Greeter *greeter, const gchar *language)
{
User *user;
if (!greeter->priv->guest_account_authenticated && !session_get_is_authenticated (greeter->priv->authentication_session))
{
g_debug ("Ignoring set language request, user is not authorized");
return;
}
// FIXME: Could use this
if (greeter->priv->guest_account_authenticated)
{
g_debug ("Ignoring set language request for guest user");
return;
}
g_debug ("Greeter sets language %s", language);
user = session_get_user (greeter->priv->authentication_session);
user_set_language (user, language);
}
static guint32
read_int (Greeter *greeter, gsize *offset)
{
guint32 value;
guint8 *buffer;
if (greeter->priv->n_read - *offset < sizeof (guint32))
{
g_warning ("Not enough space for int, need %zu, got %zu", sizeof (guint32), greeter->priv->n_read - *offset);
return 0;
}
buffer = greeter->priv->read_buffer + *offset;
value = buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
*offset += int_length ();
return value;
}
static gchar *
read_string (Greeter *greeter, gsize *offset)
{
guint32 length;
gchar *value;
length = read_int (greeter, offset);
if (greeter->priv->n_read - *offset < length)
{
g_warning ("Not enough space for string, need %u, got %zu", length, greeter->priv->n_read - *offset);
return g_strdup ("");
}
value = g_malloc (sizeof (gchar *) * (length + 1));
memcpy (value, greeter->priv->read_buffer + *offset, length);
value[length] = '\0';
*offset += length;
return value;
}
static gboolean
read_cb (GIOChannel *source, GIOCondition condition, gpointer data)
{
Greeter *greeter = data;
gsize n_to_read, n_read, offset;
GIOStatus status;
int id, n_secrets, i;
guint32 sequence_number;
gchar *version, *username, *session_name, *language;
gchar **secrets;
GError *error = NULL;
if (condition == G_IO_HUP)
{
g_debug ("Greeter closed communication channel");
return FALSE;
}
n_to_read = HEADER_SIZE;
if (greeter->priv->n_read >= HEADER_SIZE)
{
offset = int_length ();
n_to_read += read_int (greeter, &offset);
}
status = g_io_channel_read_chars (greeter->priv->from_greeter_channel,
(gchar *) greeter->priv->read_buffer + greeter->priv->n_read,
n_to_read - greeter->priv->n_read,
&n_read,
&error);
if (error)
g_warning ("Error reading from greeter: %s", error->message);
g_clear_error (&error);
if (status != G_IO_STATUS_NORMAL)
return TRUE;
greeter->priv->n_read += n_read;
if (greeter->priv->n_read != n_to_read)
return TRUE;
/* If have header, rerun for content */
if (greeter->priv->n_read == HEADER_SIZE)
{
gsize offset = int_length ();
n_to_read = read_int (greeter, &offset);
if (n_to_read > 0)
{
greeter->priv->read_buffer = g_realloc (greeter->priv->read_buffer, HEADER_SIZE + n_to_read);
read_cb (source, condition, greeter);
return TRUE;
}
}
offset = 0;
id = read_int (greeter, &offset);
read_int (greeter, &offset);
switch (id)
{
case GREETER_MESSAGE_CONNECT:
version = read_string (greeter, &offset);
handle_connect (greeter, version);
g_free (version);
break;
case GREETER_MESSAGE_AUTHENTICATE:
sequence_number = read_int (greeter, &offset);
username = read_string (greeter, &offset);
handle_login (greeter, sequence_number, username);
g_free (username);
break;
case GREETER_MESSAGE_AUTHENTICATE_AS_GUEST:
sequence_number = read_int (greeter, &offset);
handle_login_as_guest (greeter, sequence_number);
break;
case GREETER_MESSAGE_CONTINUE_AUTHENTICATION:
n_secrets = read_int (greeter, &offset);
secrets = g_malloc (sizeof (gchar *) * (n_secrets + 1));
for (i = 0; i < n_secrets; i++)
secrets[i] = read_string (greeter, &offset);
secrets[i] = NULL;
handle_continue_authentication (greeter, secrets);
g_strfreev (secrets);
break;
case GREETER_MESSAGE_CANCEL_AUTHENTICATION:
handle_cancel_authentication (greeter);
break;
case GREETER_MESSAGE_START_SESSION:
session_name = read_string (greeter, &offset);
handle_start_session (greeter, session_name);
g_free (session_name);
break;
case GREETER_MESSAGE_SET_LANGUAGE:
language = read_string (greeter, &offset);
handle_set_language (greeter, language);
g_free (language);
break;
default:
g_warning ("Unknown message from greeter: %d", id);
break;
}
greeter->priv->n_read = 0;
return TRUE;
}
gboolean
greeter_get_guest_authenticated (Greeter *greeter)
{
g_return_val_if_fail (greeter != NULL, FALSE);
return greeter->priv->guest_account_authenticated;
}
Session *
greeter_get_authentication_session (Greeter *greeter)
{
g_return_val_if_fail (greeter != NULL, NULL);
return greeter->priv->authentication_session;
}
gboolean
greeter_get_start_session (Greeter *greeter)
{
g_return_val_if_fail (greeter != NULL, FALSE);
return greeter->priv->start_session;
}
gboolean
greeter_start (Greeter *greeter, const gchar *service, const gchar *username)
{
int to_greeter_pipe[2], from_greeter_pipe[2];
gboolean result = FALSE;
gchar *value;
/* Create a pipe to talk with the greeter */
if (pipe (to_greeter_pipe) != 0 || pipe (from_greeter_pipe) != 0)
{
g_warning ("Failed to create pipes: %s", strerror (errno));
return FALSE;
}
greeter->priv->to_greeter_channel = g_io_channel_unix_new (to_greeter_pipe[1]);
g_io_channel_set_encoding (greeter->priv->to_greeter_channel, NULL, NULL);
greeter->priv->from_greeter_channel = g_io_channel_unix_new (from_greeter_pipe[0]);
g_io_channel_set_encoding (greeter->priv->from_greeter_channel, NULL, NULL);
g_io_channel_set_buffered (greeter->priv->from_greeter_channel, FALSE);
g_io_add_watch (greeter->priv->from_greeter_channel, G_IO_IN | G_IO_HUP, read_cb, greeter);
/* Let the greeter session know how to communicate with the daemon */
value = g_strdup_printf ("%d", from_greeter_pipe[1]);
session_set_env (greeter->priv->session, "LIGHTDM_TO_SERVER_FD", value);
g_free (value);
value = g_strdup_printf ("%d", to_greeter_pipe[0]);
session_set_env (greeter->priv->session, "LIGHTDM_FROM_SERVER_FD", value);
g_free (value);
/* Don't allow the daemon end of the pipes to be accessed in child processes */
fcntl (to_greeter_pipe[1], F_SETFD, FD_CLOEXEC);
fcntl (from_greeter_pipe[0], F_SETFD, FD_CLOEXEC);
result = session_start (greeter->priv->session, service, username, FALSE, FALSE);
/* Close the session ends of the pipe */
close (to_greeter_pipe[0]);
close (from_greeter_pipe[1]);
return result;
}
static Session *
greeter_real_start_authentication (Greeter *greeter, const gchar *username)
{
return NULL;
}
static gboolean
greeter_real_start_session (Greeter *greeter, const gchar *session, gboolean is_guest)
{
return FALSE;
}
static void
greeter_init (Greeter *greeter)
{
greeter->priv = G_TYPE_INSTANCE_GET_PRIVATE (greeter, GREETER_TYPE, GreeterPrivate);
greeter->priv->read_buffer = g_malloc (HEADER_SIZE);
greeter->priv->hints = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
}
static void
greeter_finalize (GObject *object)
{
Greeter *self;
self = GREETER (object);
g_signal_handlers_disconnect_matched (self->priv->session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
g_object_unref (self->priv->session);
g_free (self->priv->pam_service);
g_free (self->priv->read_buffer);
g_hash_table_unref (self->priv->hints);
if (self->priv->authentication_session)
{
g_signal_handlers_disconnect_matched (self->priv->authentication_session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
g_object_unref (self->priv->authentication_session);
}
if (self->priv->to_greeter_channel)
g_io_channel_unref (self->priv->to_greeter_channel);
if (self->priv->from_greeter_channel)
g_io_channel_unref (self->priv->from_greeter_channel);
G_OBJECT_CLASS (greeter_parent_class)->finalize (object);
}
static void
greeter_class_init (GreeterClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
klass->start_authentication = greeter_real_start_authentication;
klass->start_session = greeter_real_start_session;
object_class->finalize = greeter_finalize;
signals[CONNECTED] =
g_signal_new ("connected",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GreeterClass, connected),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[START_AUTHENTICATION] =
g_signal_new ("start-authentication",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GreeterClass, start_authentication),
g_signal_accumulator_first_wins,
NULL,
ldm_marshal_OBJECT__STRING,
SESSION_TYPE, 1, G_TYPE_STRING);
signals[START_SESSION] =
g_signal_new ("start-session",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GreeterClass, start_session),
g_signal_accumulator_true_handled,
NULL,
ldm_marshal_BOOLEAN__STRING,
G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
g_type_class_add_private (klass, sizeof (GreeterPrivate));
}
|