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

Contents of /bin/updatelist

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5