| 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 |
if ($html) {
|
| 16 |
print "<html><title>testing security issues</title>\n";
|
| 17 |
print "<ul>\n";
|
| 18 |
}
|
| 19 |
|
| 20 |
sub formatout {
|
| 21 |
my $out=shift;
|
| 22 |
if ($html) {
|
| 23 |
$out=~s#((?:CAN|CVE)-\d+-\d+)#<a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=$1">$1</a>#g;
|
| 24 |
$out=~s{bug #(\d+)}{<a href="http://bugs.debian.org/$1">bug #$1</a>}g;
|
| 25 |
}
|
| 26 |
return $out;
|
| 27 |
}
|
| 28 |
|
| 29 |
my $unprop = my $unfixed = 0;
|
| 30 |
|
| 31 |
foreach my $list (@ARGV) {
|
| 32 |
if (-d $list) {
|
| 33 |
$list="$list/list";
|
| 34 |
}
|
| 35 |
|
| 36 |
open (IN, $list) || die "open $list: $!";
|
| 37 |
while (<IN>) {
|
| 38 |
chomp;
|
| 39 |
if (/^\[/) {
|
| 40 |
($id)=m/((?:DSA|CAN|CVE)-[^\s]+) /;
|
| 41 |
}
|
| 42 |
elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) {
|
| 43 |
$id=$1;
|
| 44 |
}
|
| 45 |
elsif (/^\s+[!-]\s+(.*?)\s+(.*)$/) {
|
| 46 |
my $package=$1;
|
| 47 |
my $version=$2;
|
| 48 |
|
| 49 |
my $maddy=`madison -s testing '$package'`;
|
| 50 |
next unless length $maddy; # skip if not in testing
|
| 51 |
|
| 52 |
if ($version=~/unfixed/) {
|
| 53 |
print "<li>" if $html;
|
| 54 |
print formatout("$package $version for $id\n");
|
| 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 |
print "<li>";
|
| 64 |
$havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>';
|
| 65 |
}
|
| 66 |
print formatout("$package $version needed, have $havver for $id\n");
|
| 67 |
$unprop++;
|
| 68 |
}
|
| 69 |
}
|
| 70 |
}
|
| 71 |
}
|
| 72 |
}
|
| 73 |
|
| 74 |
if ($html) {
|
| 75 |
print "</ul>\n";
|
| 76 |
print "<hr>\n";
|
| 77 |
print "Total unfixed: $unfixed<br>\n";
|
| 78 |
print "Total fixed in unstable but not testing: $unprop<br>\n";
|
| 79 |
print "Last update: ".`date`."<br>\n";
|
| 80 |
print "</html>\n";
|
| 81 |
}
|