]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.8-20230331
authorWietse Venema <wietse@porcupine.org>
Fri, 31 Mar 2023 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sun, 2 Apr 2023 16:00:52 +0000 (12:00 -0400)
postfix/HISTORY
postfix/WISHLIST
postfix/html/posttls-finger.1.html
postfix/man/man1/posttls-finger.1
postfix/proto/stop.double-history
postfix/src/global/mail_version.h
postfix/src/posttls-finger/posttls-finger.c
postfix/src/smtp/smtp.h
postfix/src/util/Makefile.in
postfix/src/util/clean_env.c
postfix/src/util/split_nameval.c

index 7aeaffb7028466538febb57e23e3c3c5e86610df..43198443ab9f10f7cf86d1e9f502d592c5763492 100644 (file)
@@ -26969,9 +26969,29 @@ Apologies for any names omitted.
 
        Cleanup: renamed net_mask_top.* to inet_prefix_top.*.
 
-       Cleanup: updated unit tests. Files: smtpd/smtod_check.c,
+       Cleanup: updated unit tests. Files: smtpd/smtpd_check.c,
        smtpd/smtpd_server.in, smtpd/smtpd_server.ref.
 
        Increased the smtpd_client_ipv6_prefix_length to 84 bits,
        which should prevent anvil exhaustion attacks from a typical
        /64 consumer network, without penalizing legitimate usage.
+
+20230319
+
+       Shut up a compiler waning triggered by an extreme setting.
+       File: smtp/smtp.h.
+
+20230328
+
+       Cleanup: replaced ``argv_split_append(x, y, "")'' with
+       ``argv_add(x, y, , ARGV_END)'', in two places. File:
+       posttls-finger/posttls-finger.c.
+
+20230330
+
+       Safety: the long form { name = value } in import_environment
+       or export_environment is not documented, but accepted, and
+       it was stored in the process environment as the invalid
+       form "name = value" instead of the expected "name=value".
+       Found during code maintenance. Also refined an "empty name"
+       check. Files: clean_env.c, split_nameval.c.
index 7c891253c67b6330d11ee0b080ce85a29f3c28c7..a83418605bcee8514d4091a876c30b017ec55f3a 100644 (file)
@@ -9,6 +9,13 @@ Wish list:
        Scan Postfix code with github.com/googleprojectzero/weggli
        (depends on "rust").
 
+       Investigate clang-format compatibility as a possible migration
+       away from indent. This requires that the output is stable.
+
+       Check out https://github.com/milter-manager/milter-manager/
+
+       Check out https://cutter.osdn.jp/ (C/C++ unit tests).
+
        Follow https://github.com/vdukhovni/postfix/commits/rpk
 
        Multi-recipient support in sender/recipient_bcc_maps and
@@ -27,11 +34,6 @@ Wish list:
        when the number of attributes received < the expected number?
        If there is no such code, then we can simplify a few things.
 
-       In tls_fprint.c() rename unsafe macros to upper-case names.
-       For example, checkok() has a function-like name, but it
-       evaluates arguments conditionally. Rename all macros that
-       invoke checkok().
-
        Update TLS_README diagram, tlsmgr no longer manages cert
        info.
 
@@ -57,9 +59,6 @@ Wish list:
        Enforce var_line_limit in util/attr_scan*c. This is needed if
        we want to expose Postfix RPC protocols externally.
 
-       Investigate clang-format compatibility as a possible migration
-       away from indent. This requires that the output is stable.
-
        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
index 2ed629a8672ab11c879b0a9a65b7069d0b300fb7..71207d8cf8fdcae1d83c5d200e2a0e68625f5621 100644 (file)
@@ -361,5 +361,7 @@ POSTTLS-FINGER(1)                                            POSTTLS-FINGER(1)
 
        Viktor Dukhovni
 
+       Wietse Venema
+
                                                              POSTTLS-FINGER(1)
 </pre> </body> </html>
index 1e22a03d9e58bab92787c4381723bdf760c9164b..f3bfafaa1e8b2630bc49dc67a8d953200d5f9110 100644 (file)
@@ -343,3 +343,5 @@ Google, Inc.
 New York, NY 10011, USA
 
 Viktor Dukhovni
+
+Wietse Venema
index 18511878d18004a5d24ac2ccf44f2277d8bd1240..602285f0ee3230f8561030671665f8b91418a470 100644 (file)
@@ -37,3 +37,4 @@ proto  proto SASL_README html proto SQLITE_README html
  postfix postfix c postlog postlog c 
  util net_mask_top hc smtpd smtpd c smtpd smtpd_peer c 
  util inet_prefix_top hc smtpd smtpd c smtpd smtpd_peer c 
+ File smtp smtp h 
index 5c8aaba43f73362592fef32d9ac2b42e7a3bf779..6285c99f8dd135e499849aa3787e5c0574db518b 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      "20230314"
+#define MAIL_RELEASE_DATE      "20230331"
 #define MAIL_VERSION_NUMBER    "3.8"
 
 #ifdef SNAPSHOT
index 2a9efe2db5c1c742b9fc0ccc4a3e2824cf57a90e..d83756869756563862dea7f81232d9054c885aaa 100644 (file)
 /*     New York, NY 10011, USA
 /*
 /*     Viktor Dukhovni
+/*
+/*     Wietse Venema
 /*--*/
 
  /*
@@ -2117,14 +2119,14 @@ static void parse_match(STATE *state, int argc, char *argv[])
     case TLS_LEV_SECURE:
        state->match = argv_alloc(2);
        while (*argv)
-           argv_split_append(state->match, *argv++, "");
+           argv_add(state->match, *argv++, ARGV_END);
        if (state->match->argc == 0)
            argv_add(state->match, "nexthop", "dot-nexthop", ARGV_END);
        break;
     case TLS_LEV_VERIFY:
        state->match = argv_alloc(1);
        while (*argv)
-           argv_split_append(state->match, *argv++, "");
+           argv_add(state->match, *argv++, ARGV_END);
        if (state->match->argc == 0)
            argv_add(state->match, "hostname", ARGV_END);
        break;
index 0864313b764da70a471fdbc8c3c33f157e41360a..a3de6ce0c5d07ce74ab973da2a257f788495077a 100644 (file)
@@ -204,7 +204,7 @@ typedef struct SMTP_STATE {
      * One-bit counters to avoid logging the same warning multiple times per
      * delivery request.
      */
-    int     logged_line_length_limit:1;
+    unsigned logged_line_length_limit:1;
 } SMTP_STATE;
 
  /*
@@ -777,4 +777,6 @@ extern int smtp_hfrom_format;
 /*
 /*     Victor Duchovni
 /*     Morgan Stanley
+/*
+/*     Wietse Venema
 /*--*/
index 3e3ea9ab88033f06f9289564c0d1e32c35f742bf..410a893aed2aa2d44dfd46b5d1c47e94a93fab51 100644 (file)
@@ -144,7 +144,8 @@ TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
        valid_utf8_string ip_match base32_code msg_rate_delay netstring \
        vstream timecmp dict_cache midna_domain casefold strcasecmp_utf8 \
        vbuf_print split_qnameval vstream msg_logger byte_mask \
-       known_tcp_ports dict_stream find_inet binhash hash_fnv argv
+       known_tcp_ports dict_stream find_inet binhash hash_fnv argv \
+       clean_env
 PLUGIN_MAP_SO = $(LIB_PREFIX)pcre$(LIB_SUFFIX) $(LIB_PREFIX)lmdb$(LIB_SUFFIX) \
        $(LIB_PREFIX)cdb$(LIB_SUFFIX) $(LIB_PREFIX)sdbm$(LIB_SUFFIX)
 HTABLE_FIX = NORANDOMIZE=1
@@ -504,6 +505,11 @@ find_inet: $(LIB)
        $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
        mv junk $@.o
 
+clean_env: $(LIB)
+       mv $@.o junk
+       $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
+       mv junk $@.o
+
 stream_test: stream_test.c $(LIB)
        $(CC) $(CFLAGS)  -o $@ $@.c $(LIB) $(SYSLIBS)
 
index c6daffac378e71e9f294fad00c36a68570c59a6e..6886c9eae6810c2ffa96aa084c7f76d401951c60 100644 (file)
@@ -38,6 +38,8 @@
 /*     Google, Inc.
 /*     111 8th Avenue
 /*     New York, NY 10011, USA
+/*
+/*     Wietse Venema
 /*--*/
 
 /* System library. */
 /* Utility library. */
 
 #include <msg.h>
+#include <mymalloc.h>
 #include <argv.h>
 #include <safe.h>
 #include <clean_env.h>
+#include <stringops.h>
 
 /* clean_env - clean up the environment */
 
@@ -62,20 +66,27 @@ void    clean_env(char **preserve_list)
     ARGV   *save_list;
     char   *value;
     char  **cpp;
-    char   *eq;
+    char   *copy;
+    char   *key;
+    char   *val;
+    const char *err;
 
     /*
      * Preserve or specify selected environment variables.
      */
-#define STRING_AND_LENGTH(x, y) (x), (ssize_t) (y)
-
     save_list = argv_alloc(10);
-    for (cpp = preserve_list; *cpp; cpp++)
-       if ((eq = strchr(*cpp, '=')) != 0)
-           argv_addn(save_list, STRING_AND_LENGTH(*cpp, eq - *cpp),
-                     STRING_AND_LENGTH(eq + 1, strlen(eq + 1)), (char *) 0);
-       else if ((value = safe_getenv(*cpp)) != 0)
+    for (cpp = preserve_list; *cpp; cpp++) {
+       if (strchr(*cpp, '=') != 0) {
+           copy = mystrdup(*cpp);
+           err = split_nameval(copy, &key, &val);
+           if (err != 0)
+               msg_fatal("clean_env: %s in: %s", err, *cpp);
+           argv_add(save_list, key, val, (char *) 0);
+           myfree(copy);
+       } else if ((value = safe_getenv(*cpp)) != 0) {
            argv_add(save_list, *cpp, value, (char *) 0);
+       }
+    }
 
     /*
      * Truncate the process environment, if available. On some systems
@@ -103,16 +114,25 @@ void    update_env(char **preserve_list)
 {
     char  **cpp;
     ARGV   *save_list;
-    char   *eq;
+    char   *copy;
+    char   *key;
+    char   *val;
+    const char *err;
 
     /*
      * Extract name=value settings.
      */
     save_list = argv_alloc(10);
-    for (cpp = preserve_list; *cpp; cpp++)
-       if ((eq = strchr(*cpp, '=')) != 0)
-           argv_addn(save_list, STRING_AND_LENGTH(*cpp, eq - *cpp),
-                     STRING_AND_LENGTH(eq + 1, strlen(eq + 1)), (char *) 0);
+    for (cpp = preserve_list; *cpp; cpp++) {
+       if (strchr(*cpp, '=') != 0) {
+           copy = mystrdup(*cpp);
+           err = split_nameval(copy, &key, &val);
+           if (err != 0)
+               msg_fatal("update_env: %s in: %s", err, *cpp);
+           argv_add(save_list, key, val, (char *) 0);
+           myfree(copy);
+       }
+    }
 
     /*
      * Apply name=value settings.
@@ -126,3 +146,22 @@ void    update_env(char **preserve_list)
      */
     argv_free(save_list);
 }
+
+#ifdef TEST
+
+#include <stdlib.h>
+#include <vstream.h>
+
+int     main(int argc, char **argv)
+{
+    extern char **environ;
+    char  **cpp;
+
+    clean_env(argv + 1);
+    for (cpp = environ; *cpp; cpp++)
+       vstream_printf("%s\n", *cpp);
+    vstream_fflush(VSTREAM_OUT);
+    exit(0);
+}
+
+#endif
index 0359f1a13aa11a60345aea4727655764cd7062ee..428bc37f53710d8b800bcaa9116db2ba2aafe197 100644 (file)
@@ -43,6 +43,8 @@
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
 /*--*/
 
 /* System libraries. */
@@ -81,7 +83,7 @@ const char *split_nameval(char *buf, char **name, char **value)
     } while (0)
 
     SKIP(buf, np, ISSPACE(*np));               /* find name begin */
-    if (*np == 0)
+    if (*np == 0 || *np == '=')
        return ("missing attribute name");
     SKIP(np, ep, !ISSPACE(*ep) && *ep != '='); /* find name end */
     SKIP(ep, cp, ISSPACE(*cp));                        /* skip blanks before '=' */