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-10-07 14:27:14 +0100
commitf51fe0c55e54c12db952624e980d18f39c41e581 (patch)
tree02f5526eaff2259689a4290b2646d0bf1c04f612 /monitor_wrap.c
parentaca34215fc0e85d6b49e04f0a3cd0db79732125e (diff)
Add support for registering ConsoleKit sessions on login
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450 Last-Updated: 2014-10-07 Patch-Name: consolekit.patch
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 */