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-03-20 00:32:21 +0000
commit7a26d16efb4ee303c8d66ee82caf9d0686f4a074 (patch)
tree131e8962617e1f41402ba2468ad331dd888c101a /monitor_wrap.c
parentef912859a4300360164292abe47b5516c8ee4a13 (diff)
Add support for registering ConsoleKit sessions on login
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450 Last-Updated: 2014-03-20 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 f75dc9d71..a8fb07b52 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1353,3 +1353,33 @@ mm_ssh_gssapi_update_creds(ssh_gssapi_ccache *store)
1353 1353
1354#endif /* GSSAPI */ 1354#endif /* GSSAPI */
1355 1355
1356#ifdef USE_CONSOLEKIT
1357char *
1358mm_consolekit_register(Session *s, const char *display)
1359{
1360 Buffer m;
1361 char *cookie;
1362
1363 debug3("%s entering", __func__);
1364
1365 if (s->ttyfd == -1)
1366 return NULL;
1367 buffer_init(&m);
1368 buffer_put_cstring(&m, s->tty);
1369 buffer_put_cstring(&m, display != NULL ? display : "");
1370 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_CONSOLEKIT_REGISTER, &m);
1371 buffer_clear(&m);
1372
1373 mm_request_receive_expect(pmonitor->m_recvfd,
1374 MONITOR_ANS_CONSOLEKIT_REGISTER, &m);
1375 cookie = buffer_get_string(&m, NULL);
1376 buffer_free(&m);
1377
1378 /* treat empty cookie as missing cookie */
1379 if (strlen(cookie) == 0) {
1380 free(cookie);
1381 cookie = NULL;
1382 }
1383 return (cookie);
1384}
1385#endif /* USE_CONSOLEKIT */