summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2017-08-12 06:46:02 +0000
committerDamien Miller <djm@cvs.openbsd.org>2017-08-12 06:46:02 +0000
commit83a616a919315d240b3bcea9950d6f5fa81e8fa6 (patch)
tree6e35cdc3953e023ba908832faaad29a20f38252f
parente2a2128b6ef8b0ce7a794ddd38cb1a86a57190bb (diff)
make "--" before the hostname terminate command-line option processing
completely; previous behaviour would not prevent further options appearing after the hostname (ssh has a supported options after the hostname for >20 years, so that's too late to change). ok deraadt@
-rw-r--r--usr.bin/ssh/ssh.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 61fbd28a44a..3733dfbfe09 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.461 2017/05/30 18:58:37 bluhm Exp $ */
+/* $OpenBSD: ssh.c,v 1.462 2017/08/12 06:46:01 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -493,13 +493,13 @@ int
main(int ac, char **av)
{
struct ssh *ssh = NULL;
- int i, r, opt, exit_status, use_syslog, direct, config_test = 0;
+ int i, r, opt, exit_status, use_syslog, direct, timeout_ms;
+ int config_test = 0, opt_terminated = 0;
char *p, *cp, *line, *argv0, buf[PATH_MAX], *host_arg, *logfile;
char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
char cname[NI_MAXHOST], uidstr[32], *conn_hash_hex;
struct stat st;
struct passwd *pw;
- int timeout_ms;
extern int optind, optreset;
extern char *optarg;
struct Forward fwd;
@@ -886,6 +886,9 @@ main(int ac, char **av)
}
}
+ if (optind > 1 && strcmp(av[optind - 1], "--") == 0)
+ opt_terminated = 1;
+
ac -= optind;
av += optind;
@@ -900,7 +903,7 @@ main(int ac, char **av)
host = xstrdup(++cp);
} else
host = xstrdup(*av);
- if (ac > 1) {
+ if (ac > 1 && !opt_terminated) {
optind = optreset = 1;
goto again;
}