diff options
Diffstat (limited to 'lib/MGA/Advisories.pm')
-rw-r--r-- | lib/MGA/Advisories.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index 0115438..9ebe35e 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -328,9 +328,18 @@ sub newadv { } sub listadv { - my ($advdb) = @_; - print map { "$_ . $advdb->{advisories}{$_}{subject}\n" } - adv_sort($advdb, keys %{$advdb->{advisories}}); + my ($advdb, @filter) = @_; + my @advlist = keys %{$advdb->{advisories}}; + foreach my $f (@filter) { + my $l = $advdb->{by_type}{$f} || $advdb->{by_cve}{$f} + || $advdb->{by_rel}{$f} || $advdb->{by_media}{$f} + || $advdb->{by_src}{$f} || []; + my %z; + @z{@$l} = (1) x @$l; + @advlist = grep { $z{$_} } @advlist; + } + print map { "$_ . $advdb->{advisories}{$_}{subject}\n" } + adv_sort($advdb, @advlist); } sub showadv { |