Skip to content

Commit

Permalink
detect incorrect KEY=value in env_keep and env_check
Browse files Browse the repository at this point in the history
  • Loading branch information
squell committed Feb 25, 2025
1 parent 82dff61 commit 3127edf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/sudoers/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,11 @@ impl Parse for defaults::SettingsModifier {
make(result)
} else {
let EnvVar(name) = expect_nonterminal(stream)?;

make(vec![name])
if is_syntax('=', stream)? {
unrecoverable!(stream, "double quotes are required for VAR=value pairs")
} else {
make(vec![name])
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ fn key_value_no_match() -> Result<()> {
}

#[test]
#[ignore = "gh345"]
fn key_value_syntax_needs_double_quotes() -> Result<()> {
super::key_value_syntax_needs_double_quotes(ENV_LIST)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ fn key_value_no_match() -> Result<()> {
}

#[test]
#[ignore = "gh345"]
fn key_value_syntax_needs_double_quotes() -> Result<()> {
super::key_value_syntax_needs_double_quotes(ENV_LIST)
}
Expand Down

0 comments on commit 3127edf

Please sign in to comment.