summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r--monitor_wrap.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 69bc324b5..670b62dfb 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1516,3 +1516,34 @@ mm_jpake_check_confirm(const BIGNUM *k,
1516 return success; 1516 return success;
1517} 1517}
1518#endif /* JPAKE */ 1518#endif /* JPAKE */
1519
1520#ifdef USE_CONSOLEKIT
1521char *
1522mm_consolekit_register(Session *s, const char *display)
1523{
1524 Buffer m;
1525 char *cookie;
1526
1527 debug3("%s entering", __func__);
1528
1529 if (s->ttyfd == -1)
1530 return NULL;
1531 buffer_init(&m);
1532 buffer_put_cstring(&m, s->tty);
1533 buffer_put_cstring(&m, display != NULL ? display : "");
1534 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_CONSOLEKIT_REGISTER, &m);
1535 buffer_clear(&m);
1536
1537 mm_request_receive_expect(pmonitor->m_recvfd,
1538 MONITOR_ANS_CONSOLEKIT_REGISTER, &m);
1539 cookie = buffer_get_string(&m, NULL);
1540 buffer_free(&m);
1541
1542 /* treat empty cookie as missing cookie */
1543 if (strlen(cookie) == 0) {
1544 free(cookie);
1545 cookie = NULL;
1546 }
1547 return (cookie);
1548}
1549#endif /* USE_CONSOLEKIT */