summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-12-21 12:39:51 +1100
committerDamien Miller <djm@mindrot.org>2001-12-21 12:39:51 +1100
commit3afe375fd288327716a4a6f1cfc05b1ff6535152 (patch)
tree0bc97870274a29ecd6276a3fa1ac38ea8a0d0212
parentfaf2f6483a344a3f7d73181dd5f154a9c7fa0c7c (diff)
- 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@
-rw-r--r--ChangeLog7
-rw-r--r--channels.c34
-rw-r--r--pathnames.h7
3 files changed, 23 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index dbdd62479..503e9a70b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
3 server. I have found this necessary to avoid server hangs with X input 3 server. I have found this necessary to avoid server hangs with X input
4 extensions (e.g. kinput2). Enable by setting the environment variable 4 extensions (e.g. kinput2). Enable by setting the environment variable
5 "GNOME_SSH_ASKPASS_NOGRAB" 5 "GNOME_SSH_ASKPASS_NOGRAB"
6 - OpenBSD CVS Sync
7 - stevesk@cvs.openbsd.org 2001/12/08 17:49:28
8 [channels.c pathnames.h]
9 use only one path to X11 UNIX domain socket vs. an array of paths
10 to try. report from djast@cs.toronto.edu. ok markus@
6 11
720011219 1220011219
8 - (stevesk) OpenBSD CVS sync X11 localhost display 13 - (stevesk) OpenBSD CVS sync X11 localhost display
@@ -7031,4 +7036,4 @@
7031 - Wrote replacements for strlcpy and mkdtemp 7036 - Wrote replacements for strlcpy and mkdtemp
7032 - Released 1.0pre1 7037 - Released 1.0pre1
7033 7038
7034$Id: ChangeLog,v 1.1693 2001/12/20 23:28:07 djm Exp $ 7039$Id: ChangeLog,v 1.1694 2001/12/21 01:39:51 djm Exp $
diff --git a/channels.c b/channels.c
index 40a86dccb..97a865f56 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.146 2001/12/06 18:20:32 stevesk Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.147 2001/12/08 17:49:28 stevesk Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -54,6 +54,7 @@ RCSID("$OpenBSD: channels.c,v 1.146 2001/12/06 18:20:32 stevesk Exp $");
54#include "canohost.h" 54#include "canohost.h"
55#include "key.h" 55#include "key.h"
56#include "authfd.h" 56#include "authfd.h"
57#include "pathnames.h"
57 58
58 59
59/* -- channel core */ 60/* -- channel core */
@@ -2491,34 +2492,21 @@ x11_create_display_inet(int x11_display_offset, int gateway_ports)
2491 return display_number; 2492 return display_number;
2492} 2493}
2493 2494
2494#ifndef X_UNIX_PATH
2495#define X_UNIX_PATH "/tmp/.X11-unix/X"
2496#endif
2497
2498static int 2495static int
2499connect_local_xsocket(u_int dnr) 2496connect_local_xsocket(u_int dnr)
2500{ 2497{
2501 static const char *const x_sockets[] = {
2502 X_UNIX_PATH "%u",
2503 "/var/X/.X11-unix/X" "%u",
2504 "/usr/spool/sockets/X11/" "%u",
2505 NULL
2506 };
2507 int sock; 2498 int sock;
2508 struct sockaddr_un addr; 2499 struct sockaddr_un addr;
2509 const char *const * path;
2510 2500
2511 for (path = x_sockets; *path; ++path) { 2501 sock = socket(AF_UNIX, SOCK_STREAM, 0);
2512 sock = socket(AF_UNIX, SOCK_STREAM, 0); 2502 if (sock < 0)
2513 if (sock < 0) 2503 error("socket: %.100s", strerror(errno));
2514 error("socket: %.100s", strerror(errno)); 2504 memset(&addr, 0, sizeof(addr));
2515 memset(&addr, 0, sizeof(addr)); 2505 addr.sun_family = AF_UNIX;
2516 addr.sun_family = AF_UNIX; 2506 snprintf(addr.sun_path, sizeof addr.sun_path, _PATH_UNIX_X, dnr);
2517 snprintf(addr.sun_path, sizeof addr.sun_path, *path, dnr); 2507 if (connect(sock, (struct sockaddr *) & addr, sizeof(addr)) == 0)
2518 if (connect(sock, (struct sockaddr *) & addr, sizeof(addr)) == 0) 2508 return sock;
2519 return sock; 2509 close(sock);
2520 close(sock);
2521 }
2522 error("connect %.100s: %.100s", addr.sun_path, strerror(errno)); 2510 error("connect %.100s: %.100s", addr.sun_path, strerror(errno));
2523 return -1; 2511 return -1;
2524} 2512}
diff --git a/pathnames.h b/pathnames.h
index 0470a2159..1b223e392 100644
--- a/pathnames.h
+++ b/pathnames.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: pathnames.h,v 1.9 2001/06/23 02:34:30 markus Exp $ */ 1/* $OpenBSD: pathnames.h,v 1.10 2001/12/08 17:49:28 stevesk Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -123,6 +123,11 @@
123#define _PATH_XAUTH "/usr/X11R6/bin/xauth" 123#define _PATH_XAUTH "/usr/X11R6/bin/xauth"
124#endif 124#endif
125 125
126/* UNIX domain socket for X11 server; displaynum will replace %u */
127#ifndef _PATH_UNIX_X
128#define _PATH_UNIX_X "/tmp/.X11-unix/X%u"
129#endif
130
126/* for scp */ 131/* for scp */
127#ifndef _PATH_CP 132#ifndef _PATH_CP
128#define _PATH_CP "cp" 133#define _PATH_CP "cp"