jonathancammack / rpms / openssh

Forked from rpms/openssh 8 months ago
Clone

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

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