jonathancammack / rpms / openssh

Forked from rpms/openssh 8 months ago
Clone

Blame SOURCES/openssh-8.0p1-proxyjump-loops.patch

0d83e7
From de1f3564cd85915b3002859873a37cb8d31ac9ce Mon Sep 17 00:00:00 2001
0d83e7
From: "dtucker@openbsd.org" <dtucker@openbsd.org>
0d83e7
Date: Tue, 18 Feb 2020 08:49:49 +0000
0d83e7
Subject: [PATCH] upstream: Detect and prevent simple configuration loops when
0d83e7
 using
0d83e7
0d83e7
ProxyJump. bz#3057, ok djm@
0d83e7
0d83e7
OpenBSD-Commit-ID: 077d21c564c886c98309d871ed6f8ef267b9f037
0d83e7
---
0d83e7
 ssh.c | 10 +++++++++-
0d83e7
 1 file changed, 9 insertions(+), 1 deletion(-)
0d83e7
0d83e7
diff --git a/ssh.c b/ssh.c
0d83e7
index 15aee569e..a983a108b 100644
0d83e7
--- a/ssh.c
0d83e7
+++ b/ssh.c
0d83e7
@@ -1208,6 +1208,14 @@ main(int ac, char **av)
0d83e7
 	if (options.jump_host != NULL) {
0d83e7
 		char port_s[8];
0d83e7
 		const char *sshbin = argv0;
0d83e7
+		int port = options.port, jumpport = options.jump_port;
0d83e7
+
0d83e7
+		if (port <= 0)
0d83e7
+			port = default_ssh_port();
0d83e7
+		if (jumpport <= 0)
0d83e7
+			jumpport = default_ssh_port();
0d83e7
+		if (strcmp(options.jump_host, host) == 0 && port == jumpport)
0d83e7
+			fatal("jumphost loop via %s", options.jump_host);
0d83e7
 
0d83e7
 		/*
0d83e7
 		 * Try to use SSH indicated by argv[0], but fall back to
0d83e7