summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2020-02-18 08:49:50 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2020-02-18 08:49:50 +0000
commit9fff0427292ff68615401f70893dd784924d9e3f (patch)
tree5d67a5840cfa8fdd747da6f929b85a981eb0ec76
parent6b2f2bff46800a7981be3f06c542cadab65292bf (diff)
Detect and prevent simple configuration loops when using ProxyJump.
bz#3057, ok djm@
-rw-r--r--usr.bin/ssh/ssh.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 30365fb590d..211e3d1a1de 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/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
@@ -1187,6 +1187,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