diff options
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -97,6 +97,9 @@ | |||
97 | #include "ssh2.h" | 97 | #include "ssh2.h" |
98 | #include "jpake.h" | 98 | #include "jpake.h" |
99 | #include "roaming.h" | 99 | #include "roaming.h" |
100 | #ifdef USE_CONSOLEKIT | ||
101 | #include "consolekit.h" | ||
102 | #endif | ||
100 | 103 | ||
101 | #ifdef GSSAPI | 104 | #ifdef GSSAPI |
102 | static Gssctxt *gsscontext = NULL; | 105 | static Gssctxt *gsscontext = NULL; |
@@ -192,6 +195,10 @@ int mm_answer_audit_command(int, Buffer *); | |||
192 | 195 | ||
193 | static int monitor_read_log(struct monitor *); | 196 | static int monitor_read_log(struct monitor *); |
194 | 197 | ||
198 | #ifdef USE_CONSOLEKIT | ||
199 | int mm_answer_consolekit_register(int, Buffer *); | ||
200 | #endif | ||
201 | |||
195 | static Authctxt *authctxt; | 202 | static Authctxt *authctxt; |
196 | static BIGNUM *ssh1_challenge = NULL; /* used for ssh1 rsa auth */ | 203 | static BIGNUM *ssh1_challenge = NULL; /* used for ssh1 rsa auth */ |
197 | 204 | ||
@@ -283,6 +290,9 @@ struct mon_table mon_dispatch_postauth20[] = { | |||
283 | {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, | 290 | {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, |
284 | {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command}, | 291 | {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command}, |
285 | #endif | 292 | #endif |
293 | #ifdef USE_CONSOLEKIT | ||
294 | {MONITOR_REQ_CONSOLEKIT_REGISTER, 0, mm_answer_consolekit_register}, | ||
295 | #endif | ||
286 | {0, 0, NULL} | 296 | {0, 0, NULL} |
287 | }; | 297 | }; |
288 | 298 | ||
@@ -325,6 +335,9 @@ struct mon_table mon_dispatch_postauth15[] = { | |||
325 | {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, | 335 | {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, |
326 | {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command}, | 336 | {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command}, |
327 | #endif | 337 | #endif |
338 | #ifdef USE_CONSOLEKIT | ||
339 | {MONITOR_REQ_CONSOLEKIT_REGISTER, 0, mm_answer_consolekit_register}, | ||
340 | #endif | ||
328 | {0, 0, NULL} | 341 | {0, 0, NULL} |
329 | }; | 342 | }; |
330 | 343 | ||
@@ -495,6 +508,9 @@ monitor_child_postauth(struct monitor *pmonitor) | |||
495 | monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); | 508 | monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); |
496 | monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); | 509 | monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); |
497 | } | 510 | } |
511 | #ifdef USE_CONSOLEKIT | ||
512 | monitor_permit(mon_dispatch, MONITOR_REQ_CONSOLEKIT_REGISTER, 1); | ||
513 | #endif | ||
498 | 514 | ||
499 | for (;;) | 515 | for (;;) |
500 | monitor_read(pmonitor, mon_dispatch, NULL); | 516 | monitor_read(pmonitor, mon_dispatch, NULL); |
@@ -2196,6 +2212,34 @@ mm_answer_gss_sign(int socket, Buffer *m) | |||
2196 | buffer_put_int(m, major); | 2212 | buffer_put_int(m, major); |
2197 | buffer_put_string(m, hash.value, hash.length); | 2213 | buffer_put_string(m, hash.value, hash.length); |
2198 | 2214 | ||
2215 | #ifdef USE_CONSOLEKIT | ||
2216 | int | ||
2217 | mm_answer_consolekit_register(int sock, Buffer *m) | ||
2218 | { | ||
2219 | Session *s; | ||
2220 | char *tty, *display; | ||
2221 | char *cookie = NULL; | ||
2222 | |||
2223 | debug3("%s entering", __func__); | ||
2224 | |||
2225 | tty = buffer_get_string(m, NULL); | ||
2226 | display = buffer_get_string(m, NULL); | ||
2227 | s = session_by_tty(tty); | ||
2228 | if (s != NULL) | ||
2229 | cookie = consolekit_register(s, display); | ||
2230 | buffer_clear(m); | ||
2231 | buffer_put_cstring(m, cookie != NULL ? cookie : ""); | ||
2232 | mm_request_send(sock, MONITOR_ANS_CONSOLEKIT_REGISTER, m); | ||
2233 | |||
2234 | if (cookie != NULL) | ||
2235 | xfree(cookie); | ||
2236 | xfree(display); | ||
2237 | xfree(tty); | ||
2238 | |||
2239 | return (0); | ||
2240 | } | ||
2241 | #endif /* USE_CONSOLEKIT */ | ||
2242 | |||
2199 | mm_request_send(socket, MONITOR_ANS_GSSSIGN, m); | 2243 | mm_request_send(socket, MONITOR_ANS_GSSSIGN, m); |
2200 | 2244 | ||
2201 | gss_release_buffer(&minor, &hash); | 2245 | gss_release_buffer(&minor, &hash); |