summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2009-01-21 16:46:26 +1100
committerDamien Miller <djm@mindrot.org>2009-01-21 16:46:26 +1100
commit819dbb633af6e1970c6b3275882c85d458441500 (patch)
tree4ea9645c9b263ab5cac06a0c117890948bd5720c
parent1598d6bc559b766e1fde83d9d9e4929d2694b090 (diff)
- (djm) [channels.c] bz#1419: support "on demand" X11 forwarding via
launchd on OS X; patch from vgiffin AT apple.com, slightly tweaked; ok dtucker@
-rw-r--r--ChangeLog5
-rw-r--r--channels.c23
2 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c0204b068..f2c556c1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
120090107 120090107
2 - (djm) [uidswap.c] bz#1412: Support >16 supplemental groups in OS X. 2 - (djm) [uidswap.c] bz#1412: Support >16 supplemental groups in OS X.
3 Patch based on one from vgiffin AT apple.com; ok dtucker@ 3 Patch based on one from vgiffin AT apple.com; ok dtucker@
4 - (djm) [channels.c] bz#1419: support "on demand" X11 forwarding via
5 launchd on OS X; patch from vgiffin AT apple.com, slightly tweaked;
6 ok dtucker@
4 7
520090107 820090107
6 - (tim) [configure.ac defines.h openbsd-compat/port-uw.c 9 - (tim) [configure.ac defines.h openbsd-compat/port-uw.c
@@ -5000,5 +5003,5 @@
5000 OpenServer 6 and add osr5bigcrypt support so when someone migrates 5003 OpenServer 6 and add osr5bigcrypt support so when someone migrates
5001 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 5004 passwords between UnixWare and OpenServer they will still work. OK dtucker@
5002 5005
5003$Id: ChangeLog,v 1.5158 2009/01/21 05:04:24 djm Exp $ 5006$Id: ChangeLog,v 1.5159 2009/01/21 05:46:26 djm Exp $
5004 5007
diff --git a/channels.c b/channels.c
index 5b7d6d649..8fcba783e 100644
--- a/channels.c
+++ b/channels.c
@@ -3078,7 +3078,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
3078} 3078}
3079 3079
3080static int 3080static int
3081connect_local_xsocket(u_int dnr) 3081connect_local_xsocket_path(const char *pathname)
3082{ 3082{
3083 int sock; 3083 int sock;
3084 struct sockaddr_un addr; 3084 struct sockaddr_un addr;
@@ -3088,7 +3088,7 @@ connect_local_xsocket(u_int dnr)
3088 error("socket: %.100s", strerror(errno)); 3088 error("socket: %.100s", strerror(errno));
3089 memset(&addr, 0, sizeof(addr)); 3089 memset(&addr, 0, sizeof(addr));
3090 addr.sun_family = AF_UNIX; 3090 addr.sun_family = AF_UNIX;
3091 snprintf(addr.sun_path, sizeof addr.sun_path, _PATH_UNIX_X, dnr); 3091 strlcpy(addr.sun_path, pathname, sizeof addr.sun_path);
3092 if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) 3092 if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0)
3093 return sock; 3093 return sock;
3094 close(sock); 3094 close(sock);
@@ -3096,6 +3096,14 @@ connect_local_xsocket(u_int dnr)
3096 return -1; 3096 return -1;
3097} 3097}
3098 3098
3099static int
3100connect_local_xsocket(u_int dnr)
3101{
3102 char buf[1024];
3103 snprintf(buf, sizeof buf, _PATH_UNIX_X, dnr);
3104 return connect_local_xsocket_path(buf);
3105}
3106
3099int 3107int
3100x11_connect_display(void) 3108x11_connect_display(void)
3101{ 3109{
@@ -3117,6 +3125,17 @@ x11_connect_display(void)
3117 * connection to the real X server. 3125 * connection to the real X server.
3118 */ 3126 */
3119 3127
3128 /* Check if the display is from launchd. */
3129#ifdef __APPLE__
3130 if (strncmp(display, "/tmp/launch", 11) == 0) {
3131 sock = connect_local_xsocket_path(display);
3132 if (sock < 0)
3133 return -1;
3134
3135 /* OK, we now have a connection to the display. */
3136 return sock;
3137 }
3138#endif
3120 /* 3139 /*
3121 * Check if it is a unix domain socket. Unix domain displays are in 3140 * Check if it is a unix domain socket. Unix domain displays are in
3122 * one of the following formats: unix:d[.s], :d[.s], ::d[.s] 3141 * one of the following formats: unix:d[.s], :d[.s], ::d[.s]