summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-02-05 02:12:09 +0100
committerDamien Miller <djm@mindrot.org>2002-02-05 02:12:09 +0100
commit35b13d633b542b38645f476440829cbabe6a3102 (patch)
treee950e20d08039af360dcba1ad334b0df116d37f0
parent - stevesk@cvs.openbsd.org 2002/01/27 14:57:46 (diff)
downloadopenssh-35b13d633b542b38645f476440829cbabe6a3102.tar.xz
openssh-35b13d633b542b38645f476440829cbabe6a3102.zip
- stevesk@cvs.openbsd.org 2002/01/27 18:08:17
[ssh.c] handle simple case to identify FamilyLocal display; ok markus@
-rw-r--r--ChangeLog5
-rw-r--r--ssh.c21
2 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 77c564004..5b31c8063 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,9 @@
- stevesk@cvs.openbsd.org 2002/01/27 14:57:46
[channels.c servconf.c servconf.h session.c sshd.8 sshd_config]
add X11UseLocalhost; ok markus@
+ - stevesk@cvs.openbsd.org 2002/01/27 18:08:17
+ [ssh.c]
+ handle simple case to identify FamilyLocal display; ok markus@
20020130
- (djm) Delay PRNG seeding until we need it in ssh-keygen, from markus@
@@ -7427,4 +7430,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.1805 2002/02/05 01:11:34 djm Exp $
+$Id: ChangeLog,v 1.1806 2002/02/05 01:12:09 djm Exp $
diff --git a/ssh.c b/ssh.c
index 8e1604e21..46d9d747a 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.158 2002/01/16 13:17:51 markus Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.159 2002/01/27 18:08:17 stevesk Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@@ -793,14 +793,27 @@ x11_get_proto(char **_proto, char **_data)
static char proto[512], data[512];
FILE *f;
int got_data = 0, i;
+ char *display;
*_proto = proto;
*_data = data;
proto[0] = data[0] = '\0';
- if (options.xauth_location) {
+ if (options.xauth_location && (display = getenv("DISPLAY"))) {
/* Try to get Xauthority information for the display. */
- snprintf(line, sizeof line, "%.100s list %.200s 2>" _PATH_DEVNULL,
- options.xauth_location, getenv("DISPLAY"));
+ if (strncmp(display, "localhost:", 10) == 0)
+ /*
+ * Handle FamilyLocal case where $DISPLAY does
+ * not match an authorization entry. For this we
+ * just try "xauth list unix:displaynum.screennum".
+ * XXX: "localhost" match to determine FamilyLocal
+ * is not perfect.
+ */
+ snprintf(line, sizeof line, "%.100s list unix:%s 2>"
+ _PATH_DEVNULL, options.xauth_location, display+10);
+ else
+ snprintf(line, sizeof line, "%.100s list %.200s 2>"
+ _PATH_DEVNULL, options.xauth_location, display);
+ debug2("x11_get_proto %s", line);
f = popen(line, "r");
if (f && fgets(line, sizeof(line), f) &&
sscanf(line, "%*s %511s %511s", proto, data) == 2)