/[secure-testing]/bin/updatelist
ViewVC logotype

Contents of /bin/updatelist

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1241 - (show annotations) (download)
Mon Jun 20 03:12:50 2005 UTC (7 years, 11 months ago) by joeyh
Original Path: data/updatelist
File size: 3124 byte(s)
replace [] with CAN info once it becomes available
1 #!/usr/bin/perl
2 my $full_can_html=shift;
3 my $dsa_list=shift;
4 my $our_list=shift;
5
6 my %cans;
7
8 open (DSA, "<$dsa_list") || die "$dsa_list: $!\n";
9 my $dsa;
10 while (<DSA>) {
11 if (/^\[/) {
12 ($dsa)=m/(DSA-.*?) /;
13 }
14 if (/\{(CAN|CVE)/) {
15 my ($canlist)=m/\{(.*)\}/;
16 foreach my $can (split ' ', $canlist) {
17 $can=~s/CVE-/CAN-/g;
18 next unless $can=~/^CAN-\d+/;
19 $cans{$can}{can}=$can;
20 push @{$cans{$can}{dsa}}, $dsa;
21 $can=~s/CAN-/CVE-/g;
22 $cans{$can}{can}=$can;
23 push @{$cans{$can}{dsa}}, $dsa;
24 }
25 }
26 }
27 close DSA;
28
29 my %listedcans;
30
31 open (FULL_CAN, "<$full_can_html") || die "$full_can_html: $!\n";
32 my $can;
33 while (<FULL_CAN>) {
34 if (m!<b>(CAN-\d+-\d+)</b>!) {
35 $can=$1;
36 $cans{$can}{can}=$can;
37 $listedcans{$can}=1;
38 }
39 elsif (m!<b>(CVE-\d+-\d+)</b>!) {
40 $can=$1;
41 $cans{$can}{can}=$can;
42 $listedcans{$can}=1;
43 }
44 if (m!\*\*\s+RESERVED\s+\*\*!) {
45 $cans{$can}{reserved}=1;
46
47 }
48 if (m!\*\*\s+REJECT\s+\*\*!) {
49 $cans{$can}{rejected}=1;
50 }
51 if (m!Description:\s*</b><br>\s*(.*)! &&
52 ! m!\*\*\s+RESERVED\s+\*\*! && ! m!\*\*\s+REJECT\s+\*\*!) {
53 $cans{$can}{description}="($1 ...)";
54 }
55 }
56 close FULL_CAN;
57
58 my $stopped=0;
59 my @out;
60
61 sub docan {
62 my $can=shift;
63
64 push @out, "$can".(length $cans{$can}{description} ? " ".$cans{$can}{description} : "")."\n";
65 if ($cans{$can}{reserved}) {
66 push @out, "\tNOTE: reserved\n";
67 }
68 if ($cans{$can}{rejected}) {
69 push @out, "\tNOTE: rejected\n";
70 }
71 if ($cans{$can}{dsa}) {
72 push @out, "\t{".join(" ", @{$cans{$can}{dsa}})."}\n";
73 }
74 if ($cans{$can}{notes}) {
75 foreach (@{$cans{$can}{notes}}) {
76 push @out, "\t$_\n";
77 }
78 }
79 if (! $cans{$can}{reserved} && ! $cans{$can}{rejected} &&
80 ! $cans{$can}{dsa} && ! $cans{$can}{notes} &&
81 ! $stopped) {
82 push @out, "\tTODO: check\n";
83 }
84
85 delete $cans{$can};
86 }
87
88 open (IN, "<$our_list") || die "$our_list: $!\n";
89 my $can;
90 while (<IN>) {
91 chomp;
92 if (/^((?:CAN|CVE)-(?:[0-9]+|[A-Z]+)-(?:[0-9]+|[A-Z]+))\s*(.*)/) {
93 my $desc=$2;
94 docan($can) if $can;
95 $can=$1;
96 if (length $desc && $desc !~ /^\(.*\)$/ &&
97 (! exists $cans{$can}{description} ||
98 ! length $cans{$can}{description})) {
99 $cans{$can}{description}=$desc;
100 }
101 }
102 elsif (/^\s+NOTE:\s*(reserved|rejected)\s*$/) {
103 # skip it
104 }
105 elsif (/^\s+NOTE: covered by DSA.*/) {
106 # skip it (old form)
107 }
108 elsif (/^\s+{DSA.*/) {
109 # skip
110 }
111 elsif (/^\s+(.*)/ && $can) {
112 push @{$cans{$can}{notes}}, $1;
113 }
114 elsif (/^STOP/) {
115 docan($can) if $can;
116 push @out, "$_\n";
117 $stopped=1;
118 $can='';
119 }
120 else {
121 docan($can) if $can;
122 push @out, "$_\n" if length $_;
123 $can='';
124 }
125 }
126 close IN;
127 docan($can) if $can;
128
129 foreach my $can (reverse sort { $cans{$a}{can} cmp $cans{$b}{can} } keys %cans) {
130 next unless $listedcans{$can};
131 print $can.(length $cans{$can}{description} ? " ".$cans{$can}{description} : "")."\n";
132 if ($cans{$can}{reserved}) {
133 print "\tNOTE: reserved\n";
134 }
135 if ($cans{$can}{rejected}) {
136 print "\tNOTE: rejected\n";
137 }
138 if ($cans{$can}{dsa}) {
139 print "\t{".join(" ", @{$cans{$can}{dsa}})."}\n";
140 }
141 if (!$cans{$can}{reserved} || $cans{$can}{rejected} || $cans{$can}{dsa}) {
142 print "\tTODO: check\n";
143 }
144 }
145
146 print @out;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5