File: check-proxy-type-table

package info (click to toggle)
postfix 3.11.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,668 kB
  • sloc: ansic: 143,638; makefile: 19,474; sh: 7,191; perl: 2,855; python: 1,448; awk: 158
file content (52 lines) | stat: -rwxr-xr-x 1,800 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl

# List the names of parameters that are documented to support "type:table",
# but that still need to be listed in proxy_read_maps. Some parameters
# may never use proxymapped tables, but we want to maximize coverage of
# the proxy_read_maps parameter name list for non-proxymap purposes.

use strict;

my $proto_doc = "proto/postconf.proto";
my $proxy_read = "bin/postconf -dh proxy_read_maps";
my %from_proto = ();
my %from_proxy = ();
my %proto_stops = ( 
    "authorized_verp_clients" => 1,	# Obsolete
    "master_service_disable" => 1,	# False positive
);
my $param = "";
my $debug = 0;

# Get the names of parameters that mention "type:table" in their
# documentation. This will not find smtpd_mumble_restrictions but those
# are already covered elsewhere.

open PROTO, $proto_doc || die "Open $proto_doc: $!\n";
while (<PROTO>) {
    if (/^%PARAM\s+(\S+)/) { $param = $1; print "got: $param\n" if $debug; }
    if ($param && /\btype:table\b/ && !/\bnot\b/ && !$proto_stops{$param}) { 
	print $_ if ($debug);
	$from_proto{$param} = 1; 
    }
}
close PROTO || die "Read $proto_doc: $!\n";

# Get the names of parameters that appear in proxy_read_maps. We use
# these as a stop list for the above documentation-based approach.

open PROXY, "$proxy_read|" || die "Run $proxy_read: $!\n";
for $param (split(/\s+/, <PROXY>)) {
    $param = substr($param, 1);	# left-hand-side chop()
    $from_proxy{$param} = 1;
}
close PROXY || die "Run $proxy_read: $!\n";

if ($debug) {
    for $param (sort keys %from_proxy) { print "from proxy: $param\n"; }
    for $param (sort keys %from_proto) { print "from proto: $param\n"; }
}

# List parameters with "type:table" that are not listed in proxy_read_maps.

for $param (sort keys %from_proto) { print "$param\n" unless $from_proxy{$param}; }