]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.12-20140923
authorWietse Venema <wietse@porcupine.org>
Tue, 23 Sep 2014 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Thu, 25 Sep 2014 00:35:36 +0000 (20:35 -0400)
17 files changed:
postfix/HISTORY
postfix/README_FILES/DATABASE_README
postfix/WISHLIST
postfix/html/DATABASE_README.html
postfix/html/postconf.1.html
postfix/man/man1/postconf.1
postfix/mantools/postlink
postfix/proto/DATABASE_README.html
postfix/src/global/mail_params.c
postfix/src/global/mail_version.h
postfix/src/postconf/Makefile.in
postfix/src/postconf/postconf.c
postfix/src/postconf/test58.ref
postfix/src/util/Makefile.in
postfix/src/util/dict_open.c
postfix/src/util/dict_union.c [new file with mode: 0644]
postfix/src/util/dict_union.h [new file with mode: 0644]

index 14e6c6d9fe5c9c3fe69cd49b1a2ee415fef132cd..a68f8a7f3aebd746188ec24f2741e2327cdbb719 100644 (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].
index 8e0bd8829601f346b96bbf24e63394487c9aefae..2d4d4ffa840ce5145c1287bd433018aaa25472a6 100644 (file)
@@ -293,6 +293,10 @@ To find out what database types your Postfix system supports, use the "p\bpo\bos\bs
         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.
+    u\bun\bni\bio\bon\bnm\bma\bap\bp (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.
     u\bun\bni\bix\bx (read-only)
         A limited view of the UNIX authentication database. The following
         tables are implemented:
index 6a6f6a3f4ece4d4d6e981c0715414b3f6c87928a..46ff863f58b77a9311054a94fbe6c765860997e9 100644 (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
index 830fb4fabd122fccd32699f981f7252629d56746..b90023dc58773b383cd2056d8f6a65462f3c9519 100644 (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
index bb64bd3af7cafc80be800b3bed630487cd304312..35967bebcf4ef8ee18dcea5a3cfa643eda05b124 100644 (file)
@@ -305,43 +305,48 @@ 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
+                     A limited view of the UNIX authentication  database.  The
                      following tables are implemented:
 
                      <b>unix:passwd.byname</b>
-                            The table is the UNIX password database.  The  key
-                            is  a  login  name.  The result is a password file
+                            The  table  is the UNIX password database. The key
+                            is a login name.  The result is  a  password  file
                             entry in <b>passwd</b>(5) format.
 
                      <b>unix:group.byname</b>
                             The table is the UNIX group database. The key is a
-                            group  name.   The result is a group file entry in
+                            group name.  The result is a group file  entry  in
                             <b>group</b>(5) format.
 
-              Other table types may exist depending on how Postfix was  built.
+              Other  table types may exist depending on how Postfix was built.
 
-       <b>-M</b>     Show  <a href="master.5.html"><b>master.cf</b></a>  file contents instead of <a href="postconf.5.html"><b>main.cf</b></a> file contents.
+       <b>-M</b>     Show <a href="master.5.html"><b>master.cf</b></a> file contents instead of <a href="postconf.5.html"><b>main.cf</b></a>  file  contents.
               Specify <b>-Mf</b> to fold long lines for human readability.
 
               Specify zero or more arguments, each with a <i>service-name</i> or <i>ser‐</i>
-              <i>vice-name/service-type</i>  pair,  where  <i>service-name</i>  is the first
-              field of a <a href="master.5.html">master.cf</a> entry and <i>service-type</i>  is  one  of  (<b>inet</b>,
+              <i>vice-name/service-type</i> pair, where  <i>service-name</i>  is  the  first
+              field  of  a  <a href="master.5.html">master.cf</a>  entry and <i>service-type</i> is one of (<b>inet</b>,
               <b>unix</b>, <b>fifo</b>, or <b>pass</b>).
 
-              If  <i>service-name</i> or <i>service-name/service-type</i> is specified, only
-              the matching <a href="master.5.html">master.cf</a> entries  will  be  output.  For  example,
-              "<b>postconf  -Mf  smtp</b>" will output all services named "smtp", and
-              "<b>postconf -Mf smtp/inet</b>" will output only the smtp service  that
-              listens  on  the network.  Trailing service type fields that are
+              If <i>service-name</i> or <i>service-name/service-type</i> is specified,  only
+              the  matching  <a href="master.5.html">master.cf</a>  entries  will  be output. For example,
+              "<b>postconf -Mf smtp</b>" will output all services named  "smtp",  and
+              "<b>postconf  -Mf smtp/inet</b>" will output only the smtp service that
+              listens on the network.  Trailing service type fields  that  are
               omitted will be handled as "*" wildcard fields.
 
               This feature is available with Postfix 2.9 and later. The syntax
-              was  changed  from  "<i>name.type</i>" to "<i>name/type</i>", and "*" wildcard
+              was changed from "<i>name.type</i>" to "<i>name/type</i>",  and  "*"  wildcard
               support was added with Postfix 2.11.
 
        <b>-n</b>     Show only configuration parameters that have explicit <i>name=value</i>
-              settings  in  <a href="postconf.5.html"><b>main.cf</b></a>.  Specify <b>-nf</b> to fold long lines for human
+              settings in <a href="postconf.5.html"><b>main.cf</b></a>.  Specify <b>-nf</b> to fold long lines  for  human
               readability (Postfix 2.9 and later).
 
        <b>-o</b> <i>name=value</i>
@@ -353,50 +358,50 @@ POSTCONF(1)                                                        POSTCONF(1)
 
               This feature is available with Postfix 2.11 and later.
 
-       <b>-P</b>     Show <a href="master.5.html"><b>master.cf</b></a> service parameter settings (by default  all  ser‐
+       <b>-P</b>     Show  <a href="master.5.html"><b>master.cf</b></a>  service parameter settings (by default all ser‐
               vices   and   all   parameters).    formatted   as   one   "<i>ser‐</i>
-              <i>vice/type/parameter=value</i>" per line.  Specify <b>-Pf</b> to  fold  long
+              <i>vice/type/parameter=value</i>"  per  line.  Specify <b>-Pf</b> to fold long
               lines.
 
-              Specify  one  or  more "<i>service/type/parameter</i>" instances on the
-              <a href="postconf.1.html"><b>postconf</b>(1)</a> command line to limit the output  to  parameters  of
-              interest.   Trailing  parameter name or service type fields that
+              Specify one or more "<i>service/type/parameter</i>"  instances  on  the
+              <a href="postconf.1.html"><b>postconf</b>(1)</a>  command  line  to limit the output to parameters of
+              interest.  Trailing parameter name or service type  fields  that
               are omitted will be handled as "*" wildcard fields.
 
               This feature is available with Postfix 2.11 and later.
 
        <b>-t</b> [<i>template</i><b>_</b><i>file</i>]
-              Display the templates for text that appears at the beginning  of
-              delivery  status  notification (DSN) messages, without expanding
+              Display  the templates for text that appears at the beginning of
+              delivery status notification (DSN) messages,  without  expanding
               $<b>name</b> expressions.
 
               To override the built-in templates, specify a template file name
-              at  the  end  of the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line, or specify a file
+              at the end of the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line, or  specify  a  file
               name in <a href="postconf.5.html"><b>main.cf</b></a> with the <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a></b> parameter.
 
-              To force selection of the built-in templates, specify  an  empty
-              template  file  name  on  the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line (in shell
+              To  force  selection of the built-in templates, specify an empty
+              template file name on the <a href="postconf.1.html"><b>postconf</b>(1)</a>  command  line  (in  shell
               language: "").
 
               This feature is available with Postfix 2.3 and later.
 
-       <b>-v</b>     Enable verbose  logging  for  debugging  purposes.  Multiple  <b>-v</b>
+       <b>-v</b>     Enable  verbose  logging  for  debugging  purposes.  Multiple <b>-v</b>
               options make the software increasingly verbose.
 
-       <b>-x</b>     Expand  <i>$name</i>  in  <a href="postconf.5.html"><b>main.cf</b></a>  or  <a href="master.5.html"><b>master.cf</b></a>  parameter values. The
+       <b>-x</b>     Expand <i>$name</i> in  <a href="postconf.5.html"><b>main.cf</b></a>  or  <a href="master.5.html"><b>master.cf</b></a>  parameter  values.  The
               expansion is recursive.
 
               This feature is available with Postfix 2.10 and later.
 
-       <b>-X</b>     Edit the <a href="postconf.5.html"><b>main.cf</b></a> configuration file, and remove  the  parameters
+       <b>-X</b>     Edit  the  <a href="postconf.5.html"><b>main.cf</b></a> configuration file, and remove the parameters
               named on the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line.  Specify a list of param‐
               eter names, not "<i>name=value</i>" pairs.
 
-              With <b>-M</b>, edit the <a href="master.5.html"><b>master.cf</b></a> configuration file, and  remove  one
-              or  more service entries as specified with "<i>service/type</i>" on the
+              With  <b>-M</b>,  edit the <a href="master.5.html"><b>master.cf</b></a> configuration file, and remove one
+              or more service entries as specified with "<i>service/type</i>" on  the
               <a href="postconf.1.html"><b>postconf</b>(1)</a> command line.
 
-              With <b>-P</b>, edit the <a href="master.5.html"><b>master.cf</b></a> configuration file, and  remove  one
+              With  <b>-P</b>,  edit the <a href="master.5.html"><b>master.cf</b></a> configuration file, and remove one
               or more service parameter settings (-o parameter=value settings)
               as specied with "<i>service/type/parameter</i>" on the <a href="postconf.1.html"><b>postconf</b>(1)</a> com‐
               mand line.
@@ -405,10 +410,10 @@ POSTCONF(1)                                                        POSTCONF(1)
               into place.  Specify quotes to protect special characters on the
               <a href="postconf.1.html"><b>postconf</b>(1)</a> command line.
 
-              There  is  no  <a href="postconf.1.html"><b>postconf</b>(1)</a> command to perform the reverse opera‐
+              There is no <a href="postconf.1.html"><b>postconf</b>(1)</a> command to perform  the  reverse  opera‐
               tion.
 
-              This feature is available with Postfix 2.10 and later.   Support
+              This  feature is available with Postfix 2.10 and later.  Support
               for -M and -P was added with Postfix 2.11.
 
        <b>-#</b>     Edit the <a href="postconf.5.html"><b>main.cf</b></a> configuration file, and comment out the parame‐
@@ -416,18 +421,18 @@ POSTCONF(1)                                                        POSTCONF(1)
               eters revert to their default values.  Specify a list of parame‐
               ter names, not "<i>name=value</i>" pairs.
 
-              With <b>-M</b>, edit the <a href="master.5.html"><b>master.cf</b></a> configuration file, and comment  out
-              one  or more service entries as specified with "<i>service/type</i>" on
+              With  <b>-M</b>, edit the <a href="master.5.html"><b>master.cf</b></a> configuration file, and comment out
+              one or more service entries as specified with "<i>service/type</i>"  on
               the <a href="postconf.1.html"><b>postconf</b>(1)</a> command line.
 
               In all cases the file is copied to a temporary file then renamed
               into place.  Specify quotes to protect special characters on the
               <a href="postconf.1.html"><b>postconf</b>(1)</a> command line.
 
-              There is no <a href="postconf.1.html"><b>postconf</b>(1)</a> command to perform  the  reverse  opera‐
+              There  is  no  <a href="postconf.1.html"><b>postconf</b>(1)</a> command to perform the reverse opera‐
               tion.
 
-              This  feature  is  available with Postfix 2.6 and later. Support
+              This feature is available with Postfix 2.6  and  later.  Support
               for -M was added with Postfix 2.11.
 
 <b>DIAGNOSTICS</b>
@@ -438,18 +443,18 @@ POSTCONF(1)                                                        POSTCONF(1)
               Directory with Postfix configuration files.
 
 <b>CONFIGURATION PARAMETERS</b>
-       The following <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant to  this  pro‐
+       The  following  <a href="postconf.5.html"><b>main.cf</b></a> parameters are especially relevant to this pro‐
        gram.
 
-       The  text  below provides only a parameter summary. See <a href="postconf.5.html"><b>postconf</b>(5)</a> for
+       The text below provides only a parameter summary. See  <a href="postconf.5.html"><b>postconf</b>(5)</a>  for
        more details including examples.
 
        <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
-              The default location of the Postfix <a href="postconf.5.html">main.cf</a> and  <a href="master.5.html">master.cf</a>  con‐
+              The  default  location of the Postfix <a href="postconf.5.html">main.cf</a> and <a href="master.5.html">master.cf</a> con‐
               figuration files.
 
        <b><a href="postconf.5.html#bounce_template_file">bounce_template_file</a> (empty)</b>
-              Pathname  of a configuration file with bounce message templates.
+              Pathname of a configuration file with bounce message  templates.
 
 <b>FILES</b>
        /etc/postfix/<a href="postconf.5.html">main.cf</a>, Postfix configuration parameters
index a2db7755ade852b2d3bcd812f8607dc02605bc0f..49d68800de701782261969ec2784eeca1e1b1215 100644 (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:
index 20338dbbbded33f24791f50e4282838f1805636b..733640dd444b5b818bc1d8635c3e441a777a9853 100755 (executable)
@@ -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.
 
index 847ad01b9b4089fca5c5f06ebe216adbafb71371..500f4dc99355e9e891caae46f11ad21cb3d2a1f8 100644 (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
index 67953414b921df8acacbfa526cb16d99df25be63..85682c7b4d043506a93b40650f4dc6d557982c92 100644 (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)
index 3091735b844675856ff766c22dbb45f170fcdb1e..026357a5e8b119378ac5ee9871db0c9d0f4a9c50 100644 (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
index 1a7791f399fb8acea6246ba167966591f1fe69c8..6c885cc3550e59811e9a525427e3edcdb686b20b 100644 (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
 
index 016304f1ad71af26c5b90c1b37e88ac82cd7b76b..ca5e9be14a497f2698deb228b570b5510642959a 100644 (file)
 /*     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:
index 8de9edc81e2954077ddd2d486371ca7b16b61f16..bb8e0c5b686e260997485e18bc9dbe1a4b4b8a6e 100644 (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
index 12e829b7c0620c559cb08ffdeef1c4840456e5c4..803535beaeb53a3d245df626283256f9226c840a 100644 (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
index b50d49dd561e20956245be20d7ab8a62c995cfe6..cd89f86a2182fb577d6257e1d5dabd4cb4a78b18 100644 (file)
 #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.
   */
diff --git a/postfix/src/util/dict_union.c b/postfix/src/util/dict_union.c
new file mode 100644 (file)
index 0000000..cb23009
--- /dev/null
@@ -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));
+}
diff --git a/postfix/src/util/dict_union.h b/postfix/src/util/dict_union.h
new file mode 100644 (file)
index 0000000..9554f84
--- /dev/null
@@ -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