summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r--monitor_wrap.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 6dc890a77..4c57d4df3 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1363,3 +1363,33 @@ mm_ssh_gssapi_update_creds(ssh_gssapi_ccache *store)
1363 1363
1364#endif /* GSSAPI */ 1364#endif /* GSSAPI */
1365 1365
1366#ifdef USE_CONSOLEKIT
1367char *
1368mm_consolekit_register(Session *s, const char *display)
1369{
1370 Buffer m;
1371 char *cookie;
1372
1373 debug3("%s entering", __func__);
1374
1375 if (s->ttyfd == -1)
1376 return NULL;
1377 buffer_init(&m);
1378 buffer_put_cstring(&m, s->tty);
1379 buffer_put_cstring(&m, display != NULL ? display : "");
1380 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_CONSOLEKIT_REGISTER, &m);
1381 buffer_clear(&m);
1382
1383 mm_request_receive_expect(pmonitor->m_recvfd,
1384 MONITOR_ANS_CONSOLEKIT_REGISTER, &m);
1385 cookie = buffer_get_string(&m, NULL);
1386 buffer_free(&m);
1387
1388 /* treat empty cookie as missing cookie */
1389 if (strlen(cookie) == 0) {
1390 free(cookie);
1391 cookie = NULL;
1392 }
1393 return (cookie);
1394}
1395#endif /* USE_CONSOLEKIT */