# [--xsadir xsadir] --xsa xsafile
use strict;
+# Disabled warnings as
+# - if ( @{ $XSA_TO_INDEX_MATCH{$e} } ) throws an error, while
+# if ( defined @{ $XSA_TO_INDEX_MATCH{$e} } ) works but warns
+no warnings 'deprecated';
+no warnings 'experimental';
+
use warnings;
use 5.010;
use Getopt::Long qw(GetOptions);
# PRINT REPORT
my @XSA_LIST;
my %XSA_TO_INDEX;
+my %XSA_TO_INDEX_AUX; # Contains *.patch files deemed not important
+my %XSA_TO_INDEX_MATCH; # Contains *.patch files matching a version
preparedatabyxsa();
printreport();
for ($i=0; $i <= $#XSA; $i++) {
push @{ $XSA_TO_INDEX{$XSA[$i]} }, $i;
+
+ # Check $XSA_PATCH[$i] against @XSA_REGEXFORVERSION
+ # If there is a match put in %XSA_TO_INDEX_MATCH
+ # Otherwise in %XSA_TO_INDEX_AUX
+ my $rx = join "|", @XSA_REGEXFORVERSION;
+
+ if ($XSA_PATCH[$i] =~ /$rx/) {
+ push @{ $XSA_TO_INDEX_MATCH{$XSA[$i]} }, $i;
+ } else {
+ push @{ $XSA_TO_INDEX_AUX{$XSA[$i]} }, $i;
+ }
}
}
foreach $e (@XSA_LIST)
{
printheadline($e);
- printlistheader();
- foreach $i ( @{ $XSA_TO_INDEX{$e} } ) {
- printxsadetail_byindex($i, $debug);
+ if ( defined @{ $XSA_TO_INDEX_MATCH{$e} } ) {
+ printlistheader("Comparisons specific to $VERSION.$MAJOR:",
+ "BLACK");
+ foreach $i ( @{ $XSA_TO_INDEX_MATCH{$e} } ) {
+ printxsadetail_byindex($i, "RED", $debug);
+ }
+ printlistend();
+
+ printseparator();
+ }
+
+ if ( defined @{ $XSA_TO_INDEX_AUX{$e} } ) {
+ printlistheader("Other comparisons (can probably be ignored):",
+ "GRAY");
+ foreach $i ( @{ $XSA_TO_INDEX_AUX{$e} } ) {
+ printxsadetail_byindex($i, "GRAY", $debug);
+ }
+ printlistend();
}
- printlistend();
}
}
sub printxsadetail_byindex {
my $i = shift;
+ my $nomatchcolor = shift;
my $debug = shift;
my $i_correct = $i+1;
if ($HTML) {
- printf(' <li>');
+ if ( $XSA_IN[$i] eq "in NONE" ) {
+ printf(' <li style="color:%s;">', $nomatchcolor);
+ } else {
+ printf(' <li>');
+ }
printf('<a href="http://xenbits.xenproject.org/xsa/%s">%s</a> ',
$XSA_PATCH[$i], $XSA_PATCH[$i]);
printf(' <b>%s</b> ', $XSA_IN[$i]);
sub printseparator {
- if ($HTML) {
- printf('<hr>');
- }
printf("\n");
}
sub printlistheader {
+ my $text = shift;
+ my $color = shift;
if ($HTML) {
- printf('<ul> ');
+ printf('<p style="color:%s;">%s</p>', $color, $text);
+ printf('<ul style="color:%s;"> ', $color);
+ printf("\n");
+ } else {
+ printf("== %s ==\n", $text);
printf("\n");
}
}