summaryrefslogtreecommitdiff
path: root/monitor_wrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r--monitor_wrap.c53
1 files changed, 51 insertions, 2 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 44019f32a..670b62dfb 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -320,10 +320,10 @@ mm_auth2_read_banner(void)
320 return (banner); 320 return (banner);
321} 321}
322 322
323/* Inform the privileged process about service and style */ 323/* Inform the privileged process about service, style, and role */
324 324
325void 325void
326mm_inform_authserv(char *service, char *style) 326mm_inform_authserv(char *service, char *style, char *role)
327{ 327{
328 Buffer m; 328 Buffer m;
329 329
@@ -332,12 +332,30 @@ mm_inform_authserv(char *service, char *style)
332 buffer_init(&m); 332 buffer_init(&m);
333 buffer_put_cstring(&m, service); 333 buffer_put_cstring(&m, service);
334 buffer_put_cstring(&m, style ? style : ""); 334 buffer_put_cstring(&m, style ? style : "");
335 buffer_put_cstring(&m, role ? role : "");
335 336
336 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m); 337 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m);
337 338
338 buffer_free(&m); 339 buffer_free(&m);
339} 340}
340 341
342/* Inform the privileged process about role */
343
344void
345mm_inform_authrole(char *role)
346{
347 Buffer m;
348
349 debug3("%s entering", __func__);
350
351 buffer_init(&m);
352 buffer_put_cstring(&m, role ? role : "");
353
354 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHROLE, &m);
355
356 buffer_free(&m);
357}
358
341/* Do the password authentication */ 359/* Do the password authentication */
342int 360int
343mm_auth_password(Authctxt *authctxt, char *password) 361mm_auth_password(Authctxt *authctxt, char *password)
@@ -1498,3 +1516,34 @@ mm_jpake_check_confirm(const BIGNUM *k,
1498 return success; 1516 return success;
1499} 1517}
1500#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 */