diff options
author | 2020-07-31 04:19:37 +0000 | |
---|---|---|
committer | 2020-07-31 04:19:37 +0000 | |
commit | b767a9add6bd96e4a9fd1bdea2396fbc9742b125 (patch) | |
tree | eb2b779be11db09c58db0cbdf270fa9fd1151a89 /usr.bin/ssh/ssh.c | |
parent | route(8)'s "-T" takes an rtable, not an rdomain (diff) | |
download | wireguard-openbsd-b767a9add6bd96e4a9fd1bdea2396fbc9742b125.tar.xz wireguard-openbsd-b767a9add6bd96e4a9fd1bdea2396fbc9742b125.zip |
Also compare username when checking for JumpHost loops. bz#3057, ok djm@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 701e8a8a21d..524351b119b 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.533 2020/07/17 03:43:42 dtucker Exp $ */ +/* $OpenBSD: ssh.c,v 1.534 2020/07/31 04:19:37 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1235,19 +1235,25 @@ main(int ac, char **av) /* Fill configuration defaults. */ fill_default_options(&options); + if (options.user == NULL) + options.user = xstrdup(pw->pw_name); + /* * If ProxyJump option specified, then construct a ProxyCommand now. */ if (options.jump_host != NULL) { char port_s[8]; - const char *sshbin = argv0; + const char *jumpuser = options.jump_user, *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) + if (jumpuser == NULL) + jumpuser = options.user; + if (strcmp(options.jump_host, host) == 0 && port == jumpport && + strcmp(options.user, jumpuser) == 0) fatal("jumphost loop via %s", options.jump_host); /* @@ -1350,9 +1356,6 @@ main(int ac, char **av) tty_flag = 0; } - if (options.user == NULL) - options.user = xstrdup(pw->pw_name); - /* Set up strings used to percent_expand() arguments */ if (gethostname(thishost, sizeof(thishost)) == -1) fatal("gethostname: %s", strerror(errno)); |