]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.11-20250818
authorWietse Z Venema <wietse@porcupine.org>
Mon, 18 Aug 2025 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <ietf-dane@dukhovni.org>
Tue, 19 Aug 2025 14:45:52 +0000 (00:45 +1000)
postfix/HISTORY
postfix/src/global/mail_version.h
postfix/src/smtpd/smtpd.c

index 487698196f370f34c4e34b2ae77cf858ffad7ca1..6a4f349d5f4d5fae644d5018e46dd8a274332378 100644 (file)
@@ -29568,3 +29568,10 @@ Apologies for any names omitted.
        documentation. This will be back-ported to Postfix 3.10.
        Files: Makefile.in, smtp/smtp.h smtp/smtp_connect.c,
        smtp/smtp_tls_policy.c, proto/postconf.proto.
+
+20250816
+
+       Bugfix (defect introduced: Postfix 3.0, date 20140731): the
+       smtpd 'disconnect' command counts did not count malformed
+       commands with "bad syntax" and "bad UTF-8 syntax" errors.
+       File: smtpd/smtpd.c.
index 35107f32baf42dc528fae351b03ae08eb56874fd..1ea8819c74810cd30e14140c735f74e6b059f046 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      "20250808"
+#define MAIL_RELEASE_DATE      "20250818"
 #define MAIL_VERSION_NUMBER    "3.11"
 
 #ifdef SNAPSHOT
index 3d3bc79ace3257cc2735fd9c24d59c27cf15496c..66a032eee184fa50cb7d0d9a05cdc070127f888f 100644 (file)
@@ -5639,6 +5639,13 @@ static SMTPD_CMD smtpd_cmd_table[] = {
     {0,},
 };
 
+ /*
+  * In addition to counting unknown commands, the last table element also
+  * counts malformed commands (which aren't looked up in the command table).
+  */
+#define LAST_TABLE_PTR(table) ((table) + sizeof(table)/sizeof(*(table)) - 1)
+static SMTPD_CMD *smtpd_cmdp_unknown = LAST_TABLE_PTR(smtpd_cmd_table);
+
 static STRING_LIST *smtpd_noop_cmds;
 static STRING_LIST *smtpd_forbid_cmds;
 
@@ -6007,6 +6014,8 @@ static void smtpd_proto(SMTPD_STATE *state)
                state->error_mask |= MAIL_ERROR_PROTOCOL;
                smtpd_chat_reply(state, "500 5.5.2 Error: bad UTF-8 syntax");
                state->error_count++;
+               state->where = SMTPD_CMD_UNKNOWN;
+               smtpd_cmdp_unknown->total_count += 1;
                continue;
            }
            /* Move into smtpd_chat_query() and update session transcript. */
@@ -6028,6 +6037,8 @@ static void smtpd_proto(SMTPD_STATE *state)
                state->error_mask |= MAIL_ERROR_PROTOCOL;
                smtpd_chat_reply(state, "500 5.5.2 Error: bad syntax");
                state->error_count++;
+               state->where = SMTPD_CMD_UNKNOWN;
+               smtpd_cmdp_unknown->total_count += 1;
                continue;
            }
            /* Ignore smtpd_noop_cmds lookup errors. Non-critical feature. */
@@ -6036,6 +6047,7 @@ static void smtpd_proto(SMTPD_STATE *state)
                smtpd_chat_reply(state, "250 2.0.0 Ok");
                if (state->junk_cmds++ > var_smtpd_junk_cmd_limit)
                    state->error_count++;
+               /* XXX We can't count these. */
                continue;
            }
            for (cmdp = smtpd_cmd_table; cmdp->name != 0; cmdp++)