| 1 |
#!/usr/bin/perl
|
| 2 |
# Must run on a machine with madison.
|
| 3 |
use URI::Escape;
|
| 4 |
|
| 5 |
my $html=0;
|
| 6 |
if ($ARGV[0] eq 'html') {
|
| 7 |
shift;
|
| 8 |
$html=1;
|
| 9 |
}
|
| 10 |
|
| 11 |
if (! @ARGV) {
|
| 12 |
die "usage: $0 [html] list\n";
|
| 13 |
}
|
| 14 |
|
| 15 |
|
| 16 |
my %data;
|
| 17 |
my $unprop = my $unfixed = 0;
|
| 18 |
|
| 19 |
sub record {
|
| 20 |
my ($package, $condition, $item)=@_;
|
| 21 |
|
| 22 |
if ($html) {
|
| 23 |
$condition=~s{bug #(\d+)}{<a href="http://bugs.debian.org/$1">bug #$1</a>}g;
|
| 24 |
$item=~s#((?:CAN|CVE)-\d+-\d+)#<a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=$1">$1</a>#g;
|
| 25 |
}
|
| 26 |
|
| 27 |
push @{$data{$package}{$condition}}, $item;
|
| 28 |
}
|
| 29 |
|
| 30 |
foreach my $list (@ARGV) {
|
| 31 |
if (-d $list) {
|
| 32 |
$list="$list/list";
|
| 33 |
}
|
| 34 |
|
| 35 |
open (IN, $list) || die "open $list: $!";
|
| 36 |
while (<IN>) {
|
| 37 |
chomp;
|
| 38 |
if (/^\[/) {
|
| 39 |
($id)=m/((?:DSA|CAN|CVE)-[^\s]+) /;
|
| 40 |
}
|
| 41 |
elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) {
|
| 42 |
$id=$1;
|
| 43 |
}
|
| 44 |
elsif (/^\s+[!-]\s+(.*?)\s+(.*)$/) {
|
| 45 |
my $package=$1;
|
| 46 |
my $version=$2;
|
| 47 |
|
| 48 |
my $maddy=`madison -s testing '$package'`;
|
| 49 |
if (! length $maddy) {
|
| 50 |
next;
|
| 51 |
}
|
| 52 |
|
| 53 |
if ($version=~/unfixed/) {
|
| 54 |
record($package, $version, $id);
|
| 55 |
$unfixed++;
|
| 56 |
}
|
| 57 |
else {
|
| 58 |
my @fields = split(/\s*\|\s*/, $maddy);
|
| 59 |
my $havver=$fields[1];
|
| 60 |
my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'");
|
| 61 |
if ($cmp != 0) {
|
| 62 |
if ($html) {
|
| 63 |
$havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>';
|
| 64 |
}
|
| 65 |
record($package, "$version needed, have $havver", $id);
|
| 66 |
$unprop++;
|
| 67 |
}
|
| 68 |
}
|
| 69 |
}
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
| 73 |
|
| 74 |
if ($html) {
|
| 75 |
print "<html><title>testing security issues</title>\n";
|
| 76 |
print "<ul>\n";
|
| 77 |
}
|
| 78 |
|
| 79 |
foreach my $package (sort keys %data) {
|
| 80 |
foreach my $condition (sort keys %{$data{$package}}) {
|
| 81 |
print "<li>" if $html;
|
| 82 |
print "$package $condition for ";
|
| 83 |
my $items=0;
|
| 84 |
foreach my $item (sort @{$data{$package}{$condition}}) {
|
| 85 |
print ", " if $items > 0;
|
| 86 |
print $item;
|
| 87 |
$items++;
|
| 88 |
}
|
| 89 |
print "\n";
|
| 90 |
}
|
| 91 |
}
|
| 92 |
|
| 93 |
if ($html) {
|
| 94 |
print "</ul>\n";
|
| 95 |
print "<hr>\n";
|
| 96 |
print "Total holes unfixed: $unfixed<br>\n";
|
| 97 |
print "Total holes fixed in unstable but not testing: $unprop<br>\n";
|
| 98 |
print "Last update: ".`date`."<br>\n";
|
| 99 |
print "</html>\n";
|
| 100 |
}
|