]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.8-20220415
authorWietse Venema <wietse@porcupine.org>
Fri, 15 Apr 2022 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sat, 16 Apr 2022 20:48:41 +0000 (16:48 -0400)
postfix/HISTORY
postfix/README_FILES/SMTPD_POLICY_README
postfix/WISHLIST
postfix/html/SMTPD_POLICY_README.html
postfix/proto/SMTPD_POLICY_README.html
postfix/src/global/mail_proto.h
postfix/src/global/mail_version.h
postfix/src/global/mkmap_open.c
postfix/src/smtpd/smtpd_check.c

index c59bc05729ddaa7a1128f103a9ca2e132ebc324c..5dfd81eda6aa582a0db9e02d4856e01b0c5a10ca 100644 (file)
@@ -26367,3 +26367,20 @@ Apologies for any names omitted.
        cleanup server enters the chroot jail. Files: cleanup/cleanup.h,
        cleanup/cleanup_init.c, cleanup/cleanup_milter.c,
        cleanup/cleanup_state.c.
+
+20220407
+
+       Feature: the policy delegation protocol now sends a
+       "compatibility_level" attribute with the value of the
+       compatibility_level configuration parameter. Files:
+       global/mail_proto.h, smtpd/smtpd_check.c,
+       proto/SMTPD_POLICY_README.html.
+
+20220415
+
+       Cleanup: with dynamic map loading enabled, an attempt to
+       create a map with "postmap regexp:path" would result in a
+       bogus error message "Is the postfix-regexp package installed?"
+       instead of "unsupported map type for this operation".
+       Implemented a workaround for all map types including regexp
+       that have no 'bulk create' support. File: global mkmap_open.c.
index 291fa5c870933eff0256e22f30ab65cdfed38e00..46bbf165f51db6c2d1c955f8275d10c194c141ef 100644 (file)
@@ -85,6 +85,8 @@ a delegated SMTPD access policy request:
     P\bPo\bos\bst\btf\bfi\bix\bx v\bve\ber\brs\bsi\bio\bon\bn 3\b3.\b.2\b2 a\ban\bnd\bd l\bla\bat\bte\ber\br:\b:
     server_address=10.3.2.1
     server_port=54321
+    P\bPo\bos\bst\btf\bfi\bix\bx v\bve\ber\brs\bsi\bio\bon\bn 3\b3.\b.8\b8 a\ban\bnd\bd l\bla\bat\bte\ber\br:\b:
+    compatibility_level=major.minor.patch
     [empty line]
 
 Notes:
@@ -164,6 +166,10 @@ Notes:
   * The "policy_context" attribute provides a way to pass information that is
     not available via other attributes (Postfix version 3.1 and later).
 
+  * The "compatibility_level" attribute corresponds to the compatibility_level
+    parameter value. It has the form major.minor.patch where minor and patch
+    may be absent.
+
 The following is specific to SMTPD delegated policy requests:
 
   * Protocol names are ESMTP or SMTP.
index 808d5e09d07a9149f9834264e28ad78db0403db6..4dccddda9d9f5146d1e9116a56c1894998a60751 100644 (file)
@@ -6,10 +6,14 @@ Wish list:
 
        Disable -DSNAPSHOT and -DNONPROD in makedefs.
 
-       Can tests use LD_PRELOAD to inject fake modules such
-       as fake_dns(3), fake_msg(3), fake_myaddrinfo() and so on?
+       Scan Postfix code with github.com/googleprojectzero/weggli
+       (depends on "rust").
+
+       Can tests use LD_PRELOAD to inject fake modules such as
+       fake_dns(3), fake_msg(3), fake_myaddrinfo(3) and so on?
        One limitation is that functions etc. in a preloaded object
-       always take precedence.
+       always take precedence, even in code that is not being
+       tested.
 
        '%l' support. ef7c661c-d86a-2366-6a73-ec8d51d75012@dev.snart.me
 
index 3f74fc59f336fccc53db47a22e42c4c731a7ec92..aaa5218ed128fc0fb088719167757af73d973c9b 100644 (file)
@@ -116,6 +116,8 @@ policy_context=submission
 <b>Postfix version 3.2 and later:</b>
 server_address=10.3.2.1
 server_port=54321
+<b>Postfix version 3.8 and later:</b>
+<a href="postconf.5.html#compatibility_level">compatibility_level</a>=<i>major</i>.<i>minor</i>.<i>patch</i>
 [empty line]
 </pre>
 </blockquote>
@@ -213,6 +215,11 @@ server_port=54321
     information that is not available via other attributes (Postfix
     version 3.1 and later). </p>
 
+   <li> <p> The "<a href="postconf.5.html#compatibility_level">compatibility_level</a>" attribute corresponds to the
+   <a href="postconf.5.html#compatibility_level">compatibility_level</a> parameter value. It has the form
+   <i>major</i>.<i>minor</i>.<i>patch</i> where <i>minor</i> and
+   <i>patch</i> may be absent. </p>
+
 </ul>
 
 <p> The following is specific to SMTPD delegated policy requests:
index b8df76eaa299891ddeb99a8ddd3d1a8aa11ae7e5..189fb08dd18e78a469be782218883c440170d4f5 100644 (file)
@@ -116,6 +116,8 @@ policy_context=submission
 <b>Postfix version 3.2 and later:</b>
 server_address=10.3.2.1
 server_port=54321
+<b>Postfix version 3.8 and later:</b>
+compatibility_level=<i>major</i>.<i>minor</i>.<i>patch</i>
 [empty line]
 </pre>
 </blockquote>
@@ -213,6 +215,11 @@ server_port=54321
     information that is not available via other attributes (Postfix
     version 3.1 and later). </p>
 
+   <li> <p> The "compatibility_level" attribute corresponds to the
+   compatibility_level parameter value. It has the form
+   <i>major</i>.<i>minor</i>.<i>patch</i> where <i>minor</i> and
+   <i>patch</i> may be absent. </p>
+
 </ul>
 
 <p> The following is specific to SMTPD delegated policy requests:
index b5504638e64eb3a5af30226f023ddf09cad30696..c5f59c2d70ddee1861d14e75848a96fe64939e79 100644 (file)
@@ -200,6 +200,7 @@ extern char *mail_pathname(const char *, const char *);
 #define MAIL_ATTR_CRYPTO_PROTOCOL "encryption_protocol"
 #define MAIL_ATTR_CRYPTO_CIPHER        "encryption_cipher"
 #define MAIL_ATTR_CRYPTO_KEYSIZE "encryption_keysize"
+#define MAIL_ATTR_COMPAT_LEVEL "compatibility_level"
 
  /*
   * Suffixes for sender_name, sender_domain etc.
index a85e79a0c4e33966b04e1aed64667bfb2d84e723..73534c62a625ae0492107bf32ecf1e5ad5c00d6d 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      "20220407"
+#define MAIL_RELEASE_DATE      "20220415"
 #define MAIL_VERSION_NUMBER    "3.8"
 
 #ifdef SNAPSHOT
index 9d15eec30a27f0557c590458e1cddc165ad45e01..1fd566015f8c28ca3c21035c569fd63a50a45625 100644 (file)
 #include <mymalloc.h>
 #include <stringops.h>
 
+ /*
+  * Workaround for map types that have no 'bulk create' support, for example
+  * regexp. When dynamic map loading is enabled, an attempt to create a map
+  * with "postmap regexp:/path" would result in a bogus error message with
+  * "Is the postfix-regexp package installed?" instead of the expected
+  * "unsupported map type for this operation: regexp". The workaround is to
+  * provide explicit definitions for mkmap_open() so that it knows what map
+  * types exist without a 'bulk create' open function.
+  * 
+  * The solution is to merge the {maptype, function} tables that are currently
+  * managed separately by mkmap_open() (for bulk-mode map create operations)
+  * and by dict_open() (for all other operations). That change would be too
+  * invasive for a stable release.
+  */
+#ifdef USE_DYNAMIC_MAPS
+#include <dict_env.h>
+#include <dict_ht.h>
+#include <dict_unix.h>
+#include <dict_tcp.h>
+#include <dict_nis.h>
+#include <dict_nisplus.h>
+#include <dict_ni.h>
+#include <dict_regexp.h>
+#include <dict_static.h>
+#include <dict_cidr.h>
+#include <dict_thash.h>
+#include <dict_sockmap.h>
+#include <dict_pipe.h>
+#include <dict_random.h>
+#include <dict_union.h>
+#include <dict_inline.h>
+#endif
+
 /* Global library. */
 
 #include "mkmap.h"
@@ -137,6 +170,32 @@ static const MKMAP_OPEN_INFO mkmap_open_info[] = {
     DICT_TYPE_BTREE, mkmap_btree_open,
 #endif
     DICT_TYPE_FAIL, mkmap_fail_open,
+#ifdef USE_DYNAMIC_MAPS                        /* Begin workaround */
+    DICT_TYPE_ENVIRON, 0,
+    DICT_TYPE_HT, 0,
+    DICT_TYPE_UNIX, 0,
+    DICT_TYPE_TCP, 0,
+#ifdef HAS_NIS
+    DICT_TYPE_NIS, 0,
+#endif
+#ifdef HAS_NISPLUS
+    DICT_TYPE_NISPLUS, 0,
+#endif
+#ifdef HAS_NETINFO
+    DICT_TYPE_NETINFO, 0,
+#endif
+#ifdef HAS_POSIX_REGEXP
+    DICT_TYPE_REGEXP, 0,
+#endif
+    DICT_TYPE_STATIC, 0,
+    DICT_TYPE_CIDR, 0,
+    DICT_TYPE_THASH, 0,
+    DICT_TYPE_SOCKMAP, 0,
+    DICT_TYPE_PIPE, 0,
+    DICT_TYPE_RANDOM, 0,
+    DICT_TYPE_UNION, 0,
+    DICT_TYPE_INLINE, 0,
+#endif                                 /* End workaround */
     0,
 };
 
@@ -252,9 +311,10 @@ MKMAP  *mkmap_open(const char *type, const char *path,
            mkmap_open_register(type, open_fn);
            mp = (MKMAP_OPEN_INFO *) htable_find(mkmap_open_hash, type);
        }
-       if (mp == 0)
-           msg_fatal("unsupported map type for this operation: %s", type);
     }
+    if (mp == 0 || mp->before_open == 0)
+       msg_fatal("unsupported map type for this operation: %s", type);
+
     if (msg_verbose)
        msg_info("open %s %s", type, path);
 
index a4a6af0633309e1260c03ef78d1860a44728fa90..2785ce1fc732a6d30cc1dcbc583e99c9d06edb64 100644 (file)
@@ -4099,6 +4099,8 @@ static int check_policy_service(SMTPD_STATE *state, const char *server,
 #endif
                          SEND_ATTR_STR(MAIL_ATTR_POL_CONTEXT,
                                        policy_clnt->policy_context),
+                         SEND_ATTR_STR(MAIL_ATTR_COMPAT_LEVEL,
+                                       var_compatibility_level),
                          ATTR_TYPE_END,
                          ATTR_FLAG_MISSING,    /* Reply attributes. */
                          RECV_ATTR_STR(MAIL_ATTR_ACTION, action),