Skip to content

Commit

Permalink
Allow skipping commented policy (#1870)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviraxp authored Jul 10, 2024
1 parent b056eac commit 4a1ebe4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions userspace/ksud/src/sepolicy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,11 @@ where
let mut statements = vec![];

for line in input.split(['\n', ';']) {
if line.trim().is_empty() {
let trimmed_line = line.trim();
if trimmed_line.is_empty() || trimmed_line.starts_with('#') {
continue;
}
if let Ok((_, statement)) = PolicyStatement::parse(line.trim()) {
if let Ok((_, statement)) = PolicyStatement::parse(trimmed_line) {
statements.push(statement);
} else if strict {
bail!("Failed to parse policy statement: {}", line)
Expand Down

0 comments on commit 4a1ebe4

Please sign in to comment.