summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog1
-rw-r--r--debian/patches/consolekit.patch22
-rw-r--r--monitor.c56
-rw-r--r--monitor_wrap.c62
4 files changed, 68 insertions, 73 deletions
diff --git a/debian/changelog b/debian/changelog
index d0f19f9fe..d498fed04 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ openssh (1:6.2p1-2) UNRELEASED; urgency=low
2 2
3 * Fix build failure on Ubuntu: 3 * Fix build failure on Ubuntu:
4 - Include openbsd-compat/sys-queue.h from consolekit.c. 4 - Include openbsd-compat/sys-queue.h from consolekit.c.
5 - Fix consolekit mismerges in monitor.c and monitor_wrap.c.
5 6
6 -- Colin Watson <cjwatson@debian.org> Thu, 09 May 2013 00:55:50 +0100 7 -- Colin Watson <cjwatson@debian.org> Thu, 09 May 2013 00:55:50 +0100
7 8
diff --git a/debian/patches/consolekit.patch b/debian/patches/consolekit.patch
index 0d0a3d9d6..abc6839ba 100644
--- a/debian/patches/consolekit.patch
+++ b/debian/patches/consolekit.patch
@@ -553,10 +553,11 @@ Index: b/monitor.c
553 553
554 for (;;) 554 for (;;)
555 monitor_read(pmonitor, mon_dispatch, NULL); 555 monitor_read(pmonitor, mon_dispatch, NULL);
556@@ -2232,6 +2248,34 @@ 556@@ -2472,3 +2488,31 @@
557 buffer_put_int(m, major); 557 }
558 buffer_put_string(m, hash.value, hash.length);
559 558
559 #endif /* JPAKE */
560+
560+#ifdef USE_CONSOLEKIT 561+#ifdef USE_CONSOLEKIT
561+int 562+int
562+mm_answer_consolekit_register(int sock, Buffer *m) 563+mm_answer_consolekit_register(int sock, Buffer *m)
@@ -584,10 +585,6 @@ Index: b/monitor.c
584+ return (0); 585+ return (0);
585+} 586+}
586+#endif /* USE_CONSOLEKIT */ 587+#endif /* USE_CONSOLEKIT */
587+
588 mm_request_send(socket, MONITOR_ANS_GSSSIGN, m);
589
590 gss_release_buffer(&minor, &hash);
591Index: b/monitor.h 588Index: b/monitor.h
592=================================================================== 589===================================================================
593--- a/monitor.h 590--- a/monitor.h
@@ -605,10 +602,10 @@ Index: b/monitor_wrap.c
605=================================================================== 602===================================================================
606--- a/monitor_wrap.c 603--- a/monitor_wrap.c
607+++ b/monitor_wrap.c 604+++ b/monitor_wrap.c
608@@ -1311,6 +1311,37 @@ 605@@ -1514,3 +1514,34 @@
609 mm_ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_desc *data, gss_buffer_desc *hash) 606 return success;
610 { 607 }
611 Buffer m; 608 #endif /* JPAKE */
612+ 609+
613+#ifdef USE_CONSOLEKIT 610+#ifdef USE_CONSOLEKIT
614+char * 611+char *
@@ -640,9 +637,6 @@ Index: b/monitor_wrap.c
640+ return (cookie); 637+ return (cookie);
641+} 638+}
642+#endif /* USE_CONSOLEKIT */ 639+#endif /* USE_CONSOLEKIT */
643 OM_uint32 major;
644 u_int len;
645
646Index: b/monitor_wrap.h 640Index: b/monitor_wrap.h
647=================================================================== 641===================================================================
648--- a/monitor_wrap.h 642--- a/monitor_wrap.h
diff --git a/monitor.c b/monitor.c
index 9b08020ca..a9021fc4d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2248,34 +2248,6 @@ mm_answer_gss_sign(int socket, Buffer *m)
2248 buffer_put_int(m, major); 2248 buffer_put_int(m, major);
2249 buffer_put_string(m, hash.value, hash.length); 2249 buffer_put_string(m, hash.value, hash.length);
2250 2250
2251#ifdef USE_CONSOLEKIT
2252int
2253mm_answer_consolekit_register(int sock, Buffer *m)
2254{
2255 Session *s;
2256 char *tty, *display;
2257 char *cookie = NULL;
2258
2259 debug3("%s entering", __func__);
2260
2261 tty = buffer_get_string(m, NULL);
2262 display = buffer_get_string(m, NULL);
2263 s = session_by_tty(tty);
2264 if (s != NULL)
2265 cookie = consolekit_register(s, display);
2266 buffer_clear(m);
2267 buffer_put_cstring(m, cookie != NULL ? cookie : "");
2268 mm_request_send(sock, MONITOR_ANS_CONSOLEKIT_REGISTER, m);
2269
2270 if (cookie != NULL)
2271 xfree(cookie);
2272 xfree(display);
2273 xfree(tty);
2274
2275 return (0);
2276}
2277#endif /* USE_CONSOLEKIT */
2278
2279 mm_request_send(socket, MONITOR_ANS_GSSSIGN, m); 2251 mm_request_send(socket, MONITOR_ANS_GSSSIGN, m);
2280 2252
2281 gss_release_buffer(&minor, &hash); 2253 gss_release_buffer(&minor, &hash);
@@ -2516,3 +2488,31 @@ mm_answer_jpake_check_confirm(int sock, Buffer *m)
2516} 2488}
2517 2489
2518#endif /* JPAKE */ 2490#endif /* JPAKE */
2491
2492#ifdef USE_CONSOLEKIT
2493int
2494mm_answer_consolekit_register(int sock, Buffer *m)
2495{
2496 Session *s;
2497 char *tty, *display;
2498 char *cookie = NULL;
2499
2500 debug3("%s entering", __func__);
2501
2502 tty = buffer_get_string(m, NULL);
2503 display = buffer_get_string(m, NULL);
2504 s = session_by_tty(tty);
2505 if (s != NULL)
2506 cookie = consolekit_register(s, display);
2507 buffer_clear(m);
2508 buffer_put_cstring(m, cookie != NULL ? cookie : "");
2509 mm_request_send(sock, MONITOR_ANS_CONSOLEKIT_REGISTER, m);
2510
2511 if (cookie != NULL)
2512 xfree(cookie);
2513 xfree(display);
2514 xfree(tty);
2515
2516 return (0);
2517}
2518#endif /* USE_CONSOLEKIT */
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 8cc76b380..e62650342 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1311,37 +1311,6 @@ OM_uint32
1311mm_ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_desc *data, gss_buffer_desc *hash) 1311mm_ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_desc *data, gss_buffer_desc *hash)
1312{ 1312{
1313 Buffer m; 1313 Buffer m;
1314
1315#ifdef USE_CONSOLEKIT
1316char *
1317mm_consolekit_register(Session *s, const char *display)
1318{
1319 Buffer m;
1320 char *cookie;
1321
1322 debug3("%s entering", __func__);
1323
1324 if (s->ttyfd == -1)
1325 return NULL;
1326 buffer_init(&m);
1327 buffer_put_cstring(&m, s->tty);
1328 buffer_put_cstring(&m, display != NULL ? display : "");
1329 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_CONSOLEKIT_REGISTER, &m);
1330 buffer_clear(&m);
1331
1332 mm_request_receive_expect(pmonitor->m_recvfd,
1333 MONITOR_ANS_CONSOLEKIT_REGISTER, &m);
1334 cookie = buffer_get_string(&m, NULL);
1335 buffer_free(&m);
1336
1337 /* treat empty cookie as missing cookie */
1338 if (strlen(cookie) == 0) {
1339 xfree(cookie);
1340 cookie = NULL;
1341 }
1342 return (cookie);
1343}
1344#endif /* USE_CONSOLEKIT */
1345 OM_uint32 major; 1314 OM_uint32 major;
1346 u_int len; 1315 u_int len;
1347 1316
@@ -1545,3 +1514,34 @@ mm_jpake_check_confirm(const BIGNUM *k,
1545 return success; 1514 return success;
1546} 1515}
1547#endif /* JPAKE */ 1516#endif /* JPAKE */
1517
1518#ifdef USE_CONSOLEKIT
1519char *
1520mm_consolekit_register(Session *s, const char *display)
1521{
1522 Buffer m;
1523 char *cookie;
1524
1525 debug3("%s entering", __func__);
1526
1527 if (s->ttyfd == -1)
1528 return NULL;
1529 buffer_init(&m);
1530 buffer_put_cstring(&m, s->tty);
1531 buffer_put_cstring(&m, display != NULL ? display : "");
1532 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_CONSOLEKIT_REGISTER, &m);
1533 buffer_clear(&m);
1534
1535 mm_request_receive_expect(pmonitor->m_recvfd,
1536 MONITOR_ANS_CONSOLEKIT_REGISTER, &m);
1537 cookie = buffer_get_string(&m, NULL);
1538 buffer_free(&m);
1539
1540 /* treat empty cookie as missing cookie */
1541 if (strlen(cookie) == 0) {
1542 xfree(cookie);
1543 cookie = NULL;
1544 }
1545 return (cookie);
1546}
1547#endif /* USE_CONSOLEKIT */