[channels.c pathnames.h]
     use only one path to X11 UNIX domain socket vs. an array of paths
     to try.  report from djast@cs.toronto.edu.  ok markus@
This commit is contained in:
Damien Miller 2001-12-21 12:39:51 +11:00
parent faf2f6483a
commit 3afe375fd2
3 changed files with 23 additions and 25 deletions

View File

@ -3,6 +3,11 @@
server. I have found this necessary to avoid server hangs with X input
extensions (e.g. kinput2). Enable by setting the environment variable
"GNOME_SSH_ASKPASS_NOGRAB"
- OpenBSD CVS Sync
- stevesk@cvs.openbsd.org 2001/12/08 17:49:28
[channels.c pathnames.h]
use only one path to X11 UNIX domain socket vs. an array of paths
to try. report from djast@cs.toronto.edu. ok markus@
20011219
- (stevesk) OpenBSD CVS sync X11 localhost display
@ -7031,4 +7036,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.1693 2001/12/20 23:28:07 djm Exp $
$Id: ChangeLog,v 1.1694 2001/12/21 01:39:51 djm Exp $

View File

@ -39,7 +39,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: channels.c,v 1.146 2001/12/06 18:20:32 stevesk Exp $");
RCSID("$OpenBSD: channels.c,v 1.147 2001/12/08 17:49:28 stevesk Exp $");
#include "ssh.h"
#include "ssh1.h"
@ -54,6 +54,7 @@ RCSID("$OpenBSD: channels.c,v 1.146 2001/12/06 18:20:32 stevesk Exp $");
#include "canohost.h"
#include "key.h"
#include "authfd.h"
#include "pathnames.h"
/* -- channel core */
@ -2491,34 +2492,21 @@ x11_create_display_inet(int x11_display_offset, int gateway_ports)
return display_number;
}
#ifndef X_UNIX_PATH
#define X_UNIX_PATH "/tmp/.X11-unix/X"
#endif
static int
connect_local_xsocket(u_int dnr)
{
static const char *const x_sockets[] = {
X_UNIX_PATH "%u",
"/var/X/.X11-unix/X" "%u",
"/usr/spool/sockets/X11/" "%u",
NULL
};
int sock;
struct sockaddr_un addr;
const char *const * path;
for (path = x_sockets; *path; ++path) {
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
error("socket: %.100s", strerror(errno));
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof addr.sun_path, *path, dnr);
if (connect(sock, (struct sockaddr *) & addr, sizeof(addr)) == 0)
return sock;
close(sock);
}
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0)
error("socket: %.100s", strerror(errno));
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof addr.sun_path, _PATH_UNIX_X, dnr);
if (connect(sock, (struct sockaddr *) & addr, sizeof(addr)) == 0)
return sock;
close(sock);
error("connect %.100s: %.100s", addr.sun_path, strerror(errno));
return -1;
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: pathnames.h,v 1.9 2001/06/23 02:34:30 markus Exp $ */
/* $OpenBSD: pathnames.h,v 1.10 2001/12/08 17:49:28 stevesk Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -123,6 +123,11 @@
#define _PATH_XAUTH "/usr/X11R6/bin/xauth"
#endif
/* UNIX domain socket for X11 server; displaynum will replace %u */
#ifndef _PATH_UNIX_X
#define _PATH_UNIX_X "/tmp/.X11-unix/X%u"
#endif
/* for scp */
#ifndef _PATH_CP
#define _PATH_CP "cp"