We now support !<pattern>, which undoes the effect of a <pattern>
specified previously (perhaps in another file).
Note that the logic is a bit poor: !... only undoes the effect of an
identical (or equivalent) earlier pattern; it doesn't provide a
specific override.
Improving that would involve a more invasive change to
sg-report-flight which I don't want to do right now.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
next unless m/\S/;
next if m/^\#/;
s/\s+/ /g;
+ my $remove = s/^!\s*//;
die if m/ /g > 1;
$_ .= ' @@' unless m/ /;
s/\@\@/ '[^ ]*' /ge;
s/\@/ '[^ -\/]*' /ge;
$_= '^(?:'.$_.')$';
- print DEBUG "ALLOW $_\n";
- push @allows, $_;
+ my $entry = $_;
+ if (!$remove) {
+ print DEBUG "ALLOW $entry\n";
+ push @allows, $entry;
+ } else {
+ print DEBUG "DEALLOW $entry\n";
+ @allows = grep { $_ ne $entry } @allows;
+ }
}
A->error and die "$allowfile $!";
close A or die "$allowfile $!";