summaryrefslogtreecommitdiffstats
path: root/mantools/missing-proxy-read-maps
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:59:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:59:03 +0000
commita848231ae0f346dc7cc000973fbeb65b0894ee92 (patch)
tree44b60b367c86723cc78383ef247885d72b388afe /mantools/missing-proxy-read-maps
parentInitial commit. (diff)
downloadpostfix-a848231ae0f346dc7cc000973fbeb65b0894ee92.tar.xz
postfix-a848231ae0f346dc7cc000973fbeb65b0894ee92.zip
Adding upstream version 3.8.5.upstream/3.8.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mantools/missing-proxy-read-maps')
-rwxr-xr-xmantools/missing-proxy-read-maps56
1 files changed, 56 insertions, 0 deletions
diff --git a/mantools/missing-proxy-read-maps b/mantools/missing-proxy-read-maps
new file mode 100755
index 0000000..c6d1d26
--- /dev/null
+++ b/mantools/missing-proxy-read-maps
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+
+# Outputs missing mail_params.h lines for the proxy_read_maps default
+# value.
+
+# First, get the proxy_read_maps default value from postconf command
+# output. This gives us a list of parameter names that are already
+# present in the proxy_read_maps default value.
+
+$command = "bin/postconf -dh proxy_read_maps | tr ' ' '\12'";
+open(PROXY_READ_MAPS, "$command|")
+ || die "can't execute $command: !$\n";
+while (<PROXY_READ_MAPS>) {
+ chomp;
+ next unless /^\$(.+)$/;
+ $proxy_read_maps{$1} = 1;
+}
+close(PROXY_READ_MAPS) || die "close $command: $!\n";
+
+# Parse mail_params.h, to determine the VAR_XXX name for each main.cf
+# parameter. Ignore parameter names composed from multiple strings,
+# unless the parameter name is known to be of interest. The code
+# block after this one will discover if we ignored too much.
+
+$mail_params_h = "src/global/mail_params.h";
+open(MAIL_PARAMS, "<$mail_params_h")
+ || die "Open $mail_params_h";
+while ($line = <MAIL_PARAMS>) {
+ chomp;
+ if ($line =~ /^#define\s+(VAR\S+)\s+"(\S+)"\s*(\/\*.*\*\/)?$/) {
+ $mail_params{$2} = $1;
+ } elsif ($line =~/^#define\s+(VAR\S+)\s+"address_verify_"\s+VAR_SND_DEF_XPORT_MAPS/) {
+ $mail_params{"address_verify_sender_dependent_default_transport_maps"} = $1;
+ } elsif ($line =~/^#define\s+(VAR\S+)\s+"sender_dependent_"\s+VAR_DEF_TRANSPORT\s+"_maps"/) {
+ $mail_params{"sender_dependent_default_transport_maps"} = $1;
+ }
+}
+close(MAIL_PARAMS) || die "close $mail_params_h: !$\n";
+
+# Produce mail_params.h lines for all parameters that have names
+# ending in _maps and that are not listed in proxy_read_maps. We get
+# the full parameter name list from postconf command output. Abort
+# if we discover that our mail_params.h parser missed something.
+
+$command = "bin/postconf -H";
+open(ALL_PARAM_NAMES, "$command|")
+ || die "can't execute $command: !$\n";
+while ($param_name = <ALL_PARAM_NAMES>) {
+ chomp($param_name);
+ next unless ($param_name =~ /_(checks|delivery_status_filter|reply_filter|command_filter|maps)$/);
+ next if ($param_name =~ /^(proxy_read|proxy_write)_maps$/);
+ next if defined($proxy_read_maps{$param_name});
+ die "unknown parameter: $param_name\n"
+ unless defined($mail_params{$param_name});
+ print "\t\t\t\t\" \$\" $mail_params{$param_name} \\\n";
+}