2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-30 21:55:20 +00:00

postfix-2.12-20140923

This commit is contained in:
Wietse Venema
2014-09-23 00:00:00 -05:00
committed by Viktor Dukhovni
parent f62728c568
commit 39cb725ef4
17 changed files with 412 additions and 123 deletions

View File

@@ -20426,3 +20426,12 @@ Apologies for any names omitted.
Cleanup: replace stress-dependent main.cf defaults with the
ternary form: "${stress?{x}:{y}}" File: global/mail_params.h,
proto/postconf.proto, postscreen/postscreen.c (comments).
20140923
Cleanup: dict_db and dict_lmdb global settings. Files:
global/mail_params.c, util/dict_open.c.
Feature: unionmap, based on contribution by Roel van Meer.
Files: mantools/postlink, postconf/postconf.c (manpage),
proto/DATABASE_README.html, util/dict_open.c, util/dict_union.[hc].

View File

@@ -293,6 +293,10 @@ To find out what database types your Postfix system supports, use the "ppooss
and that texthash: does not detect changes after the file is read. The
lookup table name is "texthash:filename", where the file name is taken
literally; no suffix is appended.
uunniioonnmmaapp (read-only)
A table that sends each query to multiple lookup tables and that
concatenates all found results, separated by comma. The table name
syntax is the same as for pipemap tables.
uunniixx (read-only)
A limited view of the UNIX authentication database. The following
tables are implemented:

View File

@@ -30,8 +30,6 @@ Wish list:
lookups for the invidual addresses, converting back and
forth between external and internal forms.
union: map, concatenates results, default separator is ','.
Include <3htPpS5B6bzbcpM@spike.porcupine.org> example with
filter policies for different mail streams. Correction:
filter should be content_filter. Posted Wed, 10 Sep 2014

View File

@@ -442,6 +442,12 @@ use the file, and that <a href="DATABASE_README.html#types">texthash</a>: does n
file is read. The lookup table name is "<a href="DATABASE_README.html#types">texthash</a>:filename", where
the file name is taken literally; no suffix is appended. </dd>
<dt> <b>unionmap</b> (read-only) </dt>
<dd> A table that sends each query to multiple lookup tables and
that concatenates all found results, separated by comma. The table
name syntax is the same as for pipemap tables. </dd>
<dt> <b>unix</b> (read-only) </dt>
<dd> A limited view of the UNIX authentication database. The following

View File

@@ -305,6 +305,11 @@ POSTCONF(1) POSTCONF(1)
use the file, and that it does not detect changes after
the file is read.
<b>union</b> (read-only)
A table that sends each query to multiple lookup tables
and that concatenates all found results, separated by
comma. The table name syntax is the same as for <b>pipemap</b>.
<b>unix</b> (read-only)
A limited view of the UNIX authentication database. The
following tables are implemented:

View File

@@ -318,6 +318,10 @@ Produces similar results as hash: files, except that you
don't need to run the \fBpostmap\fR(1) command before you
can use the file, and that it does not detect changes after
the file is read.
.IP "\fBunion\fR (read-only)"
A table that sends each query to multiple lookup tables and
that concatenates all found results, separated by comma.
The table name syntax is the same as for \fBpipemap\fR.
.IP "\fBunix\fR (read-only)"
A limited view of the UNIX authentication database. The
following tables are implemented:

View File

@@ -1136,6 +1136,7 @@ while (<>) {
s/\b(tcp):/<a href="tcp_table.5.html">$1<\/a>:/g;
s/\b(texthash):/<a href="DATABASE_README.html#types">$1<\/a>:/g;
#s/\b(unix):/<a href="DATABASE_README.html#types">$1<\/a>:/g;
s/\b(unionmap):/<a href="DATABASE_README.html#types">$1<\/a>:/g;
# Do nice links for smtp:host:port etc.

View File

@@ -442,6 +442,12 @@ use the file, and that texthash: does not detect changes after the
file is read. The lookup table name is "texthash:filename", where
the file name is taken literally; no suffix is appended. </dd>
<dt> <b>unionmap</b> (read-only) </dt>
<dd> A table that sends each query to multiple lookup tables and
that concatenates all found results, separated by comma. The table
name syntax is the same as for pipemap tables. </dd>
<dt> <b>unix</b> (read-only) </dt>
<dd> A limited view of the UNIX authentication database. The following

View File

@@ -325,9 +325,6 @@ char *var_smtputf8_autoclass;
const char null_format_string[1] = "";
DEFINE_DICT_LMDB_MAP_SIZE;
DEFINE_DICT_DB_CACHE_SIZE;
/* check_myhostname - lookup hostname and validate */
static const char *check_myhostname(void)

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 "20140922"
#define MAIL_RELEASE_DATE "20140923"
#define MAIL_VERSION_NUMBER "2.12"
#ifdef SNAPSHOT

View File

@@ -34,7 +34,7 @@ $(PROG): $(OBJS) $(LIBS)
rm -f $@
(echo "# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE"; \
echo "# TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX."; \
echo "#"; $(SHLIB_ENV) ./$(PROG) -d -c ../../conf) | \
echo "#"; $(SHLIB_ENV) $(SHLIB_ENV) ./$(PROG) -d -c ../../conf) | \
egrep -v '^(myhostname|mydomain|mynetworks|process_name|process_id) ' >$@
$(OBJS): ../../conf/makedefs.out
@@ -73,7 +73,7 @@ test1: $(PROG) test1.ref
echo smtpd_restriction_classes = foo bar >> main.cf
echo foo = yes >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test1.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test1.tmp 2>&1
diff test1.ref test1.tmp
rm -f main.cf master.cf test1.tmp
@@ -85,7 +85,7 @@ test2: $(PROG) test2.ref
echo restriction_classes = foo bar >> main.cf
echo foo = yes >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test2.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test2.tmp 2>&1
diff test2.ref test2.tmp
rm -f main.cf master.cf test2.tmp
@@ -98,7 +98,7 @@ test3: $(PROG) test3.ref
echo 'bar = $$foo' >> main.cf
echo 'always_bcc = $$bar' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test3.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test3.tmp 2>&1
diff test3.ref test3.tmp
rm -f main.cf master.cf test3.tmp
@@ -112,7 +112,7 @@ test4: $(PROG) test4.ref
echo smtpd unix - n n - 0 smtpd >> master.cf
echo ' -o always_bcc=$$bar' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test4.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test4.tmp 2>&1
diff test4.ref test4.tmp
rm -f main.cf master.cf test4.tmp
@@ -128,7 +128,7 @@ test4b: $(PROG) test4b.ref
echo ' -o foo=xxx -o bar=yyy -o baz=zzz' >> master.cf
echo '#smtpd2 unix - n n - 0 smtpd' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test4b.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test4b.tmp 2>&1
diff test4b.ref test4b.tmp
rm -f main.cf master.cf test4b.tmp
@@ -141,7 +141,7 @@ test5: $(PROG) test5.ref
echo smtpd unix - n n - 0 smtpd >> master.cf
echo ' -o bar=yes -o always_bcc=$$bar -o' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test5.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test5.tmp 2>&1
diff test5.ref test5.tmp
rm -f main.cf master.cf test5.tmp
@@ -152,7 +152,7 @@ test6: $(PROG) test6.ref
touch main.cf master.cf
echo whatevershebrings unix - n n - 0 pipe >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . 2>&1 | grep whatevershebrings >test6.tmp
$(SHLIB_ENV) ./$(PROG) -c . 2>&1 | grep whatevershebrings >test6.tmp
diff test6.ref test6.tmp
rm -f main.cf master.cf test6.tmp
@@ -163,7 +163,7 @@ test7: $(PROG) test7.ref
touch main.cf master.cf
echo whatevershebrings unix - n n - 0 spawn >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . 2>&1 | grep whatevershebrings >test7.tmp
$(SHLIB_ENV) ./$(PROG) -c . 2>&1 | grep whatevershebrings >test7.tmp
diff test7.ref test7.tmp
rm -f main.cf master.cf test7.tmp
@@ -173,7 +173,7 @@ test8: $(PROG) test8.ref
echo whatevershebrings inet - n n - 0 spawn >> master.cf
echo whatevershebrings_time_limit=1 >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -c . 2>&1 | grep whatevershebrings >test8.tmp
$(SHLIB_ENV) ./$(PROG) -c . 2>&1 | grep whatevershebrings >test8.tmp
diff test8.ref test8.tmp
rm -f main.cf master.cf test8.tmp
@@ -183,7 +183,7 @@ test9: $(PROG) test9.ref
echo foo inet - n n - 0 spawn >> master.cf
echo bar unix - n n - 0 spawn >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . -M '*'/inet >test9.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -c . -M '*'/inet >test9.tmp 2>&1
diff test9.ref test9.tmp
rm -f main.cf master.cf test9.tmp
@@ -193,7 +193,7 @@ test10: $(PROG) test10.ref
echo foo inet - n n - 0 spawn >> master.cf
echo bar unix - n n - 0 spawn >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . -M bar/inet foo/unix >test10.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -c . -M bar/inet foo/unix >test10.tmp 2>&1
diff test10.ref test10.tmp
rm -f main.cf master.cf test10.tmp
@@ -203,7 +203,7 @@ test11: $(PROG) test11.ref
echo foo inet - n n - 0 spawn >> master.cf
echo bar unix - n n - 0 spawn >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . -M >test11.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -c . -M >test11.tmp 2>&1
diff test11.ref test11.tmp
rm -f main.cf master.cf test11.tmp
@@ -218,7 +218,7 @@ test12: $(PROG) test12.ref
echo foo inet - n n - 0 spawn >> master.cf
echo ' -o always_bcc=$$bar -o' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . -M >test12.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -c . -M >test12.tmp 2>&1
diff test12.ref test12.tmp
rm -f main.cf master.cf test12.tmp
@@ -232,7 +232,7 @@ test13: $(PROG) test13.ref
echo foo inet - n n - 0 spawn >> master.cf
echo ' -o smtpd_restriction_classes=bar' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test13.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test13.tmp 2>&1
diff test13.ref test13.tmp
rm -f main.cf master.cf test13.tmp
@@ -245,7 +245,7 @@ test14: $(PROG) test14.ref
echo foo inet - n n - 0 spawn >> master.cf
echo ' -o bar=yes -o baz=xx' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test14.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test14.tmp 2>&1
diff test14.ref test14.tmp
rm -f main.cf master.cf test14.tmp
@@ -259,7 +259,7 @@ test15: $(PROG) test15.ref
echo foo inet - n n - 0 spawn >> master.cf
echo ' -o bar=yes -o always_bcc=$$bar$$baz' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test15.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test15.tmp 2>&1
diff test15.ref test15.tmp
rm -f main.cf master.cf test15.tmp
@@ -268,14 +268,14 @@ test15: $(PROG) test15.ref
test16: $(PROG) test16.ref
rm -f main.cf master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test16.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test16.tmp 2>&1
diff test16.ref test16.tmp
rm -f main.cf master.cf test16.tmp
test17: $(PROG) test17.ref
rm -f main.cf master.cf
touch -t 197101010000 main.cf
-./$(PROG) -Mc . >test17.tmp 2>&1; exit 0
-$(SHLIB_ENV) ./$(PROG) -Mc . >test17.tmp 2>&1; exit 0
diff test17.ref test17.tmp
rm -f main.cf master.cf test17.tmp
@@ -287,7 +287,7 @@ test18: $(PROG) test18.ref
echo virtual_maps=xxx >> main.cf
echo smtpd_client_connection_limit_exceptions=yyy >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test18.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test18.tmp 2>&1
diff test18.ref test18.tmp
rm -f main.cf master.cf test18.tmp
@@ -299,7 +299,7 @@ test19: $(PROG) test19.ref
echo forward_path='$$'aaaa >> main.cf
echo default_rbl_reply='$$'bbbb >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test19.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test19.tmp 2>&1
diff test19.ref test19.tmp
rm -f main.cf master.cf test19.tmp
@@ -311,7 +311,7 @@ test20: $(PROG) test20.ref
echo foo inet - n n - 0 spawn >> master.cf
echo ' -o always_bcc=$$bar$$baz' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc . >test20.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfc . >test20.tmp 2>&1
diff test20.ref test20.tmp
rm -f main.cf master.cf test20.tmp
@@ -323,7 +323,7 @@ test21: $(PROG) test21.ref
echo forward_path = xxxxxxxxxxxxx xxxxxxxxxxxxxx xxxxxxxxxxxx \
xxxxxxxxxxxxx xxxxxxxxxxxxxx >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nfc . >test21.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nfc . >test21.tmp 2>&1
diff test21.ref test21.tmp
rm -f main.cf master.cf test21.tmp
@@ -334,7 +334,7 @@ test22: $(PROG) test22.ref
touch main.cf master.cf
echo whatevershebrings unix - n n - 0 smtp >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . 2>&1 | grep whatevershebrings >test22.tmp
$(SHLIB_ENV) ./$(PROG) -c . 2>&1 | grep whatevershebrings >test22.tmp
diff test22.ref test22.tmp
rm -f main.cf master.cf test22.tmp
@@ -348,7 +348,7 @@ test23: $(PROG) test23.ref
echo whatevershebrings unix - n n - 0 smtp >> master.cf
echo ' -o always_bcc=$$name' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . -nC builtin >test23.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -c . -nC builtin >test23.tmp 2>&1
diff test23.ref test23.tmp
rm -f main.cf master.cf test23.tmp
@@ -360,7 +360,7 @@ test24: $(PROG) test24.ref
echo whatevershebrings unix - n n - 0 smtp >> master.cf
echo ' -o always_bcc=$$name' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . -nC user >test24.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -c . -nC user >test24.tmp 2>&1
diff test24.ref test24.tmp
rm -f main.cf master.cf test24.tmp
@@ -372,7 +372,7 @@ test25: $(PROG) test25.ref
echo whatevershebrings unix - n n - 0 smtp >> master.cf
echo ' -o always_bcc=$$name' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . -C service 2>&1 | grep whatevershebrings >test25.tmp
$(SHLIB_ENV) ./$(PROG) -c . -C service 2>&1 | grep whatevershebrings >test25.tmp
diff test25.ref test25.tmp
rm -f main.cf master.cf test25.tmp
@@ -386,7 +386,7 @@ test26: $(PROG) test26.ref
echo whatevershebrings unix - n n - 0 smtp >> master.cf
echo ' -o always_bcc=$$name' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . -C all >test26.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . -C all >test26.tmp 2>&1
diff test26.ref test26.tmp
rm -f main.cf master.cf test26.tmp
@@ -398,7 +398,7 @@ test27: $(PROG) test27.ref
echo whatevershebrings unix - n n - 0 smtp >> master.cf
echo ' -o always_bcc=$$name' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -c . -C all 2>&1 | grep whatevershebrings >test27.tmp
$(SHLIB_ENV) ./$(PROG) -c . -C all 2>&1 | grep whatevershebrings >test27.tmp
diff test27.ref test27.tmp
rm -f main.cf master.cf test27.tmp
@@ -419,7 +419,7 @@ test28: $(PROG) test28.ref
echo 'zz_domain = whatever' >> main.cf
echo 'aa_domain = whatever' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test28.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test28.tmp 2>&1
diff test28.ref test28.tmp
rm -f main.cf master.cf test28.tmp
@@ -444,7 +444,7 @@ test29: $(PROG) test29.ref
echo 'memcachefoo_domain = bar' >> main.cf
echo 'memcachefoo_domainx = bar' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test29.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test29.tmp 2>&1
diff test29.ref test29.tmp
rm -f main.cf master.cf test29.tmp
@@ -461,7 +461,7 @@ test30: $(PROG) test30.ref
echo ' -oheader_checks=$$p3' >> master.cf
echo ' -oheaderx_checks=$$p4' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -nc . >test30.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nc . >test30.tmp 2>&1
diff test30.ref test30.tmp
rm -f main.cf master.cf test30.tmp
@@ -473,7 +473,7 @@ test31: $(PROG) test31.ref
echo 'smtpd_helo_restrictions=whatever' >> main.cf
echo 'smtpd_sender_restrictions=$$smtpd_helo_restrictions' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nxc . >test31.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nxc . >test31.tmp 2>&1
diff test31.ref test31.tmp
rm -f main.cf master.cf test31.tmp
@@ -484,7 +484,7 @@ test32: $(PROG) test32.ref
touch main.cf master.cf
echo 'relay_domains=whatever' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -xc . fast_flush_domains >test32.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -xc . fast_flush_domains >test32.tmp 2>&1
diff test32.ref test32.tmp
rm -f main.cf master.cf test32.tmp
@@ -496,7 +496,7 @@ test33: $(PROG) test33.ref
echo 'mydestination=whatever' >> main.cf
echo 'always_bcc=$$relay_domains' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -xc . always_bcc >test33.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -xc . always_bcc >test33.tmp 2>&1
diff test33.ref test33.tmp
rm -f main.cf master.cf test33.tmp
@@ -507,7 +507,7 @@ test34: $(PROG) test34.ref
echo 'process_name=xxx' >> main.cf
echo 'process_id=yyy' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -xc . mydestination process_name >test34.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -xc . mydestination process_name >test34.tmp 2>&1
diff test34.ref test34.tmp
rm -f main.cf master.cf test34.tmp
@@ -519,7 +519,7 @@ test35: $(PROG) test35.ref
echo ' -o process_name=aaa' >> master.cf
echo ' -o process_id=bbb' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -xc . process_name >test35.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -xc . process_name >test35.tmp 2>&1
diff test35.ref test35.tmp
rm -f main.cf master.cf test35.tmp
@@ -529,7 +529,7 @@ test36: $(PROG) test36.ref
echo 'mydestination=$$virtual_mapx' >> main.cf
echo 'virtual_alias_maps=$$virtual_maps' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nxc . >test36.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nxc . >test36.tmp 2>&1
diff test36.ref test36.tmp
rm -f main.cf master.cf test36.tmp
@@ -543,7 +543,7 @@ test37: $(PROG) test37.ref
echo ' -o always_bcc=$$aaa' >> master.cf
echo ' -o aaa=ccc' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfxc . >test37.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfxc . >test37.tmp 2>&1
diff test37.ref test37.tmp
rm -f main.cf master.cf test37.tmp
@@ -554,7 +554,7 @@ test39: $(PROG) test39.ref
echo bar inet - n n - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc . '*'/unix >test39.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfc . '*'/unix >test39.tmp 2>&1
diff test39.ref test39.tmp
rm -f main.cf master.cf test39.tmp
@@ -566,7 +566,7 @@ test40: $(PROG) test40.ref
echo ' -vo ccc=$$aaa' >> master.cf
echo ' -v -oddd=$$ccc' >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfxc . '*'/unix >test40.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfxc . '*'/unix >test40.tmp 2>&1
diff test40.ref test40.tmp
rm -f main.cf master.cf test40.tmp
@@ -577,11 +577,11 @@ test41: $(PROG) test41.ref
echo bar unix - n n - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Pc . bar/unix/xxx=yyy bar/unix/aaa=bbb >test41.tmp 2>&1
./$(PROG) -Mfc. >>test41.tmp 2>&1
./$(PROG) -Pc . bar/unix/xxx=YYY bar/unix/aaa=BBB >>test41.tmp 2>&1
./$(PROG) -Mfc. >>test41.tmp 2>&1
./$(PROG) -Pc . >>test41.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Pc . bar/unix/xxx=yyy bar/unix/aaa=bbb >test41.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfc. >>test41.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Pc . bar/unix/xxx=YYY bar/unix/aaa=BBB >>test41.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfc. >>test41.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Pc . >>test41.tmp 2>&1
diff test41.ref test41.tmp
rm -f main.cf master.cf test41.tmp
@@ -592,11 +592,11 @@ test42: $(PROG) test42.ref
echo bar unix - n n - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Pc . bar/unix/xxx=yyy bar/unix/aaa=bbb >test42.tmp 2>&1
./$(PROG) -Mfc. >>test42.tmp 2>&1
./$(PROG) -Pc . >>test42.tmp 2>&1
./$(PROG) -PXc. bar/unix/xxx bar/unix/aaa >>test42.tmp 2>&1
./$(PROG) -Mfc. >>test42.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Pc . bar/unix/xxx=yyy bar/unix/aaa=bbb >test42.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfc. >>test42.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Pc . >>test42.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -PXc. bar/unix/xxx bar/unix/aaa >>test42.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfc. >>test42.tmp 2>&1
diff test42.ref test42.tmp
rm -f main.cf master.cf test42.tmp
@@ -607,8 +607,8 @@ test43: $(PROG) test43.ref
echo bar unix - n n - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Fc . bar/unix/chroot=y bar/unix/command='aa -stuffobb=cc dd' >test43.tmp 2>&1
./$(PROG) -Mfc. >>test43.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Fc . bar/unix/chroot=y bar/unix/command='aa -stuffobb=cc dd' >test43.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfc. >>test43.tmp 2>&1
diff test43.ref test43.tmp
rm -f main.cf master.cf test43.tmp
@@ -619,8 +619,8 @@ test44: $(PROG) test44.ref
echo bar unix - n n - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mc . bar/unix='xx inet - n n - 0 aa -stuffobb=cc dd' >test44.tmp 2>&1
./$(PROG) -Mfc. >>test44.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mc . bar/unix='xx inet - n n - 0 aa -stuffobb=cc dd' >test44.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -Mfc. >>test44.tmp 2>&1
diff test44.ref test44.tmp
rm -f main.cf master.cf test44.tmp
@@ -631,7 +631,7 @@ test45: $(PROG) test45.ref
echo bar xxxx - n n - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc. >test45.tmp 2>&1 || true
$(SHLIB_ENV) ./$(PROG) -Mfc. >test45.tmp 2>&1 || true
diff test45.ref test45.tmp
rm -f main.cf master.cf test45.tmp
@@ -642,7 +642,7 @@ test46: $(PROG) test46.ref
echo bar inet X n n - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc. >test46.tmp 2>&1 || true
$(SHLIB_ENV) ./$(PROG) -Mfc. >test46.tmp 2>&1 || true
diff test46.ref test46.tmp
rm -f main.cf master.cf test46.tmp
@@ -653,7 +653,7 @@ test47: $(PROG) test47.ref
echo bar inet - X n - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc. >test47.tmp 2>&1 || true
$(SHLIB_ENV) ./$(PROG) -Mfc. >test47.tmp 2>&1 || true
diff test47.ref test47.tmp
rm -f main.cf master.cf test47.tmp
@@ -664,7 +664,7 @@ test48: $(PROG) test48.ref
echo bar inet - n X - 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc. >test48.tmp 2>&1 || true
$(SHLIB_ENV) ./$(PROG) -Mfc. >test48.tmp 2>&1 || true
diff test48.ref test48.tmp
rm -f main.cf master.cf test48.tmp
@@ -675,7 +675,7 @@ test49: $(PROG) test49.ref
echo bar inet - n n X 0 other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc. >test49.tmp 2>&1 || true
$(SHLIB_ENV) ./$(PROG) -Mfc. >test49.tmp 2>&1 || true
diff test49.ref test49.tmp
rm -f main.cf master.cf test49.tmp
@@ -686,7 +686,7 @@ test50: $(PROG) test50.ref
echo bar inet - n n - X other >> master.cf
echo baz unix - n n - 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc. >test50.tmp 2>&1 || true
$(SHLIB_ENV) ./$(PROG) -Mfc. >test50.tmp 2>&1 || true
diff test50.ref test50.tmp
rm -f main.cf master.cf test50.tmp
@@ -697,7 +697,7 @@ test51: $(PROG) test51.ref
echo bar inet - n n X? 0 other >> master.cf
echo baz unix - n n 0? 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -Mfc. >test51.tmp 2>&1 || true
$(SHLIB_ENV) ./$(PROG) -Mfc. >test51.tmp 2>&1 || true
diff test51.ref test51.tmp
rm -f main.cf master.cf test51.tmp
@@ -708,8 +708,8 @@ test52: $(PROG) test52.ref
echo bar inet - n n 0 0 other >> master.cf
echo baz unix - n n 0 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -MXc. bar/inet foo/unix xxx/yyy
./$(PROG) -Mfc. >test52.tmp 2>&1 || true
$(SHLIB_ENV) ./$(PROG) -MXc. bar/inet foo/unix xxx/yyy
$(SHLIB_ENV) ./$(PROG) -Mfc. >test52.tmp 2>&1 || true
diff test52.ref test52.tmp
rm -f main.cf master.cf test52.tmp
@@ -720,7 +720,7 @@ test53: $(PROG) test53.ref
echo bar inet - n n 0 0 other >> master.cf
echo baz unix - n n 0 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -M#c. bar/inet xxx/yyy
$(SHLIB_ENV) ./$(PROG) -M#c. bar/inet xxx/yyy
diff test53.ref master.cf
rm -f main.cf master.cf test53.tmp
@@ -731,7 +731,7 @@ test54: $(PROG) test54.ref
echo bar inet - n n 0 0 other >> master.cf
echo baz unix - n n 0 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -M#c. bar/inet foo/unix
$(SHLIB_ENV) ./$(PROG) -M#c. bar/inet foo/unix
diff test54.ref master.cf
rm -f main.cf master.cf test54.tmp
@@ -742,7 +742,7 @@ test55: $(PROG) test55.ref
echo bar inet - n n 0 0 other >> master.cf
echo baz unix - n n 0 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -M#c. bar/inet baz/unix
$(SHLIB_ENV) ./$(PROG) -M#c. bar/inet baz/unix
diff test55.ref master.cf
rm -f main.cf master.cf test55.tmp
@@ -755,7 +755,7 @@ test56: $(PROG) test56.ref
echo " -o second" >> master.cf
echo baz unix - n n 0 0 other >> master.cf
touch -t 197101010000 main.cf
./$(PROG) -M#c. bar/inet xxx/yyy
$(SHLIB_ENV) ./$(PROG) -M#c. bar/inet xxx/yyy
diff test56.ref master.cf
rm -f main.cf master.cf test56.tmp
@@ -772,7 +772,7 @@ test57: $(PROG) test57.ref
echo 't1 = Postfix 2.11 $${{$${x?bug:x}} == {bug}?in}compatible' >> main.cf
echo 't2 = $$t1' >> main.cf
touch -t 197101010000 main.cf
./$(PROG) -nxc. >test57.tmp 2>&1
$(SHLIB_ENV) ./$(PROG) -nxc. >test57.tmp 2>&1
diff test57.ref test57.tmp
rm -f main.cf master.cf test57.tmp

View File

@@ -312,6 +312,10 @@
/* don't need to run the \fBpostmap\fR(1) command before you
/* can use the file, and that it does not detect changes after
/* the file is read.
/* .IP "\fBunion\fR (read-only)"
/* A table that sends each query to multiple lookup tables and
/* that concatenates all found results, separated by comma.
/* The table name syntax is the same as for \fBpipemap\fR.
/* .IP "\fBunix\fR (read-only)"
/* A limited view of the UNIX authentication database. The
/* following tables are implemented:

View File

@@ -1,6 +1,7 @@
./postconf: warning: main.cf: syntax error after '}' in "pipemap:{ldap:xxx, memcache:yy}x"
./postconf: warning: main.cf: missing '}' in parameter value: "randmap:{xx"
config_directory = .
mydestination = foo bar pipemap:{ldap:xxx, memcache:yy} randmap:{xx
mydestination = foo bar pipemap:{ldap:xxx, memcache:yy}x randmap:{xx
xxx_domain = foo
yy_backup = bbb
./postconf: warning: ./main.cf: unused parameter: yy_bogus=bbb

View File

@@ -38,7 +38,7 @@ SRCS = alldig.c allprint.c argv.c argv_split.c attr_clnt.c attr_print0.c \
dict_fail.c msg_rate_delay.c dict_surrogate.c warn_stat.c \
dict_sockmap.c line_number.c recv_pass_attr.c pass_accept.c \
poll_fd.c timecmp.c slmdb.c dict_pipe.c dict_random.c \
valid_utf8_hostname.c midna.c argv_splitq.c balpar.c
valid_utf8_hostname.c midna.c argv_splitq.c balpar.c dict_union.c
OBJS = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
attr_print64.o attr_print_plain.o attr_scan0.o attr_scan64.o \
attr_scan_plain.o auto_clnt.o base64_code.o basename.o binhash.o \
@@ -78,7 +78,7 @@ OBJS = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
dict_fail.o msg_rate_delay.o dict_surrogate.o warn_stat.o \
dict_sockmap.o line_number.o recv_pass_attr.o pass_accept.o \
poll_fd.o timecmp.o $(NON_PLUGIN_MAP_OBJ) dict_pipe.o dict_random.o \
valid_utf8_hostname.o midna.o argv_splitq.o balpar.o
valid_utf8_hostname.o midna.o argv_splitq.o balpar.o dict_union.o
# MAP_OBJ is for maps that may be dynamically loaded with dynamicmaps.cf.
# When hard-linking these, makedefs sets NON_PLUGIN_MAP_OBJ=$(MAP_OBJ),
# otherwise it sets the PLUGIN_* macros.
@@ -107,7 +107,7 @@ HDRS = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
edit_file.h dict_cache.h dict_thash.h ip_match.h nbbio.h base32_code.h \
dict_fail.h warn_stat.h dict_sockmap.h line_number.h timecmp.h \
slmdb.h compat_va_copy.h dict_pipe.h dict_random.h \
valid_utf8_hostname.h midna.h
valid_utf8_hostname.h midna.h dict_union.h
TESTSRC = fifo_open.c fifo_rdwr_bug.c fifo_rdonly_bug.c select_bug.c \
stream_test.c dup2_pass_on_exec.c
DEFS = -I. -D$(SYSTYPE)
@@ -1121,6 +1121,7 @@ dict_open.o: dict_sockmap.h
dict_open.o: dict_static.h
dict_open.o: dict_tcp.h
dict_open.o: dict_thash.h
dict_open.o: dict_union.h
dict_open.o: dict_unix.h
dict_open.o: htable.h
dict_open.o: msg.h
@@ -1289,6 +1290,19 @@ dict_thash.o: vbuf.h
dict_thash.o: vstream.h
dict_thash.o: vstring.h
dict_thash.o: warn_stat.h
dict_union.o: argv.h
dict_union.o: dict.h
dict_union.o: dict_union.c
dict_union.o: dict_union.h
dict_union.o: htable.h
dict_union.o: msg.h
dict_union.o: myflock.h
dict_union.o: mymalloc.h
dict_union.o: stringops.h
dict_union.o: sys_defs.h
dict_union.o: vbuf.h
dict_union.o: vstream.h
dict_union.o: vstring.h
dict_unix.o: argv.h
dict_unix.o: dict.h
dict_unix.o: dict_unix.c
@@ -1537,6 +1551,8 @@ load_file.o: vbuf.h
load_file.o: vstream.h
load_file.o: warn_stat.h
load_lib.o: load_lib.c
load_lib.o: load_lib.h
load_lib.o: msg.h
load_lib.o: sys_defs.h
lowercase.o: lowercase.c
lowercase.o: stringops.h
@@ -1554,6 +1570,7 @@ mac_expand.o: mac_expand.h
mac_expand.o: mac_parse.h
mac_expand.o: msg.h
mac_expand.o: mymalloc.h
mac_expand.o: name_code.h
mac_expand.o: stringops.h
mac_expand.o: sys_defs.h
mac_expand.o: vbuf.h

View File

@@ -300,6 +300,7 @@
#include <dict_fail.h>
#include <dict_pipe.h>
#include <dict_random.h>
#include <dict_union.h>
#include <stringops.h>
#include <split_at.h>
#include <htable.h>
@@ -344,6 +345,7 @@ static const DICT_OPEN_INFO dict_open_info[] = {
DICT_TYPE_FAIL, dict_fail_open,
DICT_TYPE_PIPE, dict_pipe_open,
DICT_TYPE_RANDOM, dict_random_open,
DICT_TYPE_UNION, dict_union_open,
#ifndef USE_DYNAMIC_MAPS
#ifdef HAS_PCRE
DICT_TYPE_PCRE, dict_pcre_open,
@@ -369,6 +371,12 @@ static HTABLE *dict_open_hash;
static DICT_OPEN_EXTEND_FN dict_open_extend_hook;
static DICT_MAPNAMES_EXTEND_FN dict_mapnames_extend_hook;
/*
* Workaround.
*/
DEFINE_DICT_LMDB_MAP_SIZE;
DEFINE_DICT_DB_CACHE_SIZE;
/* dict_open_init - one-off initialization */
static void dict_open_init(void)
@@ -524,9 +532,6 @@ DICT_MAPNAMES_EXTEND_FN dict_mapnames_extend(DICT_MAPNAMES_EXTEND_FN new_cb)
#ifdef TEST
DEFINE_DICT_LMDB_MAP_SIZE;
DEFINE_DICT_DB_CACHE_SIZE;
/*
* Proof-of-concept test program.
*/

View File

@@ -0,0 +1,195 @@
/*++
/* NAME
/* dict_union 3
/* SUMMARY
/* dictionary manager interface for union of tables
/* SYNOPSIS
/* #include <dict_union.h>
/*
/* DICT *dict_union_open(name, open_flags, dict_flags)
/* const char *name;
/* int open_flags;
/* int dict_flags;
/* DESCRIPTION
/* dict_union_open() opens a sequence of one or more tables.
/* Example: "\fBunionmap:{\fItype_1:name_1, ..., type_n:name_n\fR}".
/*
/* Each "unionmap:" query is given to each table in the specified
/* order. All found results are concatenated, separated by
/* comma. The unionmap table produces no result when all
/* lookup tables return no result.
/*
/* The first and last characters of a "unionmap:" table name
/* must be '{' and '}'. Within these, individual maps are
/* separated with comma or whitespace.
/*
/* The open_flags and dict_flags arguments are passed on to
/* the underlying dictionaries.
/* SEE ALSO
/* dict(3) generic dictionary manager
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
/* System library. */
#include <sys_defs.h>
#include <string.h>
/* Utility library. */
#include <msg.h>
#include <mymalloc.h>
#include <htable.h>
#include <dict.h>
#include <dict_union.h>
#include <stringops.h>
#include <vstring.h>
/* Application-specific. */
typedef struct {
DICT dict; /* generic members */
ARGV *map_union; /* pipelined tables */
VSTRING *re_buf; /* reply buffer */
} DICT_UNION;
#define STR(x) vstring_str(x)
/* dict_union_lookup - search a bunch of tables and combine the results */
static const char *dict_union_lookup(DICT *dict, const char *query)
{
const char myname[] = "dict_union_lookup";
DICT_UNION *dict_union = (DICT_UNION *) dict;
DICT *map;
char **cpp;
char *dict_type_name;
const char *result = 0;
/*
* After Roel van Meer, postfix-users mailing list, Sept 2014.
*/
VSTRING_RESET(dict_union->re_buf);
for (cpp = dict_union->map_union->argv; (dict_type_name = *cpp) != 0; cpp++) {
if ((map = dict_handle(dict_type_name)) == 0)
msg_panic("%s: dictionary \"%s\" not found", myname, dict_type_name);
if ((result = dict_get(map, query)) == 0)
continue;
if (VSTRING_LEN(dict_union->re_buf) > 0)
VSTRING_ADDCH(dict_union->re_buf, ',');
vstring_strcat(dict_union->re_buf, result);
}
DICT_ERR_VAL_RETURN(dict, DICT_ERR_NONE,
VSTRING_LEN(dict_union->re_buf) > 0 ?
STR(dict_union->re_buf) : 0);
}
/* dict_union_close - disassociate from a bunch of tables */
static void dict_union_close(DICT *dict)
{
DICT_UNION *dict_union = (DICT_UNION *) dict;
char **cpp;
char *dict_type_name;
for (cpp = dict_union->map_union->argv; (dict_type_name = *cpp) != 0; cpp++)
dict_unregister(dict_type_name);
argv_free(dict_union->map_union);
vstring_free(dict_union->re_buf);
dict_free(dict);
}
/* dict_union_open - open a bunch of tables */
DICT *dict_union_open(const char *name, int open_flags, int dict_flags)
{
const char myname[] = "dict_union_open";
DICT_UNION *dict_union;
char *saved_name = 0;
char *dict_type_name;
ARGV *argv = 0;
char **cpp;
DICT *dict;
int match_flags = 0;
struct DICT_OWNER aggr_owner;
size_t len;
/*
* Clarity first. Let the optimizer worry about redundant code.
*/
#define DICT_UNION_RETURN(x) do { \
if (saved_name != 0) \
myfree(saved_name); \
if (argv != 0) \
argv_free(argv); \
return (x); \
} while (0)
/*
* Sanity checks.
*/
if (open_flags != O_RDONLY)
DICT_UNION_RETURN(dict_surrogate(DICT_TYPE_UNION, name,
open_flags, dict_flags,
"%s:%s map requires O_RDONLY access mode",
DICT_TYPE_UNION, name));
/*
* Split the table name into its constituent parts.
*/
saved_name = mystrdup(name + 1); /* XXX ASCII delimiter */
if ((len = balpar(name, "{}")) == 0 || name[len] != 0
|| *(saved_name = mystrndup(name + 1, len - 2)) == 0)
DICT_UNION_RETURN(dict_surrogate(DICT_TYPE_UNION, name,
open_flags, dict_flags,
"bad syntax: \"%s:%s\"; "
"need \"%s:{type:name...}\"",
DICT_TYPE_UNION, name,
DICT_TYPE_UNION));
/*
* The least-trusted table in the set determines the over-all trust
* level. The first table determines the pattern-matching flags.
*/
DICT_OWNER_AGGREGATE_INIT(aggr_owner);
argv = argv_splitq(saved_name, ", \t\r\n", "{}");
for (cpp = argv->argv; (dict_type_name = *cpp) != 0; cpp++) {
if (msg_verbose)
msg_info("%s: %s", myname, dict_type_name);
if (strchr(dict_type_name, ':') == 0)
DICT_UNION_RETURN(dict_surrogate(DICT_TYPE_UNION, name,
open_flags, dict_flags,
"bad syntax: \"%s:%s\"; "
"need \"%s:{type:name...}\"",
DICT_TYPE_UNION, name,
DICT_TYPE_UNION));
if ((dict = dict_handle(dict_type_name)) == 0)
dict = dict_open(dict_type_name, open_flags, dict_flags);
dict_register(dict_type_name, dict);
DICT_OWNER_AGGREGATE_UPDATE(aggr_owner, dict->owner);
if (cpp == argv->argv)
match_flags = dict->flags & (DICT_FLAG_FIXED | DICT_FLAG_PATTERN);
}
/*
* Bundle up the result.
*/
dict_union =
(DICT_UNION *) dict_alloc(DICT_TYPE_UNION, name, sizeof(*dict_union));
dict_union->dict.lookup = dict_union_lookup;
dict_union->dict.close = dict_union_close;
dict_union->dict.flags = dict_flags | match_flags;
dict_union->dict.owner = aggr_owner;
dict_union->re_buf = vstring_alloc(100);
dict_union->map_union = argv;
argv = 0;
DICT_UNION_RETURN(DICT_DEBUG (&dict_union->dict));
}

View File

@@ -0,0 +1,37 @@
#ifndef _DICT_UNION_H_INCLUDED_
#define _DICT_UNION_H_INCLUDED_
/*++
/* NAME
/* dict_union 3h
/* SUMMARY
/* dictionary manager interface for union of tables
/* SYNOPSIS
/* #include <dict_union.h>
/* DESCRIPTION
/* .nf
/*
* Utility library.
*/
#include <dict.h>
/*
* External interface.
*/
#define DICT_TYPE_UNION "unionmap"
extern DICT *dict_union_open(const char *, int, int);
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
#endif