]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.5-20200203
authorWietse Venema <wietse@porcupine.org>
Mon, 3 Feb 2020 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Mon, 3 Feb 2020 14:49:13 +0000 (09:49 -0500)
15 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/html/postconf.5.html
postfix/man/man5/postconf.5
postfix/proto/postconf.proto
postfix/src/global/mail_conf_int.c
postfix/src/global/mail_conf_long.c
postfix/src/global/mail_conf_nint.c
postfix/src/global/mail_conf_time.c
postfix/src/global/mail_version.h
postfix/src/global/maillog_client.c
postfix/src/milter/milter.c
postfix/src/milter/milter.h
postfix/src/milter/milter8.c
postfix/src/util/mymalloc.c

index c9cdfc58dd0f9ad55fed710d72dc20a8d5cee37f..1cb5c95c454de1ff803d8b68ab922682a756952c 100644 (file)
@@ -24619,6 +24619,20 @@ Apologies for any names omitted.
        of day) to reach completion, in case a message is submitted
        by a really long-running program. File: postsuper/postsuper.c.
 
-       [initially released as part of postfix-2020XXXX-nonprod]
        Cleanup: postsuper manpage indentation, word abbreviation.
        Files: mantools/postlink, postsuper/postsuper.c.
+
+20200202
+
+       Cleanup: nags about strcpy()/sprintf() from naive checkers.
+       Files: global/mail_conf_int.c, global/mail_conf_long.c,
+       global/mail_conf_nint.c, global/mail_conf_time.c,
+       global/maillog_client.c, util/mymalloc.c.
+
+       Documentation: rephrased the postconf(5) manual page entry
+       for milter_default_action. File: proto/postconf.proto.
+
+       Bugfix (introduced: Postfix 2.5): Milter SMTP connect event
+       macros were evaluated before the Postfix-to-Milter connection
+       had been negotiated. Problem reported by David Bürgin.
+       Files: milter/milter.h, milter/milter.c, milter/milter8.c
index 88889883b92d763733e7c9e6a4e2dd61f5520d42..4136a4a36e7b3c09c4092f9002f73f24936dc5d5 100644 (file)
@@ -30,7 +30,7 @@ Major changes with snapshot 20200202
 
 Support to force-expire email messages. This introduces new
 postsuper(1) command-line options to request expiration, and 
-additional information in mailq command output.
+additional information in mailq(1) or postqueue(1) output.
 
 The forced-to-expire status is stored in a queue file attribute.
 An expired message is returned to the sender when the queue manager
@@ -42,10 +42,10 @@ queue file attribute. The difference is that -f will also release
 a message if it is in the hold queue. With -e, such a message would
 not be returned to the sender until it is released with -f or -H.
 
-In the mailq(1) default output, a forced-to-expire message is
-indicated with # after the queue name. In mailq(1) JSON output there
-is a new per-message field "forced_expire" with the value true or
-false.
+In the mailq(1) or postqueue(1) -p output, a forced-to-expire message
+is indicated with # after the queue name. In postqueue(1) JSON
+output, there is a new per-message field "forced_expire" (with 
+value true or false) that shows the forced-to-expire status.
 
 Incompatible changes with snapshot 20191109
 ===========================================
index df102822dbc12728085387f2cb26a729a213955e..2d927e61d1b3624fa0ccca45f3ec1a0a29e44f7a 100644 (file)
@@ -6803,8 +6803,9 @@ for a list of available macro names and their meanings.  </p>
 <DT><b><a name="milter_default_action">milter_default_action</a>
 (default: tempfail)</b></DT><DD>
 
-<p> The default action when a Milter (mail filter) application is
-unavailable or mis-configured. Specify one of the following: </p>
+<p> The default action when a Milter (mail filter) response is
+unavailable (for example, bad Postfix configuration or Milter
+failure). Specify one of the following: </p>
 
 <dl compact>
 
index 32e0f22bbc144a3d1b4e15421ec78b32f775ec1f..ee76f61d7289806b90a3d2f5a37b0c0acef76dd5 100644 (file)
@@ -4127,8 +4127,9 @@ for a list of available macro names and their meanings.
 .PP
 This feature is available in Postfix 2.3 and later.
 .SH milter_default_action (default: tempfail)
-The default action when a Milter (mail filter) application is
-unavailable or mis\-configured. Specify one of the following:
+The default action when a Milter (mail filter) response is
+unavailable (for example, bad Postfix configuration or Milter
+failure). Specify one of the following:
 .IP "accept"
 Proceed as if the mail filter was not present.
 .br
index 53a72cd01aa0219686d42d604d7d7b7ae93fb0ae..555cdb16e9fe5eef96ca782b1a1908ba76fc9cc7 100644 (file)
@@ -11727,8 +11727,9 @@ will not reply for each individual message header.</dd>
 
 %PARAM milter_default_action tempfail
 
-<p> The default action when a Milter (mail filter) application is
-unavailable or mis-configured. Specify one of the following: </p>
+<p> The default action when a Milter (mail filter) response is
+unavailable (for example, bad Postfix configuration or Milter
+failure). Specify one of the following: </p>
 
 <dl compact>
 
index 882e01cde204cb4d1382ccbae8cc66ff413e56dd..9017183bc430ff8c913b8569e0efe307d3cbffb9 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
 /*--*/
 
 /* System library. */
@@ -177,9 +182,21 @@ int     get_mail_conf_int_fn(const char *name, stupid_indent_int defval,
 
 void    set_mail_conf_int(const char *name, int value)
 {
+    const char myname[] = "set_mail_conf_int";
     char    buf[BUFSIZ];               /* yeah! crappy code! */
 
+#ifndef NO_SNPRINTF
+    ssize_t ret;
+
+    ret = snprintf(buf, sizeof(buf), "%d", value);
+    if (ret < 0)
+       msg_panic("%s: output error for %%d", myname);
+    if (ret >= sizeof(buf))
+       msg_panic("%s: output for %%d exceeds space %ld",
+                 myname, (long) sizeof(buf));
+#else
     sprintf(buf, "%d", value);                 /* yeah! more crappy code! */
+#endif
     mail_conf_update(name, buf);
 }
 
index 96d2e0d0f262933f99257140fcb951733a032a03..c702000f20236ae1dba264166bdb58325404568c 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
 /*--*/
 
 /* System library. */
@@ -167,9 +172,21 @@ long    get_mail_conf_long_fn(const char *name, stupid_indent_long defval,
 
 void    set_mail_conf_long(const char *name, long value)
 {
+    const char myname[] = "set_mail_conf_long";
     char    buf[BUFSIZ];               /* yeah! crappy code! */
 
+#ifndef NO_SNPRINTF
+    ssize_t ret;
+
+    ret = snprintf(buf, sizeof(buf), "%ld", value);
+    if (ret < 0)
+       msg_panic("%s: output error for %%ld", myname);
+    if (ret >= sizeof(buf))
+       msg_panic("%s: output for %%ld exceeds space %ld",
+                 myname, (long) sizeof(buf));
+#else
     sprintf(buf, "%ld", value);                        /* yeah! more crappy code! */
+#endif
     mail_conf_update(name, buf);
 }
 
index a14f417847ca92a4662be1e22e8931957bc6a8a9..e0bd7a10c8f87f91e5c9d5d52c5c215ab0dbf78b 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
 /*--*/
 
 /* System library. */
@@ -186,9 +191,21 @@ void    set_mail_conf_nint(const char *name, const char *value)
 
 void    set_mail_conf_nint_int(const char *name, int value)
 {
+    const char myname[] = "set_mail_conf_nint_int";
     char    buf[BUFSIZ];               /* yeah! crappy code! */
 
+#ifndef NO_SNPRINTF
+    ssize_t ret;
+
+    ret = snprintf(buf, sizeof(buf), "%d", value);
+    if (ret < 0)
+       msg_panic("%s: output error for %%d", myname);
+    if (ret >= sizeof(buf))
+       msg_panic("%s: output for %%d exceeds space %ld",
+                 myname, (long) sizeof(buf));
+#else
     sprintf(buf, "%d", value);                 /* yeah! more crappy code! */
+#endif
     mail_conf_update(name, buf);
 }
 
index 7829c8929a05a555f9bb1881c9ccd850d4fe91f7..5961dfe3c77310be680d4c8921ca36a3b0ff4834 100644 (file)
@@ -193,9 +193,21 @@ void    set_mail_conf_time(const char *name, const char *value)
 
 void    set_mail_conf_time_int(const char *name, int value)
 {
+    const char myname[] = "set_mail_conf_time_int";
     char    buf[BUFSIZ];               /* yeah! crappy code! */
 
+#ifndef NO_SNPRINTF
+    ssize_t ret;
+
+    ret = snprintf(buf, sizeof(buf), "%ds", value);
+    if (ret < 0)
+       msg_panic("%s: output error for %%ds", myname);
+    if (ret >= sizeof(buf))
+       msg_panic("%s: output for %%ds exceeds space %ld",
+                 myname, (long) sizeof(buf));
+#else
     sprintf(buf, "%ds", value);                        /* yeah! more crappy code! */
+#endif
     mail_conf_update(name, buf);
 }
 
index 5ee91ae0c453364b815cefe890ce2420f05e0aeb..4d68518dd506e456d8b0c9e971c09ed49ea12d2c 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      "20200202"
+#define MAIL_RELEASE_DATE      "20200203"
 #define MAIL_VERSION_NUMBER    "3.5"
 
 #ifdef SNAPSHOT
index 6d6a528847cb00278322f29f5872678bc9885d57..50bfbeb7ef61ce52e386dfb5301f19296c2950f2 100644 (file)
@@ -81,6 +81,7 @@
   * System library.
   */
 #include <sys_defs.h>
+#include <stdlib.h>
 #include <string.h>
 
  /*
index ac2baaf7762445a527db60c2d2be3ff48c1f0156..cee169cb47d2d18f58cdf7c2b603db6133ef491c 100644 (file)
@@ -417,6 +417,8 @@ const char *milter_conn_event(MILTERS *milters,
     if (msg_verbose)
        msg_info("report connect to all milters");
     for (resp = 0, m = milters->milter_list; resp == 0 && m != 0; m = m->next) {
+       if (m->connect_on_demand != 0)
+           m->connect_on_demand(m);
        any_macros = MILTER_MACRO_EVAL(global_macros, m, milters, conn_macros);
        resp = m->conn_event(m, client_name, client_addr, client_port,
                             addr_family, any_macros);
index f744910d7831158d0b105d908a989f492f2ebd9e..951744fdb1c1f941d0fb4bab965a2e0ba5a7d837 100644 (file)
@@ -35,6 +35,7 @@ typedef struct MILTER {
     struct MILTER *next;               /* linkage */
     struct MILTERS *parent;            /* parent information */
     struct MILTER_MACROS *macros;      /* private macros */
+    void    (*connect_on_demand) (struct MILTER *);
     const char *(*conn_event) (struct MILTER *, const char *, const char *, const char *, unsigned, ARGV *);
     const char *(*helo_event) (struct MILTER *, const char *, int, ARGV *);
     const char *(*mail_event) (struct MILTER *, const char **, ARGV *);
index 57abc3b21620740812e9eebca1320c2cda51381b..892c38721e20bce073c5c5bfdd07bad9c5c621aa 100644 (file)
@@ -1917,15 +1917,6 @@ static const char *milter8_conn_event(MILTER *m,
 #define STR_EQ(x,y)    (strcmp((x), (y)) == 0)
 #define STR_NE(x,y)    (strcmp((x), (y)) != 0)
 
-    /*
-     * XXX Sendmail 8 libmilter closes the MTA-to-filter socket when it finds
-     * out that the SMTP client has disconnected. Because of this, Postfix
-     * has to open a new MTA-to-filter socket for each SMTP client.
-     */
-#ifdef LIBMILTER_AUTO_DISCONNECT
-    milter8_connect(milter);
-#endif
-
     /*
      * Report the event.
      */
@@ -2835,6 +2826,10 @@ static MILTER8 *milter8_alloc(const char *name, int conn_timeout,
 
     /*
      * Fill in the structure. Note: all strings must be copied.
+     * 
+     * XXX Sendmail 8 libmilter closes the MTA-to-filter socket when it finds
+     * out that the SMTP client has disconnected. Because of this, Postfix
+     * has to open a new MTA-to-filter socket for each SMTP client.
      */
     milter = (MILTER8 *) mymalloc(sizeof(*milter));
     milter->m.name = mystrdup(name);
@@ -2842,6 +2837,11 @@ static MILTER8 *milter8_alloc(const char *name, int conn_timeout,
     milter->m.next = 0;
     milter->m.parent = parent;
     milter->m.macros = 0;
+#ifdef LIBMILTER_AUTO_DISCONNECT
+    milter->m.connect_on_demand = (void (*) (struct MILTER *)) milter8_connect;
+#else
+    milter->m.connect_on_demand = 0;
+#endif
     milter->m.conn_event = milter8_conn_event;
     milter->m.helo_event = milter8_helo_event;
     milter->m.mail_event = milter8_mail_event;
index 1c8199e80a3ec9b9f597a74fb1fb859ca7ea78a5..b5ec37d06d6a4eb8d1337dacfe453659dc25bd46 100644 (file)
@@ -234,7 +234,7 @@ char   *mystrdup(const char *str)
 #endif
     if ((len = strlen(str) + 1) > SSIZE_T_MAX)
        msg_panic("mystrdup: string length >= SSIZE_T_MAX");
-    return (strcpy(mymalloc(len), str));
+    return (memcpy(mymalloc(len), str, len));
 }
 
 /* mystrndup - save substring to heap */