#!/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=1; #set to 1 to display kernel images with unknown source version my $sources=$ENV{SOURCES_FILE}; my $need_rebuild=0; my $unprop = my $unprop_all = 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; for (1..5) { @maddy=`madison -s testing '$package'`; if ($? & 127 || ($? >> 8 != 0 && $? >> 8 != 1)) { # good old unrelaible newraff, # home of our archive.. next; } last; } if ($? & 127) { record($package, "[madison segfaulted 5 times in a row.. Medic!]", $id); } elsif ($? >> 8 != 0 && $? >> 8 != 1) { record($package, "[madison exited with ".($? >> 8)."]", $id); } if (! @maddy) { next; } if ($version=~/unfixed/ || $version=~/pending/) { record($package, $version, $id); $unfixed++; } else { foreach my $maddy (@maddy) { my @fields = split(/\s*\|\s*/, $maddy); my $havver=$fields[1]; my $arches=$fields[3]; $version=~s/\s+//; # strip whitespace $arches=~s/\s+$//; my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'"); if ($cmp != 0) { if ($html) { $havver=''.$havver.''; } record($package, "$version needed, have $havver".(@maddy > 1 ? " [$arches]" : ""), $id); $unprop++; $unprop_all++ unless @maddy > 1; } } } } 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_all"; if ($unprop_all != $unprop) { print " (".($unprop - $unprop_all)." on some arches)"; } print "
\n"; print "Total number of kernel image 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"; }