freebsd-dev/ntpdc/nl.pl.in
Cy Schubert b5e14a1344 Vendor import ntp 4.2.8.
Reviewed by:	roberto
Security:	VUXML: 4033d826-87dd-11e4-9079-3c970e169bc2
Security:	http://www.kb.cert.org/vuls/id/852879
Security:	CVE-2014-9293
Security	CVE-2014-9294
Security	CVE-2014-9295
Security	CVE-2014-9296
2014-12-20 22:52:39 +00:00

44 lines
1018 B
Perl

#! @PATH_PERL@ -w
$found = 0;
$last = 0;
$debug = 0;
while (<>) {
next if /^#/;
next if /^\s*$/;
if (/^typedef union req_data_u_tag/) {
$found = 1;
}
if (/^struct info_dns_assoc/) {
$last = 1;
}
if ($found) {
if (/^(struct\s*\w*)\s*{\s*$/) {
$type = $1;
print STDERR "type = '$type'\n" if $debug;
printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n";
next;
}
if (/^typedef (union\s*\w*)\s*{\s*$/) {
$type = $1;
print STDERR "union = '$type'\n" if $debug;
printf " printf(\"sizeof($type) = %%d\\n\", \n\t (int) sizeof($type));\n";
next;
}
if (/\s*\w+\s+(\w*)\s*(\[.*\])?\s*;\s*$/) {
$field = $1;
print STDERR "\tfield = '$field'\n" if $debug;
printf " printf(\"offsetof($field) = %%d\\n\", \n\t (int) offsetof($type, $field));\n";
next;
}
if (/^}\s*\w*\s*;\s*$/) {
printf " printf(\"\\n\");\n\n";
$found = 0 if $last;
next;
}
print STDERR "Unmatched line: $_";
exit 1;
}
}