summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-07-23 21:03:02 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-07-23 21:03:02 +0000
commitee8d52d008c03e5aa19e1bd9b0baaf5faa6cfbb8 (patch)
treea3cb96a630ed10969615c2bf8799dca9adb5c490
parent264ee307a8fd171dbb44121ec05b83f4143408cf (diff)
- stevesk@cvs.openbsd.org 2002/07/19 17:42:40
[ssh.c] display a warning from ssh when XAuthLocation does not exist or xauth returned no authentication data. ok markus@
-rw-r--r--ChangeLog6
-rw-r--r--ssh.c15
2 files changed, 17 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b92fd015..b3b77567d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
5 [log.c log.h session.c sshd.c] 5 [log.c log.h session.c sshd.c]
6 remove fatal cleanups after fork; based on discussions with and code 6 remove fatal cleanups after fork; based on discussions with and code
7 from solar. 7 from solar.
8 - stevesk@cvs.openbsd.org 2002/07/19 17:42:40
9 [ssh.c]
10 display a warning from ssh when XAuthLocation does not exist or xauth
11 returned no authentication data. ok markus@
8 12
920020722 1320020722
10 - (bal) AIX tty data limiting patch fix by leigh@solinno.co.uk 14 - (bal) AIX tty data limiting patch fix by leigh@solinno.co.uk
@@ -1428,4 +1432,4 @@
1428 - (stevesk) entropy.c: typo in debug message 1432 - (stevesk) entropy.c: typo in debug message
1429 - (djm) ssh-keygen -i needs seeded RNG; report from markus@ 1433 - (djm) ssh-keygen -i needs seeded RNG; report from markus@
1430 1434
1431$Id: ChangeLog,v 1.2395 2002/07/23 21:01:56 mouring Exp $ 1435$Id: ChangeLog,v 1.2396 2002/07/23 21:03:02 mouring Exp $
diff --git a/ssh.c b/ssh.c
index 77e709daf..fec93be0d 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: ssh.c,v 1.181 2002/07/03 14:21:05 markus Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.182 2002/07/19 17:42:40 stevesk Exp $");
44 44
45#include <openssl/evp.h> 45#include <openssl/evp.h>
46#include <openssl/err.h> 46#include <openssl/err.h>
@@ -734,11 +734,19 @@ x11_get_proto(char **_proto, char **_data)
734 FILE *f; 734 FILE *f;
735 int got_data = 0, i; 735 int got_data = 0, i;
736 char *display; 736 char *display;
737 struct stat st;
737 738
738 *_proto = proto; 739 *_proto = proto;
739 *_data = data; 740 *_data = data;
740 proto[0] = data[0] = '\0'; 741 proto[0] = data[0] = '\0';
741 if (options.xauth_location && (display = getenv("DISPLAY"))) { 742 if (!options.xauth_location ||
743 (stat(options.xauth_location, &st) == -1)) {
744 debug("No xauth program.");
745 } else {
746 if ((display = getenv("DISPLAY")) == NULL) {
747 debug("x11_get_proto: DISPLAY not set");
748 return;
749 }
742 /* Try to get Xauthority information for the display. */ 750 /* Try to get Xauthority information for the display. */
743 if (strncmp(display, "localhost:", 10) == 0) 751 if (strncmp(display, "localhost:", 10) == 0)
744 /* 752 /*
@@ -753,7 +761,7 @@ x11_get_proto(char **_proto, char **_data)
753 else 761 else
754 snprintf(line, sizeof line, "%s list %.200s 2>" 762 snprintf(line, sizeof line, "%s list %.200s 2>"
755 _PATH_DEVNULL, options.xauth_location, display); 763 _PATH_DEVNULL, options.xauth_location, display);
756 debug2("x11_get_proto %s", line); 764 debug2("x11_get_proto: %s", line);
757 f = popen(line, "r"); 765 f = popen(line, "r");
758 if (f && fgets(line, sizeof(line), f) && 766 if (f && fgets(line, sizeof(line), f) &&
759 sscanf(line, "%*s %511s %511s", proto, data) == 2) 767 sscanf(line, "%*s %511s %511s", proto, data) == 2)
@@ -772,6 +780,7 @@ x11_get_proto(char **_proto, char **_data)
772 if (!got_data) { 780 if (!got_data) {
773 u_int32_t rand = 0; 781 u_int32_t rand = 0;
774 782
783 log("Warning: No xauth data; using fake authentication data for X11 forwarding.");
775 strlcpy(proto, "MIT-MAGIC-COOKIE-1", sizeof proto); 784 strlcpy(proto, "MIT-MAGIC-COOKIE-1", sizeof proto);
776 for (i = 0; i < 16; i++) { 785 for (i = 0; i < 16; i++) {
777 if (i % 4 == 0) 786 if (i % 4 == 0)