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
*/
#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"
#include "canohost.h"
#include "key.h"
#include "authfd.h"
+#include "pathnames.h"
/* -- channel core */
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;
}
-/* $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>
#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"