]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.3-20170728
authorWietse Venema <wietse@porcupine.org>
Fri, 28 Jul 2017 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sun, 20 Aug 2017 03:39:52 +0000 (23:39 -0400)
15 files changed:
postfix/HISTORY
postfix/README_FILES/ADDRESS_VERIFICATION_README
postfix/WISHLIST
postfix/html/ADDRESS_VERIFICATION_README.html
postfix/html/postconf.5.html
postfix/makedefs
postfix/man/man5/postconf.5
postfix/proto/ADDRESS_VERIFICATION_README.html
postfix/proto/postconf.proto
postfix/src/global/dict_ldap.c
postfix/src/global/mail_version.h
postfix/src/global/verify.c
postfix/src/postconf/Makefile.in
postfix/src/postconf/extract_cfg.sh [new file with mode: 0644]
postfix/src/postconf/postconf_dbms.c

index f5d857a0e049950a7ad50bc901369b651563ae7d..99bd24ab297abff5e3f90b943cebce7cc9d627a7 100644 (file)
@@ -23072,3 +23072,26 @@ Apologies for any names omitted.
        Cleanup: don't log the 'delay_dotcrlf' workaround for CISCO
        PIX bugs before the smtp_pix_workaround_threshold_time has
        passed. Reported by Ralf Hildebrandt. File: smtp/smtp_proto.c.
+
+20170727
+
+       Cleanup: the postconf command now uses mechanically-generated
+       lists of DBMS parameter names. This eliminates false positives
+       with mysql databases. Files: postconf/Makefile.in,
+       postconf/extract_cfg.sh, postconf/postconf_dbms.c.
+
+       Cleanup: removed `#if 0/#endif' dead code from dict_ldap.c,
+       to avoid spurious output from the extract_cfg.sh parameter name
+       extraction tool.
+
+20170728
+
+       Documentation: added warnings that "enable_original_recipient
+       = no" prevents Postfix from saving the address verification
+       result under the original probe destination address, if it
+       is changed by aliasing or canonical mapping.  Files:
+       proto/ADDRESS_VERIFICATION_README.html, proto/postconf.proto.
+
+       Cleanup: don't store an empty address in the verify cache
+       (this could happen with "enable_original_recipient = no").
+       File: global/verify.c.
index 1374a8a2871b103e3d2d0f378a5bd8ae010b0d33..ab2d0625b4ec273ed8c56fad0db83941d5e1701d 100644 (file)
@@ -47,11 +47,9 @@ could include the Postfix MTA itself, or some remote MTAs (SMTP interruptus).
 Probe messages are like normal mail, except that they are never delivered,
 deferred or bounced; probe messages are always discarded.
 
-                               
                                              probe     Postfix
                                             message ->   mail
-                                                        queue
-                Postfix        Postfix   ->
+                Postfix        Postfix   ->             queue
     Internet ->  SMTP   <->     verify
                 server          server                      |
                                                             v
@@ -62,7 +60,6 @@ deferred or bounced; probe messages are always discarded.
                                     ^
                                     |
                                     v
-                                          
 
                               Address
                             verification
@@ -167,6 +164,11 @@ same address repeatedly.
         # Postfix 2.6 and later privacy feature.
         # unverified_recipient_reject_reason = Address lookup failed
 
+        # Do not set enable_original_recipient=no. This prevents Postfix
+        # from saving the recipient address verification result under
+        # the original address, when the address verification probe
+        # message goes through address aliasing or canonical mapping.
+
 The "reject_unknown_recipient_domain" restriction blocks mail for non-existent
 domains. Putting this before "reject_unverified_recipient" avoids the overhead
 of generating unnecessary probe messages.
@@ -207,6 +209,11 @@ verification for specific domains that often appear in forged email.
         # Note 2: Avoid hash files here. Use btree or lmdb instead.
         address_verify_map = btree:/var/lib/postfix/verify
 
+        # Do not set enable_original_recipient=no. This prevents Postfix
+        # from saving the sender address verification result under the
+        # original address, when the address verification probe message
+        # goes through address aliasing or canonical mapping.
+
     /etc/postfix/sender_access:
         # Don't do this when you handle lots of email.
         aol.com     reject_unverified_sender
index 103de3e758a7bbcff6a1e25928fe1d1c700147cf..f0e3a4eed58183e9c419b6e350b224254d1671cd 100644 (file)
@@ -27,7 +27,8 @@ Wish list:
        with a compatibility_level safety net.
 
        In the bounce daemon, set util_utf8_enable if returning an
-       SMTPUTF8 message.
+       SMTPUTF8 message. This is wrong; if SMTPUTF8 is disabled,
+       then Postfix must not turn it on.
 
        Add a header_body_checks extension callback in smtp_proto.c
        that implements the PASS action.
index c1b431cf5aa589cdf5a273a7a0d66dadaf7e574a..58cb7e1ec1a89af029fa838ffd28d72e3f4fc47d 100644 (file)
@@ -298,6 +298,11 @@ the same address repeatedly.  </p>
         ...
     # Postfix 2.6 and later privacy feature.
     # <a href="postconf.5.html#unverified_recipient_reject_reason">unverified_recipient_reject_reason</a> = Address lookup failed
+
+    # Do not set <a href="postconf.5.html#enable_original_recipient">enable_original_recipient</a>=no. This prevents Postfix
+    # from saving the recipient address verification result under
+    # the original address, when the address verification probe
+    # message goes through address aliasing or canonical mapping.
 </pre>
 </blockquote>
 
@@ -348,6 +353,11 @@ in forged email.  </p>
     # Note 1: Be sure to read the "<a href="#caching">Caching</a>" section below!
     # Note 2: Avoid hash files here. Use btree or lmdb instead.
     <a href="postconf.5.html#address_verify_map">address_verify_map</a> = <a href="DATABASE_README.html#types">btree</a>:/var/lib/postfix/verify
+
+    # Do not set <a href="postconf.5.html#enable_original_recipient">enable_original_recipient</a>=no. This prevents Postfix
+    # from saving the sender address verification result under the
+    # original address, when the address verification probe message
+    # goes through address aliasing or canonical mapping.
  
 /etc/postfix/sender_access:
     # Don't do this when you handle lots of email.
index 24ca39583a1e3acac1542ca6ed6e962a1f81197a..3ae17d396e39840fefbb3dd38a400831d776e1a4 100644 (file)
@@ -3203,22 +3203,39 @@ name changes. </p>
 <DT><b><a name="enable_original_recipient">enable_original_recipient</a>
 (default: yes)</b></DT><DD>
 
-<p> Enable support for the X-Original-To message header. This header
-is needed for multi-recipient mailboxes.  </p>
+<p> Enable support to save the original address if a recipient address
+is rewritten to a different address (for example with an alias or with
+canonical mapping). </p>
 
-<p> When this parameter is set to yes, the <a href="cleanup.8.html">cleanup(8)</a> daemon performs
-duplicate elimination on distinct pairs of (original recipient,
-rewritten recipient), and generates non-empty original recipient
-queue file records.  </p>
+<p> The original recipient address is used as follows: </p>
 
-<p> When this parameter is set to no, the <a href="cleanup.8.html">cleanup(8)</a> daemon performs
+<dl>
+
+<dt> X-Original-To message header </dt> <dd> When this parameter
+is set to <b>yes</b>, the original recipient address is stored in
+the X-Original-To message header. This header is needed to distinguish
+between different recipients that share the same mailbox. </dd>
+
+<dt> Recipient deduplication </dt> <dd> When this parameter is set
+to <b>yes</b>, the <a href="cleanup.8.html">cleanup(8)</a> daemon performs duplicate elimination
+on distinct pairs of (original recipient, rewritten recipient), and
+generates non-empty original recipient queue file records. When
+this parameter is set to <b>no</b>, the <a href="cleanup.8.html">cleanup(8)</a> daemon performs
 duplicate elimination on the rewritten recipient address only, and
-generates empty original recipient queue file records.  </p>
+generates empty original recipient queue file records. </dd>
 
-<p> This feature is available in Postfix 2.1 and later. With Postfix
-version 2.0, support for the X-Original-To message header is always turned
-on. Postfix versions before 2.0 have no support for the X-Original-To
-message header.  </p>
+<dt>Address verification </dt> <dd> When this parameter is set to
+<b>yes</b>, an addres verification result is stored under both the
+original and the final recipient address. When this parameter is
+set to <b>no</b>, an address verification result is stored only
+under the final recipient address. </dd>
+
+</ul>
+
+<p> This feature is available in Postfix 2.1 and later. Postfix
+version 2.0 behaves as if this parameter is always set to <b>yes</b>.
+Postfix versions before 2.0 have no support for the original recipient
+address. </p>
 
 
 </DD>
@@ -15258,8 +15275,9 @@ numerical response code when an address probe failed due to a
 temporary problem (default: 450). <br> The
 <a href="postconf.5.html#unverified_recipient_tempfail_action">unverified_recipient_tempfail_action</a> parameter specifies the action
 after address probe failure due to a temporary problem (default:
-<a href="postconf.5.html#defer_if_permit">defer_if_permit</a>).  <br>  This feature is available in Postfix 2.1
-and later.  </dd>
+<a href="postconf.5.html#defer_if_permit">defer_if_permit</a>). <br> This feature breaks for aliased addresses
+when <a href="postconf.5.html#enable_original_recipient">enable_original_recipient</a> is set to "no". <br> This feature
+is available in Postfix 2.1 and later.  </dd>
 
 </dl>
 
@@ -16002,8 +16020,9 @@ change into 550 when you are confident that it is safe to do so).
 code when an address probe failed due to a temporary problem
 (default: 450).  <br> The <a href="postconf.5.html#unverified_sender_tempfail_action">unverified_sender_tempfail_action</a> parameter
 specifies the action after address probe failure due to a temporary
-problem (default: <a href="postconf.5.html#defer_if_permit">defer_if_permit</a>).  <br> This feature is available
-in Postfix 2.1 and later.  </dd>
+problem (default: <a href="postconf.5.html#defer_if_permit">defer_if_permit</a>).  <br> This feature breaks for
+aliased addresses when <a href="postconf.5.html#enable_original_recipient">enable_original_recipient</a> is set to "no".
+<br> This feature is avaiable in Postfix 2.1 and later.  </dd>
 
 </dl>
 
index fde0548b611e401a091812578152875f7108ea9d..4e2952b455f43c1a6565636e45505f90d0fd0a47 100644 (file)
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+# To view the formatted manual page of this file, type:
+#       POSTFIXSOURCE/mantools/srctoman - makedefs | nroff -man
+
 #++
 # NAME
 #      makedefs 1
index c2a4e70182bc9147d67f68221e1962e3af7d17b8..38d336c29926cfb5940a311c34603343aa64866b 100644 (file)
@@ -2007,22 +2007,39 @@ name changes.
 .PP
 This feature is available in Postfix 2.9 and later.
 .SH enable_original_recipient (default: yes)
-Enable support for the X\-Original\-To message header. This header
-is needed for multi\-recipient mailboxes.
-.PP
-When this parameter is set to yes, the \fBcleanup\fR(8) daemon performs
-duplicate elimination on distinct pairs of (original recipient,
-rewritten recipient), and generates non\-empty original recipient
-queue file records.
-.PP
-When this parameter is set to no, the \fBcleanup\fR(8) daemon performs
+Enable support to save the original address if a recipient address
+is rewritten to a different address (for example with an alias or with
+canonical mapping).
+.PP
+The original recipient address is used as follows:
+.IP "X\-Original\-To message header"
+When this parameter
+is set to \fByes\fR, the original recipient address is stored in
+the X\-Original\-To message header. This header is needed to distinguish
+between different recipients that share the same mailbox.
+.br
+.IP "Recipient deduplication"
+When this parameter is set
+to \fByes\fR, the \fBcleanup\fR(8) daemon performs duplicate elimination
+on distinct pairs of (original recipient, rewritten recipient), and
+generates non\-empty original recipient queue file records. When
+this parameter is set to \fBno\fR, the \fBcleanup\fR(8) daemon performs
 duplicate elimination on the rewritten recipient address only, and
 generates empty original recipient queue file records.
+.br
+.IP "Address verification"
+When this parameter is set to
+\fByes\fR, an addres verification result is stored under both the
+original and the final recipient address. When this parameter is
+set to \fBno\fR, an address verification result is stored only
+under the final recipient address.
+.br
+.br
 .PP
-This feature is available in Postfix 2.1 and later. With Postfix
-version 2.0, support for the X\-Original\-To message header is always turned
-on. Postfix versions before 2.0 have no support for the X\-Original\-To
-message header.
+This feature is available in Postfix 2.1 and later. Postfix
+version 2.0 behaves as if this parameter is always set to \fByes\fR.
+Postfix versions before 2.0 have no support for the original recipient
+address.
 .SH error_notice_recipient (default: postmaster)
 The recipient of postmaster notifications about mail delivery
 problems that are caused by policy, resource, software or protocol
@@ -10254,8 +10271,11 @@ unverified_recipient_tempfail_action parameter specifies the action
 after address probe failure due to a temporary problem (default:
 defer_if_permit).
 .br
-This feature is available in Postfix 2.1
-and later.
+This feature breaks for aliased addresses
+when enable_original_recipient is set to "no".
+.br
+This feature
+is available in Postfix 2.1 and later.
 .br
 .br
 .PP
@@ -10834,8 +10854,10 @@ The unverified_sender_tempfail_action parameter
 specifies the action after address probe failure due to a temporary
 problem (default: defer_if_permit).
 .br
-This feature is available
-in Postfix 2.1 and later.
+This feature breaks for
+aliased addresses when enable_original_recipient is set to "no".
+.br
+This feature is avaiable in Postfix 2.1 and later.
 .br
 .br
 .PP
index 613eeb6fdf83f5204abbef6993e7f1e21379a611..e5f4cea11374e7f14d0592b4a915fa80399abf6c 100644 (file)
@@ -298,6 +298,11 @@ the same address repeatedly.  </p>
         ...
     # Postfix 2.6 and later privacy feature.
     # unverified_recipient_reject_reason = Address lookup failed
+
+    # Do not set enable_original_recipient=no. This prevents Postfix
+    # from saving the recipient address verification result under
+    # the original address, when the address verification probe
+    # message goes through address aliasing or canonical mapping.
 </pre>
 </blockquote>
 
@@ -348,6 +353,11 @@ in forged email.  </p>
     # Note 1: Be sure to read the "<a href="#caching">Caching</a>" section below!
     # Note 2: Avoid hash files here. Use btree or lmdb instead.
     address_verify_map = btree:/var/lib/postfix/verify
+
+    # Do not set enable_original_recipient=no. This prevents Postfix
+    # from saving the sender address verification result under the
+    # original address, when the address verification probe message
+    # goes through address aliasing or canonical mapping.
  
 /etc/postfix/sender_access:
     # Don't do this when you handle lots of email.
index f8595a4e046496f4e4aeafd6f92ef7486cfb2f49..c2ca13b9bfc81e3b0807d72b15a7707f8dee126f 100644 (file)
@@ -1402,22 +1402,39 @@ for showq(8) queue displays.  </p>
 
 %PARAM enable_original_recipient yes
 
-<p> Enable support for the X-Original-To message header. This header
-is needed for multi-recipient mailboxes.  </p>
+<p> Enable support to save the original address if a recipient address
+is rewritten to a different address (for example with an alias or with
+canonical mapping). </p>
 
-<p> When this parameter is set to yes, the cleanup(8) daemon performs
-duplicate elimination on distinct pairs of (original recipient,
-rewritten recipient), and generates non-empty original recipient
-queue file records.  </p>
+<p> The original recipient address is used as follows: </p>
 
-<p> When this parameter is set to no, the cleanup(8) daemon performs
+<dl>
+
+<dt> X-Original-To message header </dt> <dd> When this parameter
+is set to <b>yes</b>, the original recipient address is stored in
+the X-Original-To message header. This header is needed to distinguish
+between different recipients that share the same mailbox. </dd>
+
+<dt> Recipient deduplication </dt> <dd> When this parameter is set
+to <b>yes</b>, the cleanup(8) daemon performs duplicate elimination
+on distinct pairs of (original recipient, rewritten recipient), and
+generates non-empty original recipient queue file records. When
+this parameter is set to <b>no</b>, the cleanup(8) daemon performs
 duplicate elimination on the rewritten recipient address only, and
-generates empty original recipient queue file records.  </p>
+generates empty original recipient queue file records. </dd>
 
-<p> This feature is available in Postfix 2.1 and later. With Postfix
-version 2.0, support for the X-Original-To message header is always turned
-on. Postfix versions before 2.0 have no support for the X-Original-To
-message header.  </p>
+<dt>Address verification </dt> <dd> When this parameter is set to
+<b>yes</b>, an addres verification result is stored under both the
+original and the final recipient address. When this parameter is
+set to <b>no</b>, an address verification result is stored only
+under the final recipient address. </dd>
+
+</ul>
+
+<p> This feature is available in Postfix 2.1 and later. Postfix
+version 2.0 behaves as if this parameter is always set to <b>yes</b>.
+Postfix versions before 2.0 have no support for the original recipient
+address. </p>
 
 %PARAM export_environment see "postconf -d" output
 
@@ -6121,8 +6138,9 @@ numerical response code when an address probe failed due to a
 temporary problem (default: 450). <br> The
 unverified_recipient_tempfail_action parameter specifies the action
 after address probe failure due to a temporary problem (default:
-defer_if_permit).  <br>  This feature is available in Postfix 2.1
-and later.  </dd>
+defer_if_permit). <br> This feature breaks for aliased addresses
+when enable_original_recipient is set to "no". <br> This feature
+is available in Postfix 2.1 and later.  </dd>
 
 </dl>
 
@@ -6590,8 +6608,9 @@ change into 550 when you are confident that it is safe to do so).
 code when an address probe failed due to a temporary problem
 (default: 450).  <br> The unverified_sender_tempfail_action parameter
 specifies the action after address probe failure due to a temporary
-problem (default: defer_if_permit).  <br> This feature is available
-in Postfix 2.1 and later.  </dd>
+problem (default: defer_if_permit).  <br> This feature breaks for
+aliased addresses when enable_original_recipient is set to "no".
+<br> This feature is avaiable in Postfix 2.1 and later.  </dd>
 
 </dl>
 
index 3eda3bf95496652a70c7414a30595ead6222d058..9ee00bfcc5b0169f6d01910b236eb2734d72f59d 100644 (file)
@@ -1352,10 +1352,10 @@ static const char *dict_ldap_lookup(DICT *dict, const char *name)
      * Optionally fold the key.
      */
     if (dict->flags & DICT_FLAG_FOLD_FIX) {
-        if (dict->fold_buf == 0)
-            dict->fold_buf = vstring_alloc(10);
-        vstring_strcpy(dict->fold_buf, name);
-        name = lowercase(vstring_str(dict->fold_buf));
+       if (dict->fold_buf == 0)
+           dict->fold_buf = vstring_alloc(10);
+       vstring_strcpy(dict->fold_buf, name);
+       name = lowercase(vstring_str(dict->fold_buf));
     }
 
     /*
@@ -1770,17 +1770,9 @@ DICT   *dict_ldap_open(const char *ldapsource, int open_flags, int dict_flags)
      * set.
      */
     dict_ldap->timeout = cfg_get_int(dict_ldap->parser, "timeout", 10, 0, 0);
-
-#if 0                                          /* No benefit from changing
-                                                * this to match the
-                                                * MySQL/PGSQL syntax */
-    if ((dict_ldap->query =
-        cfg_get_str(dict_ldap->parser, "query", 0, 0, 0)) == 0)
-#endif
-       dict_ldap->query =
-           cfg_get_str(dict_ldap->parser, "query_filter",
-                       "(mailacceptinggeneralid=%s)", 0, 0);
-
+    dict_ldap->query =
+       cfg_get_str(dict_ldap->parser, "query_filter",
+                   "(mailacceptinggeneralid=%s)", 0, 0);
     if ((dict_ldap->result_format =
         cfg_get_str(dict_ldap->parser, "result_format", 0, 0, 0)) == 0)
        dict_ldap->result_format =
index b21a5beabd1e52fbbbcfa37b9a057da71947478a..178bcc3445b169a1c23db041ca2feefdf64d7d31 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      "20170722"
+#define MAIL_RELEASE_DATE      "20170728"
 #define MAIL_VERSION_NUMBER    "3.3"
 
 #ifdef SNAPSHOT
index 8b20ac710bf915cf5fe4e67424ab7f815d8a77cf..67ba31b82cd4f8c63540ed9c5ea5e44e602cac4d 100644 (file)
@@ -100,12 +100,12 @@ int     verify_append(const char *queue_id, MSG_STATS *stats,
      * XXX vrfy_stat is competely redundant because of dsn.
      */
     if (var_verify_neg_cache || vrfy_stat == DEL_RCPT_STAT_OK) {
-       req_stat = verify_clnt_update(recipient->orig_addr, vrfy_stat,
+       req_stat = verify_clnt_update(recipient->address, vrfy_stat,
                                      my_dsn.reason);
        /* Two verify updates for one verify request! */
-       if (req_stat == VRFY_STAT_OK
+       if (req_stat == VRFY_STAT_OK && recipient->orig_addr[0]
          && strcasecmp_utf8(recipient->address, recipient->orig_addr) != 0)
-           req_stat = verify_clnt_update(recipient->address, vrfy_stat,
+           req_stat = verify_clnt_update(recipient->orig_addr, vrfy_stat,
                                          my_dsn.reason);
     } else {
        my_dsn.action = "undeliverable-but-not-cached";
index 4a7d7ead1b8036bc3480071c60063b29bc8bb33a..1a039e5426a8475e6f3e9136e8040baba5d532c4 100644 (file)
@@ -15,7 +15,9 @@ TESTPROG=
 MAKES  = bool_table.h bool_vars.h int_table.h int_vars.h str_table.h \
        str_vars.h time_table.h time_vars.h raw_table.h raw_vars.h \
        nint_table.h nint_vars.h nbool_table.h nbool_vars.h long_table.h \
-       long_vars.h str_fn_table.h str_fn_vars.h
+       long_vars.h str_fn_table.h str_fn_vars.h 
+DB_MAKES= pcf_ldap_suffixes.h pcf_memcache_suffixes.h pcf_mysql_suffixes.h \
+       pcf_pgsql_suffixes.h pcf_sqlite_suffixes.h
 TEST_TMP= main.cf master.cf test*.tmp
 DUMMIES        = makes_dummy # for "make -j"
 PROG   = postconf
@@ -67,6 +69,22 @@ makes_dummy: $(INC_DIR)/mail_params.h ../global/mail_params.c extract.awk Makefi
        $(AWK) -f extract.awk ../*/*.c | $(SHELL)
        touch makes_dummy
 
+$(DB_MAKES): extract_cfg.sh Makefile.in 
+
+pcf_ldap_suffixes.h: ../global/dict_ldap.c 
+       sh extract_cfg.sh -d ../global/dict_ldap.c > $@
+
+pcf_memcache_suffixes.h: ../global/dict_memcache.c 
+       sh extract_cfg.sh -d ../global/dict_memcache.c > $@
+
+pcf_mysql_suffixes.h: ../global/dict_mysql.c 
+       sh extract_cfg.sh -d -s ../global/dict_mysql.c > $@
+
+pcf_pgsql_suffixes.h: ../global/dict_pgsql.c 
+       sh extract_cfg.sh -d -s ../global/dict_pgsql.c > $@
+
+pcf_sqlite_suffixes.h: ../global/dict_sqlite.c
+       sh extract_cfg.sh -d -s ../global/dict_sqlite.c > $@
 
 # Define two parameters with smtpd_restriction_classes. One will be ignored.
 
@@ -899,7 +917,7 @@ lint:
 
 clean:
        rm -f *.o *core $(PROG) $(TESTPROG) junk $(MAKES) $(AUTOS) $(DUMMIES) \
-       $(TEST_TMP)
+       $(TEST_TMP) $(DB_MAKES)
        rm -rf printfck
 
 tidy:  clean
@@ -1009,8 +1027,13 @@ postconf_dbms.o: ../../include/sys_defs.h
 postconf_dbms.o: ../../include/vbuf.h
 postconf_dbms.o: ../../include/vstream.h
 postconf_dbms.o: ../../include/vstring.h
-postconf_dbms.o: postconf.h
+postconf_dbms.o: pcf_ldap_suffixes.h
+postconf_dbms.o: pcf_memcache_suffixes.h
+postconf_dbms.o: pcf_mysql_suffixes.h
+postconf_dbms.o: pcf_pgsql_suffixes.h
 postconf_dbms.o: postconf_dbms.c
+postconf_dbms.o: postconf.h
+postconf_dbms.o: pcf_sqlite_suffixes.h
 postconf_edit.o: ../../include/argv.h
 postconf_edit.o: ../../include/check_arg.h
 postconf_edit.o: ../../include/dict.h
@@ -1029,8 +1052,8 @@ postconf_edit.o: ../../include/vbuf.h
 postconf_edit.o: ../../include/vstream.h
 postconf_edit.o: ../../include/vstring.h
 postconf_edit.o: ../../include/vstring_vstream.h
-postconf_edit.o: postconf.h
 postconf_edit.o: postconf_edit.c
+postconf_edit.o: postconf.h
 postconf_lookup.o: ../../include/argv.h
 postconf_lookup.o: ../../include/check_arg.h
 postconf_lookup.o: ../../include/dict.h
diff --git a/postfix/src/postconf/extract_cfg.sh b/postfix/src/postconf/extract_cfg.sh
new file mode 100644 (file)
index 0000000..d2faf98
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+# To view the formatted manual page of this file, type:
+#      POSTFIXSOURCE/mantools/srctoman - extract_cfg.sh | nroff -man
+
+#++
+# NAME
+#      extract_cfg 1
+# SUMMARY
+#      extract database parameter names from cfg_get_xxx() calls
+# SYNOPSIS
+#      \fBextract_cfg [-d|-s] [\fIfile...\fB]\fR
+# DESCRIPTION
+#      The \fBextract_cfg\fR command extracts the parameter names
+#      from cfg_get_{str,int,bool}() calls in dict_xxx.c files. The
+#      output is one parameter name per line, formatted as a C string
+#      followed by comma.
+#
+#      Options:
+# .IP \fB-d\fR
+#      Add the "domain" parameter to the output. This is used by
+#      the LDAP, memcache, and *SQL* tables.
+# .IP \fB-s\fR
+#      Add the legacy SQL query parameters: "select_field", "table",
+#      "where_field", and "additional_conditions".
+# LICENSE
+# .ad
+# .fi
+#      The Secure Mailer license must be distributed with this software.
+# HISTORY
+# .ad
+# .fi
+#      This command was introduced with Postfix 3.3.
+# AUTHOR(S)
+#      Wietse Venema
+#      Google, Inc.
+#      111 8th Avenue
+#      New York, NY 10011, USA
+#--
+
+# Flags to add db_common parameter names.
+add_legacy_sql_query_params=
+add_domain_param=
+
+# Parse JCL.
+
+while :
+do
+    case "$1" in
+    -d) add_domain_param=1;;
+    -s) add_legacy_sql_query_params=1;;
+    -*) echo Bad option: $1 1>&2; exit 1;;
+     *) break;;
+    esac
+    shift
+done
+
+# We use m4 macros to extract arguments from cfg_get_xxx() calls that
+# may span multiple lines. We sandwich information of interest between
+# control-A characters. Multiple cfg_get_xxx() calls on the same line
+# should be OK, as long as the calls don't nest.
+
+(
+cat <<'EOF'
+define(`cfg_get_str',`\ 1$2\ 1
+')dnl
+define(`cfg_get_int',`\ 1$2\ 1
+')dnl
+define(`cfg_get_bool',`\ 1$2\ 1
+')dnl
+EOF
+# Convert selected C macro definitions into m4 macro definitions.
+sed 's/^#define[       ]*\([DICT_MC_NAME_A-Za-z0-9_]*\)[       ]*\("[^"]*"\)/define(`\1'"'"',`\2'"'"')/' "$@"
+) | m4 | awk -F\ 1 '/\ 1/ { print $2 }' | (
+test -n "$add_domain_param" && {
+cat <<EOF
+"domain"
+EOF
+}
+test -n "$add_legacy_sql_query_params" && {
+cat <<EOF
+"table"
+"select_field"
+"where_field"
+"additional_conditions"
+EOF
+}
+cat -
+) | sort -u | sed 's/$/,/'
index 57f94cc015fe51ac9d02d781cd078fa81e0ea458..eb5bb24db40ee99997e44b0abff9b8549b635795 100644 (file)
 /* See ldap_table(5). */
 
 static const char *pcf_ldap_suffixes[] = {
-    "bind", "bind_dn", "bind_pw", "cache", "cache_expiry", "cache_size",
-    "chase_referrals", "debuglevel", "dereference", "domain",
-    "expansion_limit", "leaf_result_attribute", "query_filter",
-    "recursion_limit", "result_attribute", "result_format",
-    "sasl_authz_id", "sasl_mechs", "sasl_minssf", "sasl_realm",
-    "scope", "search_base", "server_host", "server_port", "size_limit",
-    "special_result_attribute", "start_tls", "terminal_result_attribute",
-    "timeout", "tls_ca_cert_dir", "tls_ca_cert_file", "tls_cert",
-    "tls_cipher_suite", "tls_key", "tls_random_file", "tls_require_cert",
-    "version", 0,
+#include "pcf_ldap_suffixes.h"
+    0,
 };
 
 /* See mysql_table(5). */
 
 static const char *pcf_mysql_suffixes[] = {
-    "additional_conditions", "dbname", "domain", "expansion_limit",
-    "hosts", "password", "query", "result_format", "require_result_set",
-    "select_field", "table", "user", "where_field", 0,
+#include "pcf_mysql_suffixes.h"
+    0,
 };
 
 /* See pgsql_table(5). */
 
 static const char *pcf_pgsql_suffixes[] = {
-    "additional_conditions", "dbname", "domain", "expansion_limit",
-    "hosts", "password", "query", "result_format", "select_field",
-    "select_function", "table", "user", "where_field", 0,
+#include "pcf_pgsql_suffixes.h"
+    0,
 };
 
 /* See sqlite_table(5). */
 
 static const char *pcf_sqlite_suffixes[] = {
-    "additional_conditions", "dbpath", "domain", "expansion_limit",
-    "query", "result_format", "select_field", "table", "where_field",
+#include "pcf_sqlite_suffixes.h"
     0,
 };
 
 /* See memcache_table(5). */
 
 static const char *pcf_memcache_suffixes[] = {
-    "backup", "data_size_limit", "domain", "flags", "key_format",
-    "line_size_limit", "max_try", "memcache", "retry_pause",
-    "timeout", "ttl", 0,
+#include "pcf_memcache_suffixes.h"
+    0,
 };
 
  /*