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

Contents of /bin/updatelist

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1672 - (show annotations) (download)
Sat Aug 27 17:07:18 2005 UTC (7 years, 8 months ago) by joeyh
File size: 3242 byte(s)
Moved programs into bin directory so data can be auto-updated w/o opening
any potential holes for committers who lack access to the machine running
the update. AKA my paranioa finally caught up to me.

Didn't move DTSA still since it will be rewritten anyway.
1 #!/usr/bin/perl
2 my $full_can_html=shift;
3 my $dsa_list=shift;
4 my $dtsa_list=shift;
5 my $our_list=shift;
6
7 my %cans;
8
9 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 }
18 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 }
31 close DSA;
32 }
33 read_dsa($dsa_list);
34 read_dsa($dtsa_list);
35
36 my %listedcans;
37
38 open (FULL_CAN, "<$full_can_html") || die "$full_can_html: $!\n";
39 my $can;
40 while (<FULL_CAN>) {
41 if (m!<b>(CAN-\d+-\d+)</b>!) {
42 $can=$1;
43 $cans{$can}{can}=$can;
44 $listedcans{$can}=1;
45 }
46 elsif (m!<b>(CVE-\d+-\d+)</b>!) {
47 $can=$1;
48 $cans{$can}{can}=$can;
49 $listedcans{$can}=1;
50 }
51 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 if (m!Description:\s*</b><br>\s*(.*)! &&
59 ! m!\*\*\s+RESERVED\s+\*\*! && ! m!\*\*\s+REJECT\s+\*\*!) {
60 $cans{$can}{description}="($1 ...)";
61 }
62 }
63 close FULL_CAN;
64
65 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 push @out, "\tNOTE: reserved\n";
74 }
75 if ($cans{$can}{rejected}) {
76 push @out, "\tNOTE: rejected\n";
77 }
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 open (IN, "<$our_list") || die "$our_list: $!\n";
96 my $can;
97 while (<IN>) {
98 chomp;
99 if (/^((?:CAN|CVE)-(?:[0-9]+|[A-Z]+)-(?:[0-9]+|[A-Z]+))\s*(.*)/) {
100 my $desc=$2;
101 docan($can) if $can;
102 $can=$1;
103 if (length $desc && $desc !~ /^\(.*\)$/ &&
104 (! exists $cans{$can}{description} ||
105 ! length $cans{$can}{description})) {
106 $cans{$can}{description}=$desc;
107 }
108 }
109 elsif (/^\s+NOTE:\s*(reserved|rejected)\s*$/) {
110 # skip it
111 }
112 elsif (/^\s+NOTE: covered by DT?SA.*/) {
113 # skip it (old form)
114 }
115 elsif (/^\s+{DT?SA.*/) {
116 # skip
117 }
118 elsif (/^\s+(.*)/ && $can) {
119 push @{$cans{$can}{notes}}, $1;
120 }
121 elsif (/^STOP/) {
122 docan($can) if $can;
123 push @out, "$_\n";
124 $stopped=1;
125 $can='';
126 }
127 else {
128 docan($can) if $can;
129 push @out, "$_\n" if length $_;
130 $can='';
131 }
132 }
133 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 print $can.(length $cans{$can}{description} ? " ".$cans{$can}{description} : "")."\n";
139 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 }
152
153 print @out;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5