Bugzilla – Attachment 3547 Details for
Bug 3343
Display host provided as argument with "ssh -G"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Move host_arg into config struct and add to -G output
ssh-G-host.patch (text/plain), 3.40 KB, created by
Darren Tucker
on 2021-08-27 14:14:42 AEST
(
hide
)
Description:
Move host_arg into config struct and add to -G output
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2021-08-27 14:14:42 AEST
Size:
3.40 KB
patch
obsolete
>diff --git a/readconf.c b/readconf.c >index 03369a08..a1865dd5 100644 >--- a/readconf.c >+++ b/readconf.c >@@ -2291,6 +2291,7 @@ void > initialize_options(Options * options) > { > memset(options, 'X', sizeof(*options)); >+ options->host_arg = NULL; > options->forward_agent = -1; > options->forward_agent_sock_path = NULL; > options->forward_x11 = -1; >@@ -3225,6 +3226,7 @@ dump_client_config(Options *o, const char *host) > free(all_key); > > /* Most interesting options first: user, host, port */ >+ dump_cfg_string(oHost, o->host_arg); > dump_cfg_string(oUser, o->user); > dump_cfg_string(oHostname, host); > dump_cfg_int(oPort, o->port); >diff --git a/readconf.h b/readconf.h >index f7d53b06..26d6c2ed 100644 >--- a/readconf.h >+++ b/readconf.h >@@ -28,6 +28,7 @@ struct allowed_cname { > }; > > typedef struct { >+ char *host_arg; /* Host arg as specified on command line. */ > int forward_agent; /* Forward authentication agent. */ > char *forward_agent_sock_path; /* Optional path of the agent. */ > int forward_x11; /* Forward X11 display. */ >diff --git a/ssh.c b/ssh.c >index 533a6aa9..1c2323a6 100644 >--- a/ssh.c >+++ b/ssh.c >@@ -619,7 +619,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; >@@ -1096,7 +1096,7 @@ main(int ac, char **av) > if (!host) > usage(); > >- host_arg = xstrdup(host); >+ options.host_arg = xstrdup(host); > > /* Initialize the command to execute on remote host. */ > if ((command = sshbuf_new()) == NULL) >@@ -1142,7 +1142,7 @@ main(int ac, char **av) > logit("%s, %s", SSH_RELEASE, 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"); > >@@ -1211,7 +1211,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 >@@ -1363,10 +1363,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); >@@ -1543,8 +1543,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); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
djm
:
ok+
Actions:
View
|
Diff
Attachments on
bug 3343
:
3546
| 3547