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