Skip to content

Commit 5515bad

Browse files
Fix parsing bug where includes are skipped (MisterTea#2)
Upstream PR: MisterTea#686 The SSH config parser avoids parsing everything inside a `Host` block that does not match the host we are trying to connect to. This makes sense, but the implementation fails on some cases. Consider the following: `et host.company` ``` Host other.company User someone Include ~/.ssh/host.company ``` And inside `~/.ssh/host.company` we have: ``` Host host.company User gabriel ``` The way the parser works now is: * Sees the `Host other.company` and sets `parsing = 0` because it does not match the target `host.company`. * Skips processing the `Include` completely because `parsing = 0`. * Misses the actual configs defined for `Host host.company`. This PR simply does not ignore `Include` directives to avoid such cases.
1 parent e495d38 commit 5515bad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/terminal/ParseConfigFile.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ static int ssh_config_parse_line(const char *targethost,
12451245
case SOC_INCLUDE: /* recursive include of other files */
12461246

12471247
p = ssh_config_get_str_tok(&s, NULL);
1248-
if (p && *parsing) {
1248+
if (p) {
12491249
char *filename = ssh_path_expand_tilde(p);
12501250
if (filename) {
12511251
local_parse_file(targethost, options, filename, parsing, seen);

0 commit comments

Comments
 (0)