2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 05:38:06 +00:00

postfix-3.4-20180218

This commit is contained in:
Wietse Venema 2018-02-18 00:00:00 -05:00 committed by Viktor Dukhovni
parent 2e50abbaac
commit 94b0d0b051
12 changed files with 107 additions and 24 deletions

View File

@ -23330,3 +23330,15 @@ Apologies for any names omitted.
Cleanup: added missing *_maps parameters to the default
proxy_read_maps setting. Files: global/mail_params.h,
mantools/missing-proxy-read-maps.
20180218
Cleanup: back-ported the missing-proxy-read-maps script to
older Postfix releases, and added error checks. Undid some
of the 20180217 changes in mail_params.h that are no longer
needed.
Bugfix: postconf should scan only built-in or service-defined
parameters for ldap, *sql, etc. database names. Files:
postconf/postconf_user.c.

View File

@ -1,31 +1,46 @@
#!/usr/bin/perl
# Compares the list of parameter names that end in _maps in
# proxy_read_maps, against the list of all parameter names that end
# in _maps, and outputs the missing mail_params.h lines.
# 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 /\$(.+_maps)$/;
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+(\S+)\s+"(\S+)"/) {
if ($line =~ /^#define\s+(VAR\S+)\s+"(\S+)"\s*(\/\*.*\*\/)?$/) {
$mail_params{$2} = $1;
} elsif ($line =~/^#define\s+(\S+)\s+"address_verify_" VAR_SND_DEF_XPORT_MAPS/) {
} 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|")

View File

@ -489,11 +489,11 @@ extern char *var_transport_maps;
#define DEF_DEF_TRANSPORT MAIL_SERVICE_SMTP
extern char *var_def_transport;
#define VAR_SND_DEF_XPORT_MAPS "sender_dependent_default_transport_maps"
#define VAR_SND_DEF_XPORT_MAPS "sender_dependent_" VAR_DEF_TRANSPORT "_maps"
#define DEF_SND_DEF_XPORT_MAPS ""
extern char *var_snd_def_xport_maps;
#define VAR_NULL_DEF_XPORT_MAPS_KEY "empty_address_default_transport_maps_lookup_key"
#define VAR_NULL_DEF_XPORT_MAPS_KEY "empty_address_" VAR_DEF_TRANSPORT "_maps_lookup_key"
#define DEF_NULL_DEF_XPORT_MAPS_KEY "<>"
extern char *var_null_def_xport_maps_key;
@ -2402,6 +2402,7 @@ extern int var_local_rcpt_code;
" $" VAR_MBOX_TRANSP_MAPS \
" $" VAR_PSC_EHLO_DIS_MAPS \
" $" VAR_RBL_REPLY_MAPS \
" $" VAR_SND_DEF_XPORT_MAPS \
" $" VAR_SND_RELAY_MAPS \
" $" VAR_SMTP_EHLO_DIS_MAPS \
" $" VAR_SMTP_PIX_BUG_MAPS \
@ -2410,8 +2411,7 @@ extern int var_local_rcpt_code;
" $" VAR_SMTPD_EHLO_DIS_MAPS \
" $" VAR_SMTPD_MILTER_MAPS \
" $" VAR_VIRT_GID_MAPS \
" $" VAR_VIRT_UID_MAPS \
" $" VAR_SND_DEF_XPORT_MAPS
" $" VAR_VIRT_UID_MAPS
extern char *var_proxy_read_maps;
#define VAR_PROXY_WRITE_MAPS "proxy_write_maps"

View File

@ -20,7 +20,7 @@
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
#define MAIL_RELEASE_DATE "20180217"
#define MAIL_RELEASE_DATE "20180218"
#define MAIL_VERSION_NUMBER "3.4"
#ifdef SNAPSHOT

View File

@ -54,7 +54,7 @@ tests: test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 \
test31 test32 test33 test34 test35 test36 test37 test39 test40 test41 \
test42 test43 test44 test45 test46 test47 test48 test49 test50 test51 \
test52 test53 test54 test55 test56 test57 test58 test59 test60 test61 \
test62 test63 test64 test65 test66 test67
test62 test63 test64 test65 test66 test67 test68 test69
root_tests:
@ -436,8 +436,8 @@ test28: $(PROG) test28.ref
echo 'yy = aap' >> main.cf
echo 'db = memcache' >> main.cf
echo whatevershebrings unix - n n - 0 other >> master.cf
echo ' -o body_checks=$$db:zz' >> master.cf
echo 'zz_domain = whatever' >> main.cf
echo ' -o body_checks=$$db:$$zz' >> master.cf
echo 'aap_domain = whatever' >> main.cf
echo 'aa_domain = whatever' >> main.cf
touch -t 197101010000 main.cf
$(SHLIB_ENV) ./$(PROG) -nc . >test28.tmp 2>&1
@ -920,6 +920,35 @@ test67: $(PROG) test67.ref
diff test67.ref test67.tmp
rm -f main.cf master.cf test67.tmp
test68: $(PROG) test68.ref
rm -f main.cf master.cf
touch master.cf
echo foo = ldap:`pwd` >> main.cf
echo 'alias_maps = $$foo/test68.cf' >> main.cf
echo " " mysql:`pwd`/test68.cf >> main.cf
echo " " pgsql:`pwd`/test68.cf >> main.cf
echo " " sqlite:`pwd`/test68.cf >> main.cf
echo " " memcache:`pwd`/test68.cf >> main.cf
echo junk = junk >> test68.cf
touch -t 197101010000 main.cf
$(SHLIB_ENV) ./$(PROG) -c. 2>test68.tmp >/dev/null
sed "s;PWD;`pwd`;" test68.ref | diff - test68.tmp
rm -f main.cf master.cf test68.tmp test68.cf
# See also test28 for user-defined parameters defined in main.cf.
test69: $(PROG) test69.ref
rm -f main.cf master.cf
touch main.cf master.cf
echo whatevershebrings unix - n n - 0 other >> master.cf
echo " -o ldap=ldap:`pwd`" >> master.cf
echo ' -o body_checks=$$ldap/test69.cf' >> master.cf
echo junk = junk >> test69.cf
touch -t 197101010000 main.cf
$(SHLIB_ENV) ./$(PROG) -nc . >test69.tmp 2>&1
diff test69.ref test69.tmp
rm -f main.cf master.cf test69.tmp test69.cf
printfck: $(OBJS) $(PROG)
rm -rf printfck
mkdir printfck

View File

@ -75,6 +75,9 @@ typedef struct {
((node)->flags = (((node)->flags & ~PCF_PARAM_MASK_CLASS) | (class)))
#define PCF_RAW_PARAMETER(node) ((node)->flags & PCF_PARAM_FLAG_RAW)
#define PCF_BUILTIN_PARAMETER(node) ((node)->flags & PCF_PARAM_FLAG_BUILTIN)
#define PCF_SERVICE_PARAMETER(node) ((node)->flags & PCF_PARAM_FLAG_SERVICE)
#define PCF_USER_PARAMETER(node) ((node)->flags & PCF_PARAM_FLAG_USER)
#define PCF_LEGACY_PARAMETER(node) ((node)->flags & PCF_PARAM_FLAG_LEGACY)
#define PCF_READONLY_PARAMETER(node) ((node)->flags & PCF_PARAM_FLAG_READONLY)
#define PCF_DBMS_PARAMETER(node) ((node)->flags & PCF_PARAM_FLAG_DBMS)

View File

@ -53,6 +53,7 @@
/* System library. */
#include <sys_defs.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
@ -163,6 +164,7 @@ static void pcf_check_dbms_client(const PCF_DBMS_INFO *dp, const char *cf_file)
*/
dict_spec = concatenate(dp->db_type, ":", cf_file, (char *) 0);
if ((dict = dict_handle(dict_spec)) == 0) {
struct stat st;
/*
* Populate the dictionary with settings in this database client
@ -179,6 +181,13 @@ static void pcf_check_dbms_client(const PCF_DBMS_INFO *dp, const char *cf_file)
myfree(dict_spec);
return;
}
if (fstat(vstream_fileno(fp), &st) == 0 && !S_ISREG(st.st_mode)) {
msg_warn("open \"%s\" configuration \"%s\": not a regular file",
dp->db_type, cf_file);
myfree(dict_spec);
(void) vstream_fclose(fp);
return;
}
dict_load_fp(dict_spec, fp);
if (vstream_fclose(fp)) {
msg_warn("read \"%s\" configuration \"%s\": %m",

View File

@ -290,6 +290,14 @@ static void pcf_scan_user_parameter_namespace(const char *dict_name,
}
SCAN_USER_PARAMETER_VALUE(cparam_value, PCF_PARAM_FLAG_USER, local_scope);
#ifdef LEGACY_DBMS_SUPPORT
/*
* Scan only parameters that are built-in or service-defined (when
* node == 0, the parameter doesn't exist in the global namespace and
* therefore can't be built-in or service-defined).
*/
if (node != 0
&& (PCF_BUILTIN_PARAMETER(node) || PCF_SERVICE_PARAMETER(node)))
pcf_register_dbms_parameters(cparam_value, pcf_flag_user_parameter,
local_scope);
#endif

View File

@ -1,10 +1,10 @@
aap_domain = whatever
config_directory = .
db = memcache
foo_domain = bar
header_checks = ldap:hh
hh_domain = whatever
yy = aap
zz_domain = whatever
./postconf: warning: ./main.cf: unused parameter: zz=$yy
zz = $yy
./postconf: warning: ./main.cf: unused parameter: foo_domain=bar
./postconf: warning: ./main.cf: unused parameter: aa_domain=whatever
./postconf: warning: ./main.cf: unused parameter: xx=proxy:ldap:foo

View File

@ -1,16 +1,16 @@
config_directory = .
ldapfoo_domain = bar
memcachefoo_domain = bar
mysqlfoo_domain = bar
pgsqlfoo_domain = bar
sqlitefoo_domain = bar
./postconf: warning: ./main.cf: unused parameter: sqlitexx=proxy:sqlite:sqlitefoo
./postconf: warning: ./main.cf: unused parameter: pgsqlxx=proxy:pgsql:pgsqlfoo
./postconf: warning: ./main.cf: unused parameter: ldapfoo_domain=bar
./postconf: warning: ./main.cf: unused parameter: memcachefoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: sqlitefoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: sqlitefoo_domain=bar
./postconf: warning: ./main.cf: unused parameter: memcachexx=proxy:memcache:memcachefoo
./postconf: warning: ./main.cf: unused parameter: mysqlxx=proxy:mysql:mysqlfoo
./postconf: warning: ./main.cf: unused parameter: ldapxx=proxy:ldap:ldapfoo
./postconf: warning: ./main.cf: unused parameter: ldapfoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: memcachefoo_domain=bar
./postconf: warning: ./main.cf: unused parameter: pgsqlfoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: mysqlfoo_domainx=bar
./postconf: warning: ./main.cf: unused parameter: mysqlfoo_domain=bar
./postconf: warning: ./main.cf: unused parameter: pgsqlfoo_domain=bar

View File

@ -0,0 +1,5 @@
./postconf: warning: ldap:PWD/test68.cf: unused parameter: junk=junk
./postconf: warning: mysql:PWD/test68.cf: unused parameter: junk=junk
./postconf: warning: pgsql:PWD/test68.cf: unused parameter: junk=junk
./postconf: warning: sqlite:PWD/test68.cf: unused parameter: junk=junk
./postconf: warning: memcache:PWD/test68.cf: unused parameter: junk=junk

View File

@ -0,0 +1,2 @@
./postconf: warning: ldap:/home/wietse/postfix-3.4-20180217/src/postconf/test69.cf: unused parameter: junk=junk
config_directory = .