diff options
author | Colin Watson <cjwatson@ubuntu.com> | 2014-02-09 16:09:57 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2015-08-19 17:09:56 +0100 |
commit | 1197fd975ab8fd11b1ac83557ef750129b16c0d8 (patch) | |
tree | ab0af14bf4b460ffcb98e1aa6bb5d3f7032acf7d /monitor_wrap.c | |
parent | 5496170cd67abb653e385277bd83b69f1b10905d (diff) |
Add support for registering ConsoleKit sessions on login
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1450
Last-Updated: 2015-08-19
Patch-Name: consolekit.patch
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r-- | monitor_wrap.c | 30 |
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 | ||
1155 | char * | ||
1156 | mm_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 */ | ||