#!/usr/bin/perl # Must run on a machine with madison. # # To check for un-updated binary kernel packages, also needs grep-dctrl # and a Sources file for the distribution. Set the location of the Sources # file in SOURCES_FILE in the environment. # use URI::Escape; my $html=0; if ($ARGV[0] eq 'html') { shift; $html=1; } if (! @ARGV) { die "usage: $0 [html] list\n"; } my %data; my %needkernel=qw/2.4.27 0 2.6.8 0/; my $list_unknown=0; #set to 1 to display kernel images with unknown source version my $sources=$ENV{SOURCES_FILE}; my $need_rebuild=0; my $unprop = my $unfixed = my $todos = 0; sub record { my ($package, $condition, $item)=@_; if ($html) { $condition=~s{bug #(\d+)}{bug #$1}g; $condition=~s{unfixed}{unfixed}g; $item=~s#((?:CAN|CVE)-\d+-\d+)#$1#g; } push @{$data{$package}{$condition}}, $item; } foreach my $list (@ARGV) { if (-d $list) { $list="$list/list"; } open (IN, $list) || die "open $list: $!"; while () { chomp; if (/^\[/) { ($id)=m/((?:DSA|CAN|CVE)-[^\s]+) /; } elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) { $id=$1; } elsif (/^\s+[!-]\s+(\S+)\s+(.*?)\s*$/) { my $package=$1; my $version=$2; if ($package=~/kernel-source-([0-9.]+)/) { my $kernversion=$1; if (exists $needkernel{$kernversion} && $version!~/\(/ ) { $needkernel{$kernversion}=$version if !system("dpkg --compare-versions $needkernel{$kernversion} lt $version"); } } my $maddy=`madison -s testing '$package'`; if ($? & 128) { # good old newraff.. record($package, "madison segfaulted", $id); } elsif ($? >> 8 != 0 && $? >> 8 != 1) { record($package, "madison exited with ".($? >> 8)."", $id); } if (! length $maddy) { next; } if ($version=~/unfixed/ || $version=~/pending/) { record($package, $version, $id); $unfixed++; } else { my @fields = split(/\s*\|\s*/, $maddy); my $havver=$fields[1]; my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'"); if ($cmp != 0) { if ($html) { $havver=''.$havver.''; } record($package, "$version needed, have $havver", $id); $unprop++; } } } elsif (/\s+TODO/) { $todos++; } } } if ($html) { print "testing security issues\n"; print "\n"; print "
\n"; print "Total holes unfixed: $unfixed
\n"; print "Total holes fixed in unstable but not testing: $unprop
\n"; print "Total number of kernel image source packages not up to date: $need_rebuild
\n"; print "Number of TODO lines in records: $todos
\n"; print "Maintained by the testing security team
\n"; print "Last update: ".`date`."
\n"; print "\n"; }