]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Detect and prevent simple configuration loops when using
authordtucker@openbsd.org <dtucker@openbsd.org>
Tue, 18 Feb 2020 08:49:49 +0000 (08:49 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Tue, 18 Feb 2020 09:23:25 +0000 (20:23 +1100)
ProxyJump. bz#3057, ok djm@

OpenBSD-Commit-ID: 077d21c564c886c98309d871ed6f8ef267b9f037

ssh.c

diff --git a/ssh.c b/ssh.c
index 15aee569e55d91839ce5f414a25e6aa0e528ef82..a983a108b43a88ab7acfc58788db4bb43702229f 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.519 2020/02/07 03:54:44 dtucker Exp $ */
+/* $OpenBSD: ssh.c,v 1.520 2020/02/18 08:49:49 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1208,6 +1208,14 @@ main(int ac, char **av)
        if (options.jump_host != NULL) {
                char port_s[8];
                const char *sshbin = argv0;
+               int port = options.port, jumpport = options.jump_port;
+
+               if (port <= 0)
+                       port = default_ssh_port();
+               if (jumpport <= 0)
+                       jumpport = default_ssh_port();
+               if (strcmp(options.jump_host, host) == 0 && port == jumpport)
+                       fatal("jumphost loop via %s", options.jump_host);
 
                /*
                 * Try to use SSH indicated by argv[0], but fall back to