aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-21 12:30:32 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-21 12:30:32 +0100
commit32ba84dac7d82e043c8189b24ff5dfcab01bb052 (patch)
tree4aa26fa7f4a40c22726e1999321eedac40bf1c12 /src
parent7f806b7c68e60cda6f312ea81dc135c05ac94a02 (diff)
downloadlibssh-32ba84dac7d82e043c8189b24ff5dfcab01bb052.tar.gz
libssh-32ba84dac7d82e043c8189b24ff5dfcab01bb052.tar.xz
libssh-32ba84dac7d82e043c8189b24ff5dfcab01bb052.zip
config: Support expansion in the Host variable too.
BUG: https://red.libssh.org/issues/127
Diffstat (limited to 'src')
-rw-r--r--src/config.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/config.c b/src/config.c
index 850928d9..c8c05160 100644
--- a/src/config.c
+++ b/src/config.c
@@ -219,16 +219,25 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
switch (opcode) {
case SOC_HOST:
- *parsing = 0;
- lowerhost = (session->opts.host) ? ssh_lowercase(session->opts.host) : NULL;
- for (p = ssh_config_get_str_tok(&s, NULL); p && *p;
- p = ssh_config_get_str_tok(&s, NULL)) {
- if (match_hostname(lowerhost, p, strlen(p))) {
- *parsing = 1;
+ *parsing = 0;
+ lowerhost = (session->opts.host) ? ssh_lowercase(session->opts.host) : NULL;
+ for (p = ssh_config_get_str_tok(&s, NULL);
+ p != NULL && p[0] != '\0';
+ p = ssh_config_get_str_tok(&s, NULL)) {
+ char *z = ssh_path_expand_escape(session, p);
+ int ok;
+
+ if (z == NULL) {
+ z = strdup(p);
+ }
+ ok = match_hostname(lowerhost, z, strlen(z));
+ if (ok) {
+ *parsing = 1;
+ }
+ free(z);
}
- }
- SAFE_FREE(lowerhost);
- break;
+ SAFE_FREE(lowerhost);
+ break;
case SOC_HOSTNAME:
p = ssh_config_get_str_tok(&s, NULL);
if (p && *parsing) {