aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Hermann <alex@hexla.nl>2017-04-04 10:13:34 +0200
committerAndreas Schneider <asn@cryptomilk.org>2017-04-13 15:55:12 +0200
commit9ef7e90821b89fc99f349bd0944e3b4f08b28ddc (patch)
treec34841769e14a7d3d917a26137d9d9794d1eb731
parent38cb19268a960e1fc836c322b93755885a26cca4 (diff)
downloadlibssh-9ef7e90821b89fc99f349bd0944e3b4f08b28ddc.tar.gz
libssh-9ef7e90821b89fc99f349bd0944e3b4f08b28ddc.tar.xz
libssh-9ef7e90821b89fc99f349bd0944e3b4f08b28ddc.zip
config: Support expansion in the HostName variable
BUG: https://red.libssh.org/issues/127 The original "fix" for 127 was expanding the wrong variable: Host instead of HostName. Signed-off-by: Alex Hermann <alex@hexla.nl> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/config.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index dd6ec0a2..52563926 100644
--- a/src/config.c
+++ b/src/config.c
@@ -247,7 +247,12 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
case SOC_HOSTNAME:
p = ssh_config_get_str_tok(&s, NULL);
if (p && *parsing) {
- ssh_options_set(session, SSH_OPTIONS_HOST, p);
+ char *z = ssh_path_expand_escape(session, p);
+ if (z == NULL) {
+ z = strdup(p);
+ }
+ ssh_options_set(session, SSH_OPTIONS_HOST, z);
+ free(z);
}
break;
case SOC_PORT: