mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
Make "Host" pattern list handling consistent with OpenSSH
https://red.libssh.org/issues/187 Signed-off-by: Travers Carter <tcarter@noggin.com.au> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
2fe9c2e352
commit
bc2db86d1c
22
src/config.c
22
src/config.c
@@ -221,20 +221,24 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
|
||||
case SOC_HOST:
|
||||
*parsing = 0;
|
||||
lowerhost = (session->opts.host) ? ssh_lowercase(session->opts.host) : NULL;
|
||||
int ok = 0;
|
||||
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 (ok >= 0) {
|
||||
char *z = ssh_path_expand_escape(session, p);
|
||||
|
||||
if (z == NULL) {
|
||||
z = strdup(p);
|
||||
if (z == NULL) {
|
||||
z = strdup(p);
|
||||
}
|
||||
ok = match_hostname(lowerhost, z, strlen(z));
|
||||
if (ok < 0) {
|
||||
*parsing = 0;
|
||||
} else if (ok > 0) {
|
||||
*parsing = 1;
|
||||
}
|
||||
free(z);
|
||||
}
|
||||
ok = match_hostname(lowerhost, z, strlen(z));
|
||||
if (ok) {
|
||||
*parsing = 1;
|
||||
}
|
||||
free(z);
|
||||
}
|
||||
SAFE_FREE(lowerhost);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user