1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 05:12:40 +03:00

wezterm-ssh: fix parsing of proxycommand

refs: https://github.com/wez/wezterm/issues/3307
This commit is contained in:
Wez Furlong 2023-03-21 08:04:23 -07:00
parent b4f4264b00
commit c781be3124
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
2 changed files with 51 additions and 3 deletions

View File

@ -17,7 +17,8 @@ usually the best available version.
As features stabilize some brief notes about them will accumulate here.
#### Not Yet
#### Fixed
* ssh ProxyCommand didn't parse command lines containing `=` correctly. #3307
### 20230320-124340-559cb7b0

View File

@ -239,8 +239,7 @@ impl ParsedConfigFile {
}
if let Some(sep) = line
.find('=')
.or_else(|| line.find(|c: char| c.is_whitespace()))
.find(|c: char| c == '=' || c.is_whitespace())
{
let (k, v) = line.split_at(sep);
let k = k.trim().to_lowercase();
@ -739,6 +738,54 @@ mod test {
use super::*;
use k9::snapshot;
#[test]
fn parse_proxy_command() {
let mut config = Config::new();
config.add_config_string(
r#"
Host foo
ProxyCommand /usr/bin/ssh-proxy-helper -oX=Y host 22
"#,
);
snapshot!(
&config,
r#"
Config {
config_files: [
ParsedConfigFile {
options: {},
groups: [
MatchGroup {
criteria: [
Host(
[
Pattern {
negated: false,
pattern: "^foo$",
original: "foo",
is_literal: true,
},
],
),
],
context: FirstPass,
options: {
"proxycommand": "/usr/bin/ssh-proxy-helper -oX=Y host 22",
},
},
],
loaded_files: [],
},
],
options: {},
tokens: {},
environment: None,
}
"#
);
}
#[test]
fn parse_user() {
let mut config = Config::new();