summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh.c
diff options
context:
space:
mode:
authordtucker <dtucker@openbsd.org>2020-02-18 08:49:49 +0000
committerdtucker <dtucker@openbsd.org>2020-02-18 08:49:49 +0000
commitce2676d6dbcc3f4f450c7fe3ce21bc37e71c9002 (patch)
tree213045a5f1de2a06da8c500e4bcd8439a24e7c8b /usr.bin/ssh/ssh.c
parentFix an mbuf corruption issue which occurs in net80211 hostap mode. (diff)
downloadwireguard-openbsd-ce2676d6dbcc3f4f450c7fe3ce21bc37e71c9002.tar.xz
wireguard-openbsd-ce2676d6dbcc3f4f450c7fe3ce21bc37e71c9002.zip
Detect and prevent simple configuration loops when using ProxyJump.
bz#3057, ok djm@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-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