summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/monitor.c b/monitor.c
index e8d63eb22..9bc4f0b2e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -98,6 +98,9 @@
98#include "jpake.h" 98#include "jpake.h"
99#include "roaming.h" 99#include "roaming.h"
100#include "authfd.h" 100#include "authfd.h"
101#ifdef USE_CONSOLEKIT
102#include "consolekit.h"
103#endif
101 104
102#ifdef GSSAPI 105#ifdef GSSAPI
103static Gssctxt *gsscontext = NULL; 106static Gssctxt *gsscontext = NULL;
@@ -193,6 +196,10 @@ int mm_answer_audit_command(int, Buffer *);
193 196
194static int monitor_read_log(struct monitor *); 197static int monitor_read_log(struct monitor *);
195 198
199#ifdef USE_CONSOLEKIT
200int mm_answer_consolekit_register(int, Buffer *);
201#endif
202
196static Authctxt *authctxt; 203static Authctxt *authctxt;
197static BIGNUM *ssh1_challenge = NULL; /* used for ssh1 rsa auth */ 204static BIGNUM *ssh1_challenge = NULL; /* used for ssh1 rsa auth */
198 205
@@ -285,6 +292,9 @@ struct mon_table mon_dispatch_postauth20[] = {
285 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, 292 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
286 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command}, 293 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command},
287#endif 294#endif
295#ifdef USE_CONSOLEKIT
296 {MONITOR_REQ_CONSOLEKIT_REGISTER, 0, mm_answer_consolekit_register},
297#endif
288 {0, 0, NULL} 298 {0, 0, NULL}
289}; 299};
290 300
@@ -327,6 +337,9 @@ struct mon_table mon_dispatch_postauth15[] = {
327 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, 337 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
328 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command}, 338 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command},
329#endif 339#endif
340#ifdef USE_CONSOLEKIT
341 {MONITOR_REQ_CONSOLEKIT_REGISTER, 0, mm_answer_consolekit_register},
342#endif
330 {0, 0, NULL} 343 {0, 0, NULL}
331}; 344};
332 345
@@ -514,6 +527,9 @@ monitor_child_postauth(struct monitor *pmonitor)
514 monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); 527 monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1);
515 monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); 528 monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1);
516 } 529 }
530#ifdef USE_CONSOLEKIT
531 monitor_permit(mon_dispatch, MONITOR_REQ_CONSOLEKIT_REGISTER, 1);
532#endif
517 533
518 for (;;) 534 for (;;)
519 monitor_read(pmonitor, mon_dispatch, NULL); 535 monitor_read(pmonitor, mon_dispatch, NULL);
@@ -2492,3 +2508,30 @@ mm_answer_jpake_check_confirm(int sock, Buffer *m)
2492} 2508}
2493 2509
2494#endif /* JPAKE */ 2510#endif /* JPAKE */
2511
2512#ifdef USE_CONSOLEKIT
2513int
2514mm_answer_consolekit_register(int sock, Buffer *m)
2515{
2516 Session *s;
2517 char *tty, *display;
2518 char *cookie = NULL;
2519
2520 debug3("%s entering", __func__);
2521
2522 tty = buffer_get_string(m, NULL);
2523 display = buffer_get_string(m, NULL);
2524 s = session_by_tty(tty);
2525 if (s != NULL)
2526 cookie = consolekit_register(s, display);
2527 buffer_clear(m);
2528 buffer_put_cstring(m, cookie != NULL ? cookie : "");
2529 mm_request_send(sock, MONITOR_ANS_CONSOLEKIT_REGISTER, m);
2530
2531 free(cookie);
2532 free(display);
2533 free(tty);
2534
2535 return (0);
2536}
2537#endif /* USE_CONSOLEKIT */