summaryrefslogtreecommitdiff
path: root/security/hpn-ssh/files/patch-cookie
blob: 4b7d3b7c7d73f34ef54c4a095b5b81602a79cd1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--- channels.c.orig	Tue Apr 17 14:55:03 2001
+++ channels.c	Sat Jun  9 06:43:41 2001
@@ -1612,7 +1612,7 @@
 		switch (channels[i].type) {
 		case SSH_CHANNEL_AUTH_SOCKET:
 			close(channels[i].sock);
-			unlink(channels[i].path);
+			/* auth_sock_cleanup_proc deletes the socket */
 			channel_free(i);
 			break;
 		case SSH_CHANNEL_PORT_LISTENER:
--- session.c.orig	Sun Jun 17 05:40:51 2001
+++ session.c	Sun Aug 19 18:20:27 2001
@@ -235,6 +235,7 @@
 	int success, type, n_bytes, plen, screen_flag, have_pty = 0;
 	int compression_level = 0, enable_compression_after_reply = 0;
 	u_int proto_len, data_len, dlen;
+	struct stat st;
 
 	s = session_new();
 	s->pw = authctxt->pw;
@@ -317,7 +318,8 @@
 				packet_send_debug("X11 forwarding disabled in server configuration file.");
 				break;
 			}
-			if (!options.xauth_location) {
+			if (!options.xauth_location ||
+			    (stat(options.xauth_location, &st) == -1)) {
 				packet_send_debug("No xauth program; cannot forward with spoofing.");
 				break;
 			}
@@ -1384,10 +1386,11 @@
 	if (!options.use_login) {
 		/* ignore _PATH_SSH_USER_RC for subsystems */
 		if (!s->is_subsystem && (stat(_PATH_SSH_USER_RC, &st) >= 0)) {
+			snprintf(cmd, sizeof cmd, "%s -c '%s %s'",
+			    shell, _PATH_BSHELL, _PATH_SSH_USER_RC);
 			if (debug_flag)
-				fprintf(stderr, "Running %s %s\n", _PATH_BSHELL,
-				    _PATH_SSH_USER_RC);
-			f = popen(_PATH_BSHELL " " _PATH_SSH_USER_RC, "w");
+				fprintf(stderr, "Running %s\n", cmd);
+			f = popen(cmd, "w");
 			if (f) {
 				if (do_xauth)
 					fprintf(f, "%s %s\n", s->auth_proto,
@@ -1707,12 +1710,19 @@
 int
 session_x11_req(Session *s)
 {
+	struct stat st;
+
 	if (no_x11_forwarding_flag) {
 		debug("X11 forwarding disabled in user configuration file.");
 		return 0;
 	}
 	if (!options.x11_forwarding) {
 		debug("X11 forwarding disabled in server configuration file.");
+		return 0;
+	}
+	if (!options.xauth_location ||
+            (stat(options.xauth_location, &st) == -1)) {
+		packet_send_debug("No xauth program; cannot forward with spoofig.");
 		return 0;
 	}
 	debug("Received request for X11 forwarding with auth spoofing.");