diff options
author | Joey Hess <joeyh@debian.org> | 2005-10-19 22:54:03 +0000 |
---|---|---|
committer | Joey Hess <joeyh@debian.org> | 2005-10-19 22:54:03 +0000 |
commit | 69fc25f9e13d2a52ad0a9600a1ce453a069f3c6e (patch) | |
tree | 22727681a4982ed1ea2b0512c8c0d59785294db0 /bin/updatelist | |
parent | dce2d7fbb43f03bce1e5c58a407965e3193e342c (diff) |
mods for CVE merge
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@2458 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/updatelist')
-rwxr-xr-x | bin/updatelist | 117 |
1 files changed, 54 insertions, 63 deletions
diff --git a/bin/updatelist b/bin/updatelist index f145b252f5..c018df441a 100755 --- a/bin/updatelist +++ b/bin/updatelist @@ -1,10 +1,10 @@ #!/usr/bin/perl -my $full_can_html=shift; +my $html=shift; my $dsa_list=shift; my $dtsa_list=shift; my $our_list=shift; -my %cans; +my %cves; sub read_dsa { my $list=shift; @@ -15,16 +15,12 @@ sub read_dsa { if (/^\[/) { ($dsa)=m/(DT?SA-.*?) /; } - if (/\{\s*(CAN|CVE)/) { - my ($canlist)=m/\{(.*)\}/; - foreach my $can (split ' ', $canlist) { - $can=~s/CVE-/CAN-/g; - next unless $can=~/^CAN-\d+/; - $cans{$can}{can}=$can; - push @{$cans{$can}{dsa}}, $dsa; - $can=~s/CAN-/CVE-/g; - $cans{$can}{can}=$can; - push @{$cans{$can}{dsa}}, $dsa; + if (/\{\s*(CVE)/) { + my ($cvelist)=m/\{(.*)\}/; + foreach my $cve (split ' ', $cvelist) { + next unless $cve=~/^CVE-\d+/; + $cves{$cve}{cve}=$cve; + push @{$cves{$cve}{dsa}}, $dsa; } } } @@ -33,77 +29,72 @@ sub read_dsa { read_dsa($dsa_list); read_dsa($dtsa_list); -my %listedcans; +my %listedcves; -open (FULL_CAN, "<$full_can_html") || die "$full_can_html: $!\n"; -my $can; -while (<FULL_CAN>) { - if (m!<b>(CAN-\d+-\d+)</b>!) { - $can=$1; - $cans{$can}{can}=$can; - $listedcans{$can}=1; - } - elsif (m!<b>(CVE-\d+-\d+)</b>!) { - $can=$1; - $cans{$can}{can}=$can; - $listedcans{$can}=1; +open (HTML, "<$html") || die "$html: $!\n"; +my $cve; +while (<HTML>) { + if (m!<b>(CVE-\d+-\d+)</b>!) { + $cve=$1; + $cves{$cve}{cve}=$cve; + $listedcves{$cve}=1; } if (m!\*\*\s+RESERVED\s+\*\*!) { - $cans{$can}{reserved}=1; + $cves{$cve}{reserved}=1; } if (m!\*\*\s+REJECT\s+\*\*!) { - $cans{$can}{rejected}=1; + $cves{$cve}{rejected}=1; } if (m!Description:\s*</b><br>\s*(.*)! && ! m!\*\*\s+RESERVED\s+\*\*! && ! m!\*\*\s+REJECT\s+\*\*!) { - $cans{$can}{description}="($1 ...)"; + $cves{$cve}{description}="($1 ...)"; } } -close FULL_CAN; +close HTML; my $stopped=0; my @out; -sub docan { - my $can=shift; +sub docve { + my $cve=shift; - push @out, "$can".(length $cans{$can}{description} ? " ".$cans{$can}{description} : "")."\n"; - if ($cans{$can}{reserved}) { + push @out, "$cve".(length $cves{$cve}{description} ? " ".$cves{$cve}{description} : "")."\n"; + if ($cves{$cve}{reserved}) { push @out, "\tRESERVED\n"; } - if ($cans{$can}{rejected}) { + if ($cves{$cve}{rejected}) { push @out, "\tREJECTED\n"; } - if ($cans{$can}{dsa}) { - push @out, "\t{".join(" ", @{$cans{$can}{dsa}})."}\n"; + if ($cves{$cve}{dsa}) { + push @out, "\t{".join(" ", @{$cves{$cve}{dsa}})."}\n"; } - if ($cans{$can}{notes}) { - foreach (@{$cans{$can}{notes}}) { + if ($cves{$cve}{notes}) { + foreach (@{$cves{$cve}{notes}}) { push @out, "\t$_\n"; } } - if (! $cans{$can}{reserved} && ! $cans{$can}{rejected} && - ! $cans{$can}{dsa} && ! $cans{$can}{notes} && + if (! $cves{$cve}{reserved} && ! $cves{$cve}{rejected} && + ! $cves{$cve}{dsa} && ! $cves{$cve}{notes} && ! $stopped) { push @out, "\tTODO: check\n"; } - delete $cans{$can}; + delete $cves{$cve}; } open (IN, "<$our_list") || die "$our_list: $!\n"; -my $can; +my $cve; while (<IN>) { chomp; - if (/^((?:CAN|CVE)-(?:[0-9]+|[A-Z]+)-(?:[0-9]+|[A-Z]+))\s*(.*)/) { + if (/^(CVE-(?:[0-9]+|[A-Z]+)-(?:[0-9]+|[A-Z]+))\s*(.*)/) { my $desc=$2; - docan($can) if $can; - $can=$1; + docve($cve) if $cve; + $cve=$1; if (length $desc && $desc !~ /^\(.*\)$/ && - (! exists $cans{$can}{description} || - ! length $cans{$can}{description})) { - $cans{$can}{description}=$desc; + (! exists $cves{$cve}{description} || + ! length $cves{$cve}{description})) { + $cves{$cve}{description}=$desc; } } elsif (/^\s+(RESERVED|REJECTED)\s*$/) { @@ -115,37 +106,37 @@ while (<IN>) { elsif (/^\s+{DT?SA.*/) { # skip } - elsif (/^\s+(.*)/ && $can) { - push @{$cans{$can}{notes}}, $1; + elsif (/^\s+(.*)/ && $cve) { + push @{$cves{$cve}{notes}}, $1; } elsif (/^STOP/) { - docan($can) if $can; + docve($cve) if $cve; push @out, "$_\n"; $stopped=1; - $can=''; + $cve=''; } else { - docan($can) if $can; + docve($cve) if $cve; push @out, "$_\n" if length $_; - $can=''; + $cve=''; } } close IN; -docan($can) if $can; +docve($cve) if $cve; -foreach my $can (reverse sort { $cans{$a}{can} cmp $cans{$b}{can} } keys %cans) { - next unless $listedcans{$can}; - print $can.(length $cans{$can}{description} ? " ".$cans{$can}{description} : "")."\n"; - if ($cans{$can}{reserved}) { +foreach my $cve (reverse sort { $cves{$a}{cve} cmp $cves{$b}{cve} } keys %cves) { + next unless $listedcves{$cve}; + print $cve.(length $cves{$cve}{description} ? " ".$cves{$cve}{description} : "")."\n"; + if ($cves{$cve}{reserved}) { print "\tRESERVED\n"; } - if ($cans{$can}{rejected}) { + if ($cves{$cve}{rejected}) { print "\tREJECTED\n"; } - if ($cans{$can}{dsa}) { - print "\t{".join(" ", @{$cans{$can}{dsa}})."}\n"; + if ($cves{$cve}{dsa}) { + print "\t{".join(" ", @{$cves{$cve}{dsa}})."}\n"; } - if (!$cans{$can}{reserved} || $cans{$can}{rejected} || $cans{$can}{dsa}) { + if (!$cves{$cve}{reserved} || $cves{$cve}{rejected} || $cves{$cve}{dsa}) { print "\tTODO: check\n"; } } |