jonathancammack / rpms / openssh

Forked from rpms/openssh 8 months ago
Clone

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

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