Home | History | Annotate | Line # | Download | only in mantools
      1 #!/usr/bin/perl
      2 
      3 # List the names of parameters that are documented to support "type:table",
      4 # but that still need to be listed in proxy_read_maps. Some parameters
      5 # may never use proxymapped tables, but we want to maximize coverage of
      6 # the proxy_read_maps parameter name list for non-proxymap purposes.
      7 
      8 use strict;
      9 
     10 my $proto_doc = "proto/postconf.proto";
     11 my $proxy_read = "bin/postconf -dh proxy_read_maps";
     12 my %from_proto = ();
     13 my %from_proxy = ();
     14 my %proto_stops = ( 
     15     "authorized_verp_clients" => 1,	# Obsolete
     16     "master_service_disable" => 1,	# False positive
     17 );
     18 my $param = "";
     19 my $debug = 0;
     20 
     21 # Get the names of parameters that mention "type:table" in their
     22 # documentation. This will not find smtpd_mumble_restrictions but those
     23 # are already covered elsewhere.
     24 
     25 open PROTO, $proto_doc || die "Open $proto_doc: $!\n";
     26 while (<PROTO>) {
     27     if (/^%PARAM\s+(\S+)/) { $param = $1; print "got: $param\n" if $debug; }
     28     if ($param && /\btype:table\b/ && !/\bnot\b/ && !$proto_stops{$param}) { 
     29 	print $_ if ($debug);
     30 	$from_proto{$param} = 1; 
     31     }
     32 }
     33 close PROTO || die "Read $proto_doc: $!\n";
     34 
     35 # Get the names of parameters that appear in proxy_read_maps. We use
     36 # these as a stop list for the above documentation-based approach.
     37 
     38 open PROXY, "$proxy_read|" || die "Run $proxy_read: $!\n";
     39 for $param (split(/\s+/, <PROXY>)) {
     40     $param = substr($param, 1);	# left-hand-side chop()
     41     $from_proxy{$param} = 1;
     42 }
     43 close PROXY || die "Run $proxy_read: $!\n";
     44 
     45 if ($debug) {
     46     for $param (sort keys %from_proxy) { print "from proxy: $param\n"; }
     47     for $param (sort keys %from_proto) { print "from proto: $param\n"; }
     48 }
     49 
     50 # List parameters with "type:table" that are not listed in proxy_read_maps.
     51 
     52 for $param (sort keys %from_proto) { print "$param\n" unless $from_proxy{$param}; }
     53