diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2023-01-13 02:58:21 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2023-01-13 02:58:21 +0000 |
commit | d6b05c545ea004660e40f5ad99770b1be590955f (patch) | |
tree | b28896b92bf564b3d861df15132bbee6dfa33c81 /usr.bin/ssh/ssh.c | |
parent | 8a0e7034344edc3c6ab1e5116a8fa9e94e60a6e2 (diff) |
Add a "Host" line to the output of ssh -G showing the original host arg.
Inspired by patch from vincent at bernat.ch via bz#3343, ok djm@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 9530902a330..9cbd69afb2f 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.582 2023/01/06 02:39:59 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.583 2023/01/13 02:58:20 dtucker Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -616,7 +616,7 @@ main(int ac, char **av) struct ssh *ssh = NULL; int i, r, opt, exit_status, use_syslog, direct, timeout_ms; int was_addr, config_test = 0, opt_terminated = 0, want_final_pass = 0; - char *p, *cp, *line, *argv0, *logfile, *host_arg; + char *p, *cp, *line, *argv0, *logfile; char cname[NI_MAXHOST], thishost[NI_MAXHOST]; struct stat st; struct passwd *pw; @@ -1083,7 +1083,7 @@ main(int ac, char **av) if (!host) usage(); - host_arg = xstrdup(host); + options.host_arg = xstrdup(host); #ifdef WITH_OPENSSL OpenSSL_add_all_algorithms(); @@ -1136,7 +1136,7 @@ main(int ac, char **av) logit("%s, %s", SSH_VERSION, SSH_OPENSSL_VERSION); /* Parse the configuration files */ - process_config_files(host_arg, pw, 0, &want_final_pass); + process_config_files(options.host_arg, pw, 0, &want_final_pass); if (want_final_pass) debug("configuration requests final Match pass"); @@ -1205,7 +1205,7 @@ main(int ac, char **av) debug("re-parsing configuration"); free(options.hostname); options.hostname = xstrdup(host); - process_config_files(host_arg, pw, 1, NULL); + process_config_files(options.host_arg, pw, 1, NULL); /* * Address resolution happens early with canonicalisation * enabled and the port number may have changed since, so @@ -1358,10 +1358,10 @@ main(int ac, char **av) xasprintf(&cinfo->uidstr, "%llu", (unsigned long long)pw->pw_uid); cinfo->keyalias = xstrdup(options.host_key_alias ? - options.host_key_alias : host_arg); + options.host_key_alias : options.host_arg); cinfo->conn_hash_hex = ssh_connection_hash(cinfo->thishost, host, cinfo->portstr, options.user); - cinfo->host_arg = xstrdup(host_arg); + cinfo->host_arg = xstrdup(options.host_arg); cinfo->remhost = xstrdup(host); cinfo->remuser = xstrdup(options.user); cinfo->homedir = xstrdup(pw->pw_dir); @@ -1538,8 +1538,8 @@ main(int ac, char **av) timeout_ms = options.connection_timeout * 1000; /* Open a connection to the remote host. */ - if (ssh_connect(ssh, host, host_arg, addrs, &hostaddr, options.port, - options.connection_attempts, + if (ssh_connect(ssh, host, options.host_arg, addrs, &hostaddr, + options.port, options.connection_attempts, &timeout_ms, options.tcp_keep_alive) != 0) exit(255); |