summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/monitor.c b/monitor.c
index 3a3d2f03b..12ed6fd00 100644
--- a/monitor.c
+++ b/monitor.c
@@ -104,6 +104,9 @@
104#include "authfd.h" 104#include "authfd.h"
105#include "match.h" 105#include "match.h"
106#include "ssherr.h" 106#include "ssherr.h"
107#ifdef USE_CONSOLEKIT
108#include "consolekit.h"
109#endif
107 110
108#ifdef GSSAPI 111#ifdef GSSAPI
109static Gssctxt *gsscontext = NULL; 112static Gssctxt *gsscontext = NULL;
@@ -169,6 +172,10 @@ int mm_answer_audit_command(int, Buffer *);
169 172
170static int monitor_read_log(struct monitor *); 173static int monitor_read_log(struct monitor *);
171 174
175#ifdef USE_CONSOLEKIT
176int mm_answer_consolekit_register(int, Buffer *);
177#endif
178
172static Authctxt *authctxt; 179static Authctxt *authctxt;
173 180
174#ifdef WITH_SSH1 181#ifdef WITH_SSH1
@@ -261,6 +268,9 @@ struct mon_table mon_dispatch_postauth20[] = {
261 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, 268 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
262 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command}, 269 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT, mm_answer_audit_command},
263#endif 270#endif
271#ifdef USE_CONSOLEKIT
272 {MONITOR_REQ_CONSOLEKIT_REGISTER, 0, mm_answer_consolekit_register},
273#endif
264 {0, 0, NULL} 274 {0, 0, NULL}
265}; 275};
266 276
@@ -306,6 +316,9 @@ struct mon_table mon_dispatch_postauth15[] = {
306 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event}, 316 {MONITOR_REQ_AUDIT_EVENT, MON_PERMIT, mm_answer_audit_event},
307 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command}, 317 {MONITOR_REQ_AUDIT_COMMAND, MON_PERMIT|MON_ONCE, mm_answer_audit_command},
308#endif 318#endif
319#ifdef USE_CONSOLEKIT
320 {MONITOR_REQ_CONSOLEKIT_REGISTER, 0, mm_answer_consolekit_register},
321#endif
309#endif /* WITH_SSH1 */ 322#endif /* WITH_SSH1 */
310 {0, 0, NULL} 323 {0, 0, NULL}
311}; 324};
@@ -488,6 +501,9 @@ monitor_child_postauth(struct monitor *pmonitor)
488 monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); 501 monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1);
489 monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); 502 monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1);
490 } 503 }
504#ifdef USE_CONSOLEKIT
505 monitor_permit(mon_dispatch, MONITOR_REQ_CONSOLEKIT_REGISTER, 1);
506#endif
491 507
492 for (;;) 508 for (;;)
493 monitor_read(pmonitor, mon_dispatch, NULL); 509 monitor_read(pmonitor, mon_dispatch, NULL);
@@ -2191,3 +2207,29 @@ mm_answer_gss_updatecreds(int socket, Buffer *m) {
2191 2207
2192#endif /* GSSAPI */ 2208#endif /* GSSAPI */
2193 2209
2210#ifdef USE_CONSOLEKIT
2211int
2212mm_answer_consolekit_register(int sock, Buffer *m)
2213{
2214 Session *s;
2215 char *tty, *display;
2216 char *cookie = NULL;
2217
2218 debug3("%s entering", __func__);
2219
2220 tty = buffer_get_string(m, NULL);
2221 display = buffer_get_string(m, NULL);
2222 s = session_by_tty(tty);
2223 if (s != NULL)
2224 cookie = consolekit_register(s, display);
2225 buffer_clear(m);
2226 buffer_put_cstring(m, cookie != NULL ? cookie : "");
2227 mm_request_send(sock, MONITOR_ANS_CONSOLEKIT_REGISTER, m);
2228
2229 free(cookie);
2230 free(display);
2231 free(tty);
2232
2233 return (0);
2234}
2235#endif /* USE_CONSOLEKIT */