rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone

Blame SOURCES/openssh-5.2p1-allow-ip-opts.patch

f09e2e
diff -up openssh-5.2p1/canohost.c.ip-opts openssh-5.2p1/canohost.c
f09e2e
--- openssh-5.2p1/canohost.c.ip-opts	2009-02-14 06:28:21.000000000 +0100
f09e2e
+++ openssh-5.2p1/canohost.c	2009-09-01 15:31:29.000000000 +0200
f09e2e
@@ -169,12 +169,27 @@ check_ip_options(int sock, char *ipaddr)
f09e2e
 	option_size = sizeof(options);
f09e2e
 	if (getsockopt(sock, ipproto, IP_OPTIONS, options,
f09e2e
 	    &option_size) >= 0 && option_size != 0) {
f09e2e
-		text[0] = '\0';
f09e2e
-		for (i = 0; i < option_size; i++)
f09e2e
-			snprintf(text + i*3, sizeof(text) - i*3,
f09e2e
-			    " %2.2x", options[i]);
f09e2e
-		fatal("Connection from %.100s with IP options:%.800s",
f09e2e
-		    ipaddr, text);
f09e2e
+		i = 0;
f09e2e
+		do {
f09e2e
+			switch (options[i]) {
f09e2e
+				case 0:
f09e2e
+				case 1:
f09e2e
+					++i;
f09e2e
+					break;
f09e2e
+				case 131:
f09e2e
+				case 137:
f09e2e
+				/* Fail, fatally, if we detect either loose or strict
f09e2e
+			 	 * source routing options. */
f09e2e
+					text[0] = '\0';
f09e2e
+					for (i = 0; i < option_size; i++)
f09e2e
+						snprintf(text + i*3, sizeof(text) - i*3,
f09e2e
+							" %2.2x", options[i]);
f09e2e
+					fatal("Connection from %.100s with IP options:%.800s",
f09e2e
+						ipaddr, text);
f09e2e
+				default:
f09e2e
+					i += options[i + 1];
f09e2e
+			}
f09e2e
+		} while (i < option_size);
f09e2e
 	}
f09e2e
 #endif /* IP_OPTIONS */
f09e2e
 }