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 6ae72a03b..2a0fe9bf6 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1151,3 +1151,33 @@ mm_ssh_gssapi_update_creds(ssh_gssapi_ccache *store)
1151 1151
1152#endif /* GSSAPI */ 1152#endif /* GSSAPI */
1153 1153
1154#ifdef USE_CONSOLEKIT
1155char *
1156mm_consolekit_register(Session *s, const char *display)
1157{
1158 Buffer m;
1159 char *cookie;
1160
1161 debug3("%s entering", __func__);
1162
1163 if (s->ttyfd == -1)
1164 return NULL;
1165 buffer_init(&m);
1166 buffer_put_cstring(&m, s->tty);
1167 buffer_put_cstring(&m, display != NULL ? display : "");
1168 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_CONSOLEKIT_REGISTER, &m);
1169 buffer_clear(&m);
1170
1171 mm_request_receive_expect(pmonitor->m_recvfd,
1172 MONITOR_ANS_CONSOLEKIT_REGISTER, &m);
1173 cookie = buffer_get_string(&m, NULL);
1174 buffer_free(&m);
1175
1176 /* treat empty cookie as missing cookie */
1177 if (strlen(cookie) == 0) {
1178 free(cookie);
1179 cookie = NULL;
1180 }
1181 return (cookie);
1182}
1183#endif /* USE_CONSOLEKIT */