]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.7-20210627
authorWietse Venema <wietse@porcupine.org>
Sun, 27 Jun 2021 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Wed, 19 Jan 2022 06:36:07 +0000 (01:36 -0500)
16 files changed:
postfix/HISTORY
postfix/html/master.8.html
postfix/html/postconf.5.html
postfix/man/man5/postconf.5
postfix/mantools/postlink
postfix/proto/postconf.proto
postfix/src/global/Makefile.in
postfix/src/global/compat_level.c
postfix/src/global/mail_version.h
postfix/src/postscreen/Makefile.in
postfix/src/postscreen/postscreen_tests.c
postfix/src/util/Makefile.in
postfix/src/util/mac_expand.c
postfix/src/util/sane_strtol.c [new file with mode: 0644]
postfix/src/util/sane_strtol.h [new file with mode: 0644]
postfix/src/util/slmdb.c

index 862671a8820ed6b588ff706e57e22ed64dd195af..4e60ec2c12c6a0f1761545470041a0760a89b177 100644 (file)
@@ -25637,3 +25637,16 @@ Apologies for any names omitted.
 
        Cleanup: simplify the LMDB error recovery code. File:
        util/slmdb.c.
+
+20210623
+
+       Cleanup: the known_tcp_ports parameter was not hyperlinked.
+       File: mantools/postlink.
+
+       Bugfix: some strtou?l() calls had no 'errno=0' statement
+       before the call. Fixed with strtou?l() wrapper functions
+       that reset errno before calling strtou?l(), and calling
+       these from code that did not explicitly reset errno. Other
+       strtou?l() can be migrated later. Problem reported by David
+       Bohman. Files: util/sane_strtol.[hc], global/compat_level.c,
+       postscreen/postscreen_tests.c, util/mac_expand.c.
index f229bce8b2ca5fab93e6ea253612a3833bd84413..f1fc336a61a978db747268ee824ea8ad21359dda 100644 (file)
@@ -186,7 +186,7 @@ MASTER(8)                                                            MASTER(8)
 
        Available in Postfix 3.6 and later:
 
-       <b>known_tcp_ports  (lmtp=24,  smtp=25,   smtps=submissions=465,   submis-</b>
+       <b><a href="postconf.5.html#known_tcp_ports">known_tcp_ports</a>  (lmtp=24,  smtp=25,   smtps=submissions=465,   submis-</b>
        <b>sion=587)</b>
               Optional setting that avoids lookups in  the  <b>services</b>(5)  data-
               base.
index 5b0691c36d4f236133fc9e6eb5f3b37031699fa6..2a1ec882f2840b9bf7b2cff541765966fc326366 100644 (file)
@@ -4339,13 +4339,13 @@ of the port "465" service. The ABNF is:
 
 <blockquote>
 <p>
-known_tcp_ports = empty | name-to-port *("," name-to-port) <br>
+<a href="postconf.5.html#known_tcp_ports">known_tcp_ports</a> = empty | name-to-port *("," name-to-port) <br>
 name-to-port = 1*(service-name "=') port-number
 </p>
 </blockquote>
 
-<p> Whitespace is optional but it cannot appear inside a service
-name or port number. </p>
+<p> The comma is required. Whitespace is optional but it cannot appear
+inside a service name or port number. </p>
 
 <p> This feature is available in Postfix 3.6 and later. </p>
 
index f9c0263a3fe3839f68b5e3e52c582012463e114c..d33e5c56aaf9a3ebce7f41845ad9ba598ecbb32a 100644 (file)
@@ -2752,8 +2752,8 @@ known_tcp_ports = empty | name\-to\-port *("," name\-to\-port)
 name\-to\-port = 1*(service\-name "=') port\-number
 .in -4
 .PP
-Whitespace is optional but it cannot appear inside a service
-name or port number.
+The comma is required. Whitespace is optional but it cannot appear
+inside a service name or port number.
 .PP
 This feature is available in Postfix 3.6 and later.
 .SH line_length_limit (default: 2048)
index b69a9e400ad4077bbebdf0d409f331d7279acba6..20dac88f594d47339436c49328483e342d9db0a4 100755 (executable)
@@ -775,6 +775,7 @@ while (<>) {
     s;\breset_owner_alias\b;<a href="postconf.5.html#reset_owner_alias">$&</a>;g;
     s;\benable_long_queue_ids\b;<a href="postconf.5.html#enable_long_queue_ids">$&</a>;g;
     s;\benable_threaded_bounces\b;<a href="postconf.5.html#enable_threaded_bounces">$&</a>;g;
+    s;\bknown_tcp_ports\b;<a href="postconf.5.html#known_tcp_ports">$&</a>;g;
 
     # Transport-dependent magical parameters.
 
@@ -882,6 +883,7 @@ while (<>) {
     s/[<bB>]*vir[-<\/bB>]*\n*[ <bB>]*tual[<\/bB>]*\(8\)/<a href="virtual.8.html">$&<\/a>/g;
     s/[<bB>]*cidr_ta[-<\/bB>]*\n*[ <bB>]*ble[<\/bB>]*\(5\)/<a href="cidr_table.5.html">$&<\/a>/g;
     s/[<bB>]*tcp_ta[-<\/bB>]*\n*[ <bB>]*ble[<\/bB>]*\(5\)/<a href="tcp_table.5.html">$&<\/a>/g;
+
     # Workaround...
     s/<b><a href="postconf.5.html#body_checks">body_checks<\/a><\/b>\(5\)/<b>body_checks<\/b>(5)/;
     s/<b><a href="postconf.5.html#header_checks">header_checks<\/a><\/b>\(5\)/<b>header_checks<\/b>(5)/;
@@ -1134,6 +1136,7 @@ while (<>) {
     s;\bmail[-</bB>]*\n*[ <bB>]*log_file_rotate_suffix\b;<a href="postconf.5.html#maillog_file_rotate_suffix">$&</a>;g;
     s;\bpostlog_service_name\b;<a href="postconf.5.html#postlog_service_name">$&</a>;g;
     s;\bpostlogd_watchdog_timeout\b;<a href="postconf.5.html#postlogd_watchdog_timeout">$&</a>;g;
+
     s;\blocal_login_sender_maps\b;<a href="postconf.5.html#local_login_sender_maps">$&</a>;g;
     s;\bempty_address_local_login_sender_maps_lookup_key\b;<a href="postconf.5.html#empty_address_local_login_sender_maps_lookup_key">$&</a>;g;
 
index 59aecf5e7291a59e9e75a640b65622d3a1a475ee..bef8dcfc165545dcced6e7dbe4f4d96df3ef6c45 100644 (file)
@@ -18061,7 +18061,7 @@ name-to-port = 1*(service-name "=') port-number
 </p>
 </blockquote>
 
-<p> Whitespace is optional but it cannot appear inside a service
-name or port number. </p>
+<p> The comma is required. Whitespace is optional but it cannot appear
+inside a service name or port number. </p>
 
 <p> This feature is available in Postfix 3.6 and later. </p>
index 1ee7496fb7081ca0df3a6f5743de6211cec202f1..fc5244175f0e2970423cc1214d6304c99f1cada0 100644 (file)
@@ -983,6 +983,7 @@ compat_level.o: ../../include/check_arg.h
 compat_level.o: ../../include/mac_expand.h
 compat_level.o: ../../include/mac_parse.h
 compat_level.o: ../../include/msg.h
+compat_level.o: ../../include/sane_strtol.h
 compat_level.o: ../../include/sys_defs.h
 compat_level.o: ../../include/vbuf.h
 compat_level.o: ../../include/vstring.h
index 1fb3a68510d22b14ed0af53f7079094592d91588..98d65c4392f7eb223c23e569f6b51df6c459fbeb 100644 (file)
   */
 #include <mac_expand.h>
 #include <msg.h>
+#include <sane_strtol.h>
 
  /*
   * For easy comparison we convert a three-number compatibility level into
@@ -157,21 +158,21 @@ long    compat_level_from_string(const char *str,
     char   *remainder;
 
     start = str;
-    major = strtol(start, &remainder, 10);
+    major = sane_strtol(start, &remainder, 10);
     if (start < remainder && (*remainder == 0 || *remainder == '.')
        && errno != ERANGE && GOOD_MAJOR(major)) {
        res = ENCODE_MAJOR(major);
        if (*remainder == 0)
            return res;
        start = remainder + 1;
-       minor = strtol(start, &remainder, 10);
+       minor = sane_strtol(start, &remainder, 10);
        if (start < remainder && (*remainder == 0 || *remainder == '.')
            && errno != ERANGE && GOOD_MINOR(minor)) {
            res |= ENCODE_MINOR(minor);
            if (*remainder == 0)
                return (res);
            start = remainder + 1;
-           patch = strtol(start, &remainder, 10);
+           patch = sane_strtol(start, &remainder, 10);
            if (start < remainder && *remainder == 0 && errno != ERANGE
                && GOOD_PATCH(patch)) {
                return (res | ENCODE_PATCH(patch));
@@ -407,6 +408,7 @@ static void test_convert(void)
                                                     msg_warn)) < 0)
            continue;
        msg_info("%s -> 0x%lx", vstring_str(buf), compat_level);
+       errno = ERANGE;
        if ((as_string = compat_level_to_string(compat_level,
                                                msg_warn)) == 0)
            continue;
index 989ba2a781e736cbc96cd9b78f881527ead16f85..d7a25e60c94e8db0e08c9e85a923b3e2407fc03a 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      "20210615"
+#define MAIL_RELEASE_DATE      "20210627"
 #define MAIL_VERSION_NUMBER    "3.7"
 
 #ifdef SNAPSHOT
index 82798ed734d1a10b891698f1599172c13f788ccd..8ed869229887ba9ab46792d12a8751454251a76f 100644 (file)
@@ -417,6 +417,7 @@ postscreen_tests.o: ../../include/msg.h
 postscreen_tests.o: ../../include/myaddrinfo.h
 postscreen_tests.o: ../../include/myflock.h
 postscreen_tests.o: ../../include/name_code.h
+postscreen_tests.o: ../../include/sane_strtol.h
 postscreen_tests.o: ../../include/server_acl.h
 postscreen_tests.o: ../../include/string_list.h
 postscreen_tests.o: ../../include/sys_defs.h
index 02dadcac10d4ba906d9740a08adb64a244bfaf19..5e186221ba1a03ef12ffcfebfad11c5105a67c4d 100644 (file)
 
 #include <sys_defs.h>
 #include <stdio.h>                     /* sscanf */
-#include <stdlib.h>                    /* strtoul */
 
 /* Utility library. */
 
 #include <msg.h>
 #include <name_code.h>
+#include <sane_strtol.h>
 
 /* Global library. */
 
@@ -175,7 +175,7 @@ void    psc_parse_tests(PSC_STATE *state,
      * at the time that the cache entry was written.
      */
     for (sp = time_stamps; sp < time_stamps + PSC_TINDX_COUNT; sp++) {
-       *sp = strtoul(start, &cp, 10);
+       *sp = sane_strtoul(start, &cp, 10);
        if (*start == 0 || (*cp != '\0' && *cp != ';') || errno == ERANGE)
            *sp = PSC_TIME_STAMP_DISABLED;
        if (msg_verbose)
index a0bb00a917f85d2fc05e8bebba89048a739967ae..fa23e20e24ca3aeceed4736b7dc2117d17274a1e 100644 (file)
@@ -42,7 +42,8 @@ SRCS  = alldig.c allprint.c argv.c argv_split.c attr_clnt.c attr_print0.c \
        extpar.c dict_inline.c casefold.c dict_utf8.c strcasecmp_utf8.c \
        split_qnameval.c argv_attr_print.c argv_attr_scan.c dict_file.c \
        msg_logger.c logwriter.c unix_dgram_connect.c unix_dgram_listen.c \
-       byte_mask.c known_tcp_ports.c argv_split_at.c dict_stream.c
+       byte_mask.c known_tcp_ports.c argv_split_at.c dict_stream.c \
+       sane_strtol.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 \
@@ -86,7 +87,8 @@ OBJS  = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
        extpar.o dict_inline.o casefold.o dict_utf8.o strcasecmp_utf8.o \
        split_qnameval.o argv_attr_print.o argv_attr_scan.o dict_file.o \
        msg_logger.o logwriter.o unix_dgram_connect.o unix_dgram_listen.o \
-       byte_mask.o known_tcp_ports.o argv_split_at.o dict_stream.o
+       byte_mask.o known_tcp_ports.o argv_split_at.o dict_stream.o \
+       sane_strtol.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.
@@ -117,7 +119,7 @@ HDRS        = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
        slmdb.h compat_va_copy.h dict_pipe.h dict_random.h \
        valid_utf8_hostname.h midna_domain.h dict_union.h dict_inline.h \
        check_arg.h argv_attr.h msg_logger.h logwriter.h byte_mask.h \
-       known_tcp_ports.h
+       known_tcp_ports.h sane_strtol.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)
@@ -2066,6 +2068,7 @@ 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: sane_strtol.h
 mac_expand.o: stringops.h
 mac_expand.o: sys_defs.h
 mac_expand.o: vbuf.h
@@ -2387,6 +2390,9 @@ sane_socketpair.o: msg.h
 sane_socketpair.o: sane_socketpair.c
 sane_socketpair.o: sane_socketpair.h
 sane_socketpair.o: sys_defs.h
+sane_strtol.o: sane_strtol.c
+sane_strtol.o: sane_strtol.h
+sane_strtol.o: sys_defs.h
 sane_time.o: msg.h
 sane_time.o: sane_time.c
 sane_time.o: sane_time.h
index 03dc2d8da49f284f70cf217d30d19847e81bd875..8817e910287305139f5182a9e22d0b551a6641e3 100644 (file)
 #include <mymalloc.h>
 #include <stringops.h>
 #include <name_code.h>
+#include <sane_strtol.h>
 #include <mac_parse.h>
 #include <mac_expand.h>
 
@@ -274,7 +275,7 @@ static long atol_or_die(const char *strval)
     long    result;
     char   *remainder;
 
-    result = strtol(strval, &remainder, 10);
+    result = sane_strtol(strval, &remainder, 10);
     if (*strval == 0 /* can't happen */ || *remainder != 0 || errno == ERANGE)
        msg_fatal("mac_exp_eval: bad conversion: %s", strval);
     return (result);
diff --git a/postfix/src/util/sane_strtol.c b/postfix/src/util/sane_strtol.c
new file mode 100644 (file)
index 0000000..b7435dd
--- /dev/null
@@ -0,0 +1,59 @@
+/*++
+/* NAME
+/*     sane_strtol 3
+/* SUMMARY
+/*     strtol() with mandatory errno reset
+/* SYNOPSIS
+/*     #include <sane_strtol.h>
+/*
+/*     long    sane_strtol(
+/*     const char *start, 
+/*     char **restrict end, 
+/*     int     base)
+/*
+/*     unsigned long sane_strtoul(
+/*     const char *start,
+/*     char **restrict end,
+/*     int     base)
+/* DESCRIPTION
+/*     These functions are wrappers around the strtol() and strtoul()
+/*     standard library functions that reset errno first, so that a
+/*     prior ERANGE error won't cause false errors.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
+/*--*/
+
+ /*
+  * System library.
+  */
+#include <sys_defs.h>
+#include <stdlib.h>
+#include <errno.h>
+
+ /*
+  * Utility library.
+  */
+#include <sane_strtol.h>
+
+/* sane_strtol - strtol() with mandatory initialization */
+
+long    sane_strtol(const char *start, char **end, int base)
+{
+    errno = 0;
+    return (strtol(start, end, base));
+}
+
+/* sane_strtoul - strtoul() with mandatory initialization */
+
+unsigned long sane_strtoul(const char *start, char **end, int base)
+{
+    errno = 0;
+    return (strtoul(start, end, base));
+}
diff --git a/postfix/src/util/sane_strtol.h b/postfix/src/util/sane_strtol.h
new file mode 100644 (file)
index 0000000..ac08316
--- /dev/null
@@ -0,0 +1,26 @@
+/*++
+/* NAME
+/*     sane_strtol 3h
+/* SUMMARY
+/*     strtol() with mandatory errno reset
+/* SYNOPSIS
+/*     #include <sane_strtol.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External API.
+  */
+extern long sane_strtol(const char *start, char **end, int);
+extern unsigned long sane_strtoul(const char *start, char **end, int);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
+/*--*/
index 9f03b477dd1b3b265f9bf6d0c0e03220739273fe..499589d046d7309da6cfbf5bf203cae8f46aeeb9 100644 (file)
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
  /*