version 1.545, 2020/12/20 23:38:00 |
version 1.546, 2020/12/20 23:40:19 |
|
|
} |
} |
} |
} |
|
|
#define DEFAULT_CLIENT_PERCENT_EXPAND_ARGS \ |
|
"C", cinfo->conn_hash_hex, \ |
|
"L", cinfo->shorthost, \ |
|
"i", cinfo->uidstr, \ |
|
"k", cinfo->keyalias, \ |
|
"l", cinfo->thishost, \ |
|
"n", cinfo->host_arg, \ |
|
"p", cinfo->portstr |
|
|
|
/* |
/* |
* Expands the set of percent_expand options used by the majority of keywords |
* Expands the set of percent_expand options used by the majority of keywords |
* in the client that support percent expansion. |
* in the client that support percent expansion. |
|
|
const struct ssh_conn_info *cinfo) |
const struct ssh_conn_info *cinfo) |
{ |
{ |
return percent_expand(str, |
return percent_expand(str, |
/* values from statics above */ |
DEFAULT_CLIENT_PERCENT_EXPAND_ARGS(cinfo), |
DEFAULT_CLIENT_PERCENT_EXPAND_ARGS, |
|
/* values from arguments */ |
|
"d", cinfo->homedir, |
|
"h", cinfo->remhost, |
|
"r", cinfo->remuser, |
|
"u", cinfo->locuser, |
|
(char *)NULL); |
(char *)NULL); |
} |
} |
|
|
|
|
char *ret; |
char *ret; |
|
|
ret = percent_dollar_expand(str, |
ret = percent_dollar_expand(str, |
/* values from statics above */ |
DEFAULT_CLIENT_PERCENT_EXPAND_ARGS(cinfo), |
DEFAULT_CLIENT_PERCENT_EXPAND_ARGS, |
|
/* values from arguments */ |
|
"d", cinfo->homedir, |
|
"h", cinfo->remhost, |
|
"r", cinfo->remuser, |
|
"u", cinfo->locuser, |
|
(char *)NULL); |
(char *)NULL); |
if (ret == NULL) |
if (ret == NULL) |
fatal("invalid environment variable expansion"); |
fatal("invalid environment variable expansion"); |
|
|
|
|
/* Log into the remote system. Never returns if the login fails. */ |
/* Log into the remote system. Never returns if the login fails. */ |
ssh_login(ssh, &sensitive_data, host, (struct sockaddr *)&hostaddr, |
ssh_login(ssh, &sensitive_data, host, (struct sockaddr *)&hostaddr, |
options.port, pw, timeout_ms); |
options.port, pw, timeout_ms, cinfo); |
|
|
if (ssh_packet_connection_is_on_socket(ssh)) { |
if (ssh_packet_connection_is_on_socket(ssh)) { |
verbose("Authenticated to %s ([%s]:%d).", host, |
verbose("Authenticated to %s ([%s]:%d).", host, |
|
|
debug3("expanding LocalCommand: %s", options.local_command); |
debug3("expanding LocalCommand: %s", options.local_command); |
cp = options.local_command; |
cp = options.local_command; |
options.local_command = percent_expand(cp, |
options.local_command = percent_expand(cp, |
DEFAULT_CLIENT_PERCENT_EXPAND_ARGS, |
DEFAULT_CLIENT_PERCENT_EXPAND_ARGS(cinfo), |
"d", cinfo->homedir, |
|
"h", cinfo->remhost, |
|
"r", cinfo->remuser, |
|
"u", cinfo->locuser, |
|
"T", tun_fwd_ifname == NULL ? "NONE" : tun_fwd_ifname, |
"T", tun_fwd_ifname == NULL ? "NONE" : tun_fwd_ifname, |
(char *)NULL); |
(char *)NULL); |
debug3("expanded LocalCommand: %s", options.local_command); |
debug3("expanded LocalCommand: %s", options.local_command); |