| 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 |
|
|
print "<title>testing security issues</title>\n"; |
| 16 |
|
|
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 |
31 |
foreach my $list (@ARGV) { |
| 29 |
|
|
if (-d $list) { |
| 30 |
|
|
$list="$list/list"; |
| 31 |
joeyh |
2 |
} |
| 32 |
joeyh |
31 |
|
| 33 |
|
|
open (IN, $list) || die "open $list: $!"; |
| 34 |
|
|
while (<IN>) { |
| 35 |
|
|
chomp; |
| 36 |
|
|
if (/^\[/) { |
| 37 |
joeyh |
58 |
($id)=m/((?:DSA|CAN|CVE)-.*?) /; |
| 38 |
joeyh |
2 |
} |
| 39 |
joeyh |
58 |
elsif (/^(DSA|CAN|CVE)-/) { |
| 40 |
joeyh |
31 |
$id=$_; |
| 41 |
|
|
} |
| 42 |
|
|
elsif (/^\s+[!-]\s+(.*?)\s+(.*)$/) { |
| 43 |
|
|
my $package=$1; |
| 44 |
|
|
my $version=$2; |
| 45 |
|
|
if ($version=~/unfixed/) { |
| 46 |
joeyh |
231 |
print "<li>" if $html; |
| 47 |
|
|
print formatout("$package $version for $id\n"); |
| 48 |
joeyh |
31 |
next; |
| 49 |
joeyh |
2 |
} |
| 50 |
joeyh |
31 |
my $maddy=`madison -s testing '$package'`; |
| 51 |
|
|
if (length $maddy) { |
| 52 |
|
|
my @fields = split(/\s*\|\s*/, $maddy); |
| 53 |
joeyh |
230 |
my $havver=$fields[1]; |
| 54 |
|
|
my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'"); |
| 55 |
joeyh |
31 |
if ($cmp != 0) { |
| 56 |
joeyh |
230 |
if ($html) { |
| 57 |
|
|
print "<li>"; |
| 58 |
joeyh |
231 |
$havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.$package.'">'.$havver.'</a>'; |
| 59 |
joeyh |
230 |
} |
| 60 |
joeyh |
231 |
print formatout("$package $version needed, have $havver for $id\n"); |
| 61 |
joeyh |
31 |
} |
| 62 |
|
|
} |
| 63 |
joeyh |
2 |
} |
| 64 |
|
|
} |
| 65 |
|
|
} |
| 66 |
joeyh |
230 |
|
| 67 |
|
|
if ($html) { |
| 68 |
|
|
print "</ul>\n"; |
| 69 |
|
|
} |