- (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@
This commit is contained in:
Damien Miller 2009-01-21 16:46:26 +11:00
parent 1598d6bc55
commit 819dbb633a
2 changed files with 25 additions and 3 deletions

View File

@ -1,6 +1,9 @@
20090107 20090107
- (djm) [uidswap.c] bz#1412: Support >16 supplemental groups in OS X. - (djm) [uidswap.c] bz#1412: Support >16 supplemental groups in OS X.
Patch based on one from vgiffin AT apple.com; ok dtucker@ Patch based on one from vgiffin AT apple.com; ok dtucker@
- (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@
20090107 20090107
- (tim) [configure.ac defines.h openbsd-compat/port-uw.c - (tim) [configure.ac defines.h openbsd-compat/port-uw.c
@ -5000,5 +5003,5 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.5158 2009/01/21 05:04:24 djm Exp $ $Id: ChangeLog,v 1.5159 2009/01/21 05:46:26 djm Exp $

View File

@ -3078,7 +3078,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
} }
static int static int
connect_local_xsocket(u_int dnr) connect_local_xsocket_path(const char *pathname)
{ {
int sock; int sock;
struct sockaddr_un addr; struct sockaddr_un addr;
@ -3088,7 +3088,7 @@ connect_local_xsocket(u_int dnr)
error("socket: %.100s", strerror(errno)); error("socket: %.100s", strerror(errno));
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX; addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof addr.sun_path, _PATH_UNIX_X, dnr); strlcpy(addr.sun_path, pathname, sizeof addr.sun_path);
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0)
return sock; return sock;
close(sock); close(sock);
@ -3096,6 +3096,14 @@ connect_local_xsocket(u_int dnr)
return -1; return -1;
} }
static int
connect_local_xsocket(u_int dnr)
{
char buf[1024];
snprintf(buf, sizeof buf, _PATH_UNIX_X, dnr);
return connect_local_xsocket_path(buf);
}
int int
x11_connect_display(void) x11_connect_display(void)
{ {
@ -3117,6 +3125,17 @@ x11_connect_display(void)
* connection to the real X server. * connection to the real X server.
*/ */
/* Check if the display is from launchd. */
#ifdef __APPLE__
if (strncmp(display, "/tmp/launch", 11) == 0) {
sock = connect_local_xsocket_path(display);
if (sock < 0)
return -1;
/* OK, we now have a connection to the display. */
return sock;
}
#endif
/* /*
* Check if it is a unix domain socket. Unix domain displays are in * Check if it is a unix domain socket. Unix domain displays are in
* one of the following formats: unix:d[.s], :d[.s], ::d[.s] * one of the following formats: unix:d[.s], :d[.s], ::d[.s]