summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@ubuntu.com>2014-02-09 16:09:57 +0000
committerColin Watson <cjwatson@debian.org>2014-02-09 16:18:07 +0000
commitcfae2bfa1e95cbb6c7a9799f13b82e8e804ca869 (patch)
tree5ae83026d7665faa8bb594f63ffb30333b8ccd0f /monitor_wrap.c
parentea2e0af0bc3a683edb32b508c03eb793617f6f31 (diff)
Add support for registering ConsoleKit sessions on login
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450 Last-Updated: 2013-09-14 Patch-Name: consolekit.patch
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 */