]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.10-20250107
authorWietse Z Venema <wietse@porcupine.org>
Tue, 7 Jan 2025 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <ietf-dane@dukhovni.org>
Wed, 8 Jan 2025 16:59:16 +0000 (03:59 +1100)
23 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/WISHLIST
postfix/html/postconf.5.html
postfix/html/socketmap_table.5.html
postfix/man/man5/postconf.5
postfix/man/man5/socketmap_table.5
postfix/mantools/postlink
postfix/proto/postconf.proto
postfix/proto/socketmap_table
postfix/proto/stop.double-history
postfix/proto/stop.spell-history
postfix/src/cleanup/cleanup_milter.c
postfix/src/global/Makefile.in
postfix/src/global/mail_params.c
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/milter/milter8.c
postfix/src/milter/test-milter.c
postfix/src/smtpd/smtpd.c
postfix/src/util/dict_sockmap.c
postfix/src/util/dict_sockmap.h
postfix/src/util/netstring.c

index 8a8d3cf513b50f292c2b056fd5c7430f3b57b652..c57b542c8a26bb1f3563377fb87c7caf93ed6719 100644 (file)
@@ -28723,19 +28723,60 @@ Apologies for any names omitted.
        to use SMTPUTF8, and therefore can avoid incompatibility
        with sites that do not support SMTPUTF8.
 
+       The encoded result looks like "=?charset?Q?gibberish?=" for
+       quoted-printable encoding, or "=?charset?B?gibberish?=" for
+       base64 encoding. Postfix uses quoted-printable for a full
+       name that is short or mostly ASCII, and uses base64 otherwise.
+
        The new parameter "full_name_encoding_charset" (default:
        "utf-8") specifies the character set of the full name in
        the Postfix sendmail "-F" option, in the Postfix sendmail
        "NAME" environment variable, or in the GECOS field of the
-       UNIX password database.
-
-       The encoded result looks like "=?charset?Q?gibberish?= for
-       quoted-printable encoding, or "=?charset?B?gibberish?= for
-       base64 encoding. Postfix uses quoted-printable for a full
-       name that is short or mostly ASCII, and uses base64 otherwise.
+       UNIX password database. The parameter value is also part
+       of the encoded full name, and informs a Mail User Agent how
+       to display the decoded gibberish.
 
        Files: mantools/postlink, proto/postconf.proto, cleanup/cleanup.c,
        cleanup/cleanup_init.c, cleanup/cleanup_message.c,
        global/ascii_header_text.c, global/ascii_header_text.h,
        global/mail_params.h, global/rfc2047_code.c, global/rfc2047_code.h,
        util/clean_ascii_cntrl_space.c, util/clean_ascii_cntrl_space.h.
+
+20250106
+
+       Cleanup: the Postfix Milter implementation now logs the
+       reason for a quarantine request. If a quarantine action is
+       requested by a Milter application, Postfix will log the
+       reason given by the application. If the quarantine action
+       is requested with the "milter_default_action" parameter
+       setting or with a per-Milter "default_action" property,
+       Postfix will log "default_action". Files: smtpd/smtp_milter.c,
+       cleanup/cleanup_milter.c, milter/milter8.c, milter/test-milter.c.
+
+       Cleanup: suppress repeated logging of a Milter "quarantine",
+       "discard", or "shutdown" request. Files: cleanup/cleanup_milter.c,
+       smtpd/smtpd.c.
+
+       Documentation: cleanup_replace_stray_cr_lf is disabled
+       with "receive_override_options = no_header_body_checks".
+       File: proto/postconf.proto.
+
+20250107
+
+       Re-worded the documentation for RFC 2047 full name encoding.
+       Files: HISTORY, RELEASE_NOTES, proto/postconf.proto.
+
+       Cleanup: eliminated a bogus warning "unexpected SMFIC_UNKNOWN
+       response" when a Milter default action is "quarantine", the
+       milter is unavailable, and a remote SMTP client sends a
+       command that is unknown or known-but-disabled. File:
+       smtpd/smtpd.c.
+
+       Cleanup: the maximum netstring reply size is now configurable
+       with the socketmap_max_reply_size configuration parameter.
+       Code by Christian Roessner. Files: util/dict_sockmap.[hc],
+       global/mail_params.[hc], proto/postconf.proto,
+       proto/socketmap_table.
+
+       Cleanup: the netstring client sets or clears errno to improve
+       error messages from its callers. File: util/netstring.c.
index 0a09f458c3c730212b0101878e5259d52539f1c9..9316a4acfba2f7ee8a7942b99e7e103bc235b501 100644 (file)
@@ -26,6 +26,26 @@ now also distributed with the more recent Eclipse Public License
 license of their choice. Those who are more comfortable with the
 IPL can continue with that license.
 
+[Incompat 20250106]
+
+The logging of the Milter 'quarantine' action has changed. Instead
+of logging "milter triggers HOLD action", it logs the reason given
+by a Milter application, or "default_action" if a Milter application
+was unavailable and the milter_default_action parameter or Milter
+"default_action" property specifies "quarantine".
+
+[Feature 20250106]
+
+The Postfix Milter implementation now logs the reason for a 
+'quarantine' action, instead of "milter triggers HOLD action".
+
+- If the quarantine action was requested by a Milter application,
+  Postfix will log the reason given by the application.
+
+- If the quarantine action was requested with the "milter_default_action"
+  parameter setting or with a Milter "default_action" property,
+  Postfix will log "default_action".
+
 [Feature 20250105]
 
 Support for automatic RFC 2047 encoding of non-ASCII "full name"
@@ -33,6 +53,11 @@ information in Postfix-generated From: message headers. Encoding
 non-ASCII full names can avoid the need to use SMTPUTF8, and therefore
 can avoid incompatibility with sites that do not support SMTPUTF8.
 
+The encoded result looks like "=?charset?Q?gibberish?=: for
+quoted-printable encoding, or "=?charset?B?gibberish?=" for base64
+encoding. Postfix uses quoted-printable for a full name that is
+short or mostly ASCII, and uses base64 otherwise.
+
 Background: when a message without a From: header is submitted with the
 Postfix sendmail(1) command, Postfix will add a From: header and will
 try to use the sender's full name specified with the Postfix sendmail(1)
@@ -43,7 +68,8 @@ This introduces a new configuration parameter "full_name_encoding_charset"
 (default: utf8) which specifies the character set of the full name
 information in the Postfix sendmail(1) "-F" option or "NAME"
 environment variable, or in the GECOS field in the UNIX password
-database.
+database. The parameter value is also part of the encoded full name,
+and informs a Mail User Agent how to display the decoded gibberish.
 
 [Incompat 20250105]
 
index ec31c7bea69276081091f7518d3e97965adfcf2b..64e2ad51fc3802d32ada62c5570a4060a8fcfe62 100644 (file)
@@ -2,7 +2,8 @@ Wish list:
 
        Things to do before the stable release:
 
-       Make the spawn_command fix conditional on compatibility_level.
+       For the stable releases, make the spawn_command fix conditional
+       on compatibility_level.
 
        make pre-release-check, HTML validator check.
 
@@ -18,7 +19,10 @@ Wish list:
        relay_recipient_maps empty should default to 'no valid
        recipients'. Subject to compatibility level.
 
-       Make a reason available for messages placed on 'hold'.
+       The Milter 'quarantine' action should be reported with a
+       call-back function, instead of setting the Milter default
+       reply. However, we still need the existing 'reply' based
+       channel to support "milter_default_action = quarantine".
 
        In pipe_command() and spawn_command(), the child process
        should call initgroups() to corrrectly the access rights
index 679f04df198b193978ad6899a58173cb6790a64c..b673b46c44381554ff17b29c34cfb9f939da87cf 100644 (file)
@@ -1520,6 +1520,9 @@ signature validation by later mail system will not depend on how
 that mail system handles those stray characters in an
 implementation-dependent manner. </p>
 
+<p> Note: this feature is disabled with "<a href="postconf.5.html#receive_override_options">receive_override_options</a> =
+<a href="postconf.5.html#no_header_body_checks">no_header_body_checks</a>". </p>
+
 <p> This feature is available in Postfix &ge; 3.9, 3.8.5, 3.7.10,
 3.6.14, and 3.5.24. </p>
 
@@ -3963,10 +3966,13 @@ in the UNIX password database. In the latter case, Postfix will
 replace the "&amp;" character with the login name, with a lowercase
 ASCII first character converted to uppercase. </p>
 
-<p> NOTE: Postfix does not convert between character sets; it simply
-encodes the raw bytes in a full name as printable ASCII gibberish.
-The <a href="postconf.5.html#full_name_encoding_charset">full_name_encoding_charset</a> value specifies how a mail reader
-program should display the decoded gibberish. </p>
+<p> NOTE: Postfix does not convert between character sets. The
+<a href="postconf.5.html#full_name_encoding_charset">full_name_encoding_charset</a> parameter specifies the character set
+of the full name in the Postfix sendmail "-F" option, in the Postfix
+sendmail "NAME" environment variable, or in the GECOS field of the
+UNIX password database. The parameter value is also part of the
+encoded full name, and informs a Mail User Agent how to display the
+decoded gibberish. </p>
 
 <p> Specify a valid character set name such as "utf-8" or "iso-8859-1
 (specify the latter for full names that use the Latin1 encoding).
@@ -19602,6 +19608,17 @@ built to support these protocols. </p>
 <p> This feature is available in Postfix 3.0 and later. </p>
 
 
+</DD>
+
+<DT><b><a name="socketmap_max_reply_size">socketmap_max_reply_size</a>
+(default: 100000)</b></DT><DD>
+
+<p> The maximum allowed reply size from a socketmap server, not
+including the netstring encapsulation. </p>
+
+<p> This feature is available in Postfix &ge; 3.10. </p>
+
+
 </DD>
 
 <DT><b><a name="soft_bounce">soft_bounce</a>
index ef5115d2bd804d7cc32615a8be518568f100b9a9..ecc1156e9d2d8fc81f9824463fe44d53adb917af 100644 (file)
@@ -45,9 +45,7 @@ SOCKETMAP_TABLE(5)                                          SOCKETMAP_TABLE(5)
        <a href="cidr_table.5.html">cidr</a>:, <a href="pcre_table.5.html">pcre</a>:, and <a href="regexp_table.5.html">regexp</a>: tables.
 
 <b><a name="reply_format">REPLY FORMAT</a></b>
-       The Postfix socketmap client requires that replies are not longer  than
-       100000  characters (not including the netstring encapsulation). Replies
-       must have the following form:
+       Replies must have the following form:
 
        <b>OK</b> &lt;<b>space</b>&gt; <i>data</i>
               The requested data was found.
@@ -63,9 +61,25 @@ SOCKETMAP_TABLE(5)                                          SOCKETMAP_TABLE(5)
               The request failed. The reason,  if  non-empty,  is  descriptive
               text.
 
+<b><a name="protocol_limits">PROTOCOL LIMITS</a></b>
+       The  Postfix  socketmap client requires that replies are no longer than
+       100000 bytes (not including the netstring  encapsulation).  This  limit
+       can  be changed with the <a href="postconf.5.html#socketmap_max_reply_size">socketmap_max_reply_size</a> configuration parame-
+       ter (Postfix 3.10 and later).
+
+       The Postfix socketmap client enforces a 100s time limit to connect to a
+       socketmap  server, to send a request, and to receive a reply. It closes
+       an idle connection after 10s, and closes  an  active  connection  after
+       100s. These limits are not (yet) configurable.
+
 <b><a name="security">SECURITY</a></b>
-       This map cannot be used for security-sensitive information,
-       because neither the connection nor the server are authenticated.
+       This  map  cannot  be  used for security-sensitive information, because
+       neither the connection nor the server are authenticated.
+
+<b><a name="configuration_parameters">CONFIGURATION PARAMETERS</a></b>
+       <b><a href="postconf.5.html#socketmap_max_reply_size">socketmap_max_reply_size</a> (100000)</b>
+              The maximum allowed reply size  from  a  socketmap  server,  not
+              including the netstring encapsulation.
 
 <b><a name="see_also">SEE ALSO</a></b>
        <a href="https://cr.yp.to/proto/netstrings.txt">https://cr.yp.to/proto/netstrings.txt</a>, netstring definition
@@ -79,7 +93,7 @@ SOCKETMAP_TABLE(5)                                          SOCKETMAP_TABLE(5)
        <a href="DATABASE_README.html">DATABASE_README</a>, Postfix lookup table overview
 
 <b><a name="bugs">BUGS</a></b>
-       The protocol limits are not yet configurable.
+       The protocol time limits are not yet configurable.
 
 <b><a name="license">LICENSE</a></b>
        The Secure Mailer license must be distributed with this software.
@@ -87,6 +101,8 @@ SOCKETMAP_TABLE(5)                                          SOCKETMAP_TABLE(5)
 <b><a name="history">HISTORY</a></b>
        Socketmap support was introduced with Postfix version 2.10.
 
+       The socketmap protocol was published with Sendmail v8.13.
+
 <b>AUTHOR(S)</b>
        Wietse Venema
        IBM T.J. Watson Research
@@ -98,5 +114,8 @@ SOCKETMAP_TABLE(5)                                          SOCKETMAP_TABLE(5)
        111 8th Avenue
        New York, NY 10011, USA
 
+       Wietse Venema
+       porcupine.org
+
                                                             SOCKETMAP_TABLE(5)
 </pre> </body> </html>
index b2a4618f620efba50e54e656cc3077029bfae32b..46d3c24ef892a8a7569198aff929021b2e3df1aa 100644 (file)
@@ -893,6 +893,9 @@ signature validation by later mail system will not depend on how
 that mail system handles those stray characters in an
 implementation\-dependent manner.
 .PP
+Note: this feature is disabled with "receive_override_options =
+no_header_body_checks".
+.PP
 This feature is available in Postfix >= 3.9, 3.8.5, 3.7.10,
 3.6.14, and 3.5.24.
 .SH cleanup_service_name (default: cleanup)
@@ -2477,10 +2480,13 @@ in the UNIX password database. In the latter case, Postfix will
 replace the "&" character with the login name, with a lowercase
 ASCII first character converted to uppercase.
 .PP
-NOTE: Postfix does not convert between character sets; it simply
-encodes the raw bytes in a full name as printable ASCII gibberish.
-The full_name_encoding_charset value specifies how a mail reader
-program should display the decoded gibberish.
+NOTE: Postfix does not convert between character sets. The
+full_name_encoding_charset parameter specifies the character set
+of the full name in the Postfix sendmail "\-F" option, in the Postfix
+sendmail "NAME" environment variable, or in the GECOS field of the
+UNIX password database. The parameter value is also part of the
+encoded full name, and informs a Mail User Agent how to display the
+decoded gibberish.
 .PP
 Specify a valid character set name such as "utf\-8" or "iso\-8859\-1
 (specify the latter for full names that use the Latin1 encoding).
@@ -13621,6 +13627,11 @@ in RFC 6531, RFC 6532, and RFC 6533. This requires that Postfix is
 built to support these protocols.
 .PP
 This feature is available in Postfix 3.0 and later.
+.SH socketmap_max_reply_size (default: 100000)
+The maximum allowed reply size from a socketmap server, not
+including the netstring encapsulation.
+.PP
+This feature is available in Postfix >= 3.10.
 .SH soft_bounce (default: no)
 Safety net to keep mail queued that would otherwise be returned to
 the sender.  This parameter disables locally\-generated bounces,
index e4ec27e67b0d6980d3aa03f6f8b4fc13179cc44b..693bb60eab897bee726664de9529e0ea7dc18c97 100644 (file)
@@ -56,9 +56,7 @@ regexp: tables.
 .nf
 .ad
 .fi
-The Postfix socketmap client requires that replies are not
-longer than 100000 characters (not including the netstring
-encapsulation). Replies must have the following form:
+Replies must have the following form:
 .IP "\fBOK <space> \fIdata\fR"
 The requested data was found.
 .IP "\fBNOTFOUND <space>"
@@ -68,11 +66,37 @@ The requested data was not found.
 .IP "\fBPERM <space> \fIreason\fR"
 The request failed. The reason, if non\-empty, is descriptive
 text.
+.SH "PROTOCOL LIMITS"
+.na
+.nf
+.ad
+.fi
+The Postfix socketmap client requires that replies are no
+longer than 100000 bytes (not including the netstring
+encapsulation). This limit can be changed with the
+socketmap_max_reply_size configuration parameter (Postfix 3.10
+and later).
+
+The Postfix socketmap client enforces a 100s time limit to
+connect to a socketmap server, to send a request, and to receive
+a reply. It closes an idle connection after 10s, and closes
+an active connection after 100s. These limits are not (yet)
+configurable.
 .SH "SECURITY"
 .na
 .nf
+.ad
+.fi
 This map cannot be used for security\-sensitive information,
 because neither the connection nor the server are authenticated.
+.SH "CONFIGURATION PARAMETERS"
+.na
+.nf
+.ad
+.fi
+.IP "\fBsocketmap_max_reply_size (100000)\fR"
+The maximum allowed reply size from a socketmap server, not
+including the netstring encapsulation.
 .SH "SEE ALSO"
 .na
 .nf
@@ -95,7 +119,7 @@ DATABASE_README, Postfix lookup table overview
 .SH BUGS
 .ad
 .fi
-The protocol limits are not yet configurable.
+The protocol time limits are not yet configurable.
 .SH "LICENSE"
 .na
 .nf
@@ -106,6 +130,8 @@ The Secure Mailer license must be distributed with this software.
 .ad
 .fi
 Socketmap support was introduced with Postfix version 2.10.
+
+The socketmap protocol was published with Sendmail v8.13.
 .SH "AUTHOR(S)"
 .na
 .nf
@@ -118,3 +144,6 @@ Wietse Venema
 Google, Inc.
 111 8th Avenue
 New York, NY 10011, USA
+
+Wietse Venema
+porcupine.org
index b753d0871c11809732f5957c14678773eb9eae02..5c59da4ee69389e32ed7df703a463c37f3f35318 100755 (executable)
@@ -405,6 +405,7 @@ while (<>) {
     s;\bqmqpd_authorized_clients\b;<a href="postconf.5.html#qmqpd_authorized_clients">$&</a>;g;
     s;\bservice_name\b;<a href="postconf.5.html#service_name">$&</a>;g;
 
+    s;\bsocket[-</Bb>]*\n* *[<Bb>]*map_max_reply_size\b;<a href="postconf.5.html#socketmap_max_reply_size">$&</a>;g;
     s;\bdefault_desti[-</Bb>]*\n* *[<Bb>]*na[-</Bb>]*\n* *[<Bb>]*tion_con[-</Bb>]*\n* *[<Bb>]*cur[-</Bb>]*\n* *[<Bb>]*rency_negative_feedback\b;<a href="postconf.5.html#default_destination_concurrency_negative_feedback">$&</a>;g;
     s;\bdefault_desti[-</Bb>]*\n* *[<Bb>]*na[-</Bb>]*\n* *[<Bb>]*tion_con[-</Bb>]*\n* *[<Bb>]*cur[-</Bb>]*\n* *[<Bb>]*rency_positive_feedback\b;<a href="postconf.5.html#default_destination_concurrency_positive_feedback">$&</a>;g;
     s;\bdefault_desti[-</Bb>]*\n* *[<Bb>]*na[-</Bb>]*\n* *[<Bb>]*tion_con[-</Bb>]*\n* *[<Bb>]*cur[-</Bb>]*\n* *[<Bb>]*rency_failed_cohort_limit\b;<a href="postconf.5.html#default_destination_concurrency_failed_cohort_limit">$&</a>;g;
index d147b6403f7c1b32940dfdadfd3bf3a3bf442e39..5a06d3fb5e2edd53cf7ceb2c4b4acd8b71842ea7 100644 (file)
@@ -19365,6 +19365,9 @@ signature validation by later mail system will not depend on how
 that mail system handles those stray characters in an
 implementation-dependent manner. </p>
 
+<p> Note: this feature is disabled with "receive_override_options =
+no_header_body_checks". </p>
+
 <p> This feature is available in Postfix &ge; 3.9, 3.8.5, 3.7.10,
 3.6.14, and 3.5.24. </p>
 
@@ -19448,10 +19451,13 @@ in the UNIX password database. In the latter case, Postfix will
 replace the "&amp;" character with the login name, with a lowercase
 ASCII first character converted to uppercase. </p>
 
-<p> NOTE: Postfix does not convert between character sets; it simply
-encodes the raw bytes in a full name as printable ASCII gibberish.
-The full_name_encoding_charset value specifies how a mail reader
-program should display the decoded gibberish. </p>
+<p> NOTE: Postfix does not convert between character sets. The
+full_name_encoding_charset parameter specifies the character set
+of the full name in the Postfix sendmail "-F" option, in the Postfix
+sendmail "NAME" environment variable, or in the GECOS field of the
+UNIX password database. The parameter value is also part of the
+encoded full name, and informs a Mail User Agent how to display the
+decoded gibberish. </p>
 
 <p> Specify a valid character set name such as "utf-8" or "iso-8859-1
 (specify the latter for full names that use the Latin1 encoding).
@@ -19460,3 +19466,10 @@ name violates RFC 2047 syntax, Postfix will log a warning and will
 skip the full name. </p>
 
 <p> This feature is available in Postfix &ge; 3.10. </p>
+
+%PARAM socketmap_max_reply_size 100000
+
+<p> The maximum allowed reply size from a socketmap server, not
+including the netstring encapsulation. </p>
+
+<p> This feature is available in Postfix &ge; 3.10. </p>
index 305afb1eef3470939dc988552ae72e49b6a6d7f7..47205b735ffcd4c96406ab0b87a498ce1ff769b4 100644 (file)
@@ -44,9 +44,7 @@
 # REPLY FORMAT
 # .ad
 # .fi
-#      The Postfix socketmap client requires that replies are not
-#      longer than 100000 characters (not including the netstring
-#      encapsulation). Replies must have the following form:
+#      Replies must have the following form:
 # .IP "\fBOK <space> \fIdata\fR"
 #      The requested data was found.
 # .IP "\fBNOTFOUND <space>"
 # .IP "\fBPERM <space> \fIreason\fR"
 #      The request failed. The reason, if non-empty, is descriptive
 #      text.
+# PROTOCOL LIMITS
+# .ad
+# .fi
+#      The Postfix socketmap client requires that replies are no
+#      longer than 100000 bytes (not including the netstring
+#      encapsulation). This limit can be changed with the
+#      socketmap_max_reply_size configuration parameter (Postfix 3.10
+#      and later).
+#
+#      The Postfix socketmap client enforces a 100s time limit to
+#      connect to a socketmap server, to send a request, and to receive
+#      a reply. It closes an idle connection after 10s, and closes
+#      an active connection after 100s. These limits are not (yet)
+#      configurable.
 # SECURITY
+# .ad
+# .fi
 #      This map cannot be used for security-sensitive information,
 #      because neither the connection nor the server are authenticated.
+# CONFIGURATION PARAMETERS
+# .ad
+# .fi
+# .IP "\fBsocketmap_max_reply_size (100000)\fR"
+#      The maximum allowed reply size from a socketmap server, not
+#      including the netstring encapsulation.
 # SEE ALSO
 #      https://cr.yp.to/proto/netstrings.txt, netstring definition
 #      postconf(1), Postfix supported lookup tables
 # .nf
 #      DATABASE_README, Postfix lookup table overview
 # BUGS
-#      The protocol limits are not yet configurable.
+#      The protocol time limits are not yet configurable.
 # LICENSE
 # .ad
 # .fi
 #      The Secure Mailer license must be distributed with this software.
 # HISTORY
 #      Socketmap support was introduced with Postfix version 2.10.
+#
+#      The socketmap protocol was published with Sendmail v8.13.
 # AUTHOR(S)
 #      Wietse Venema
 #      IBM T.J. Watson Research
 #      Google, Inc.
 #      111 8th Avenue
 #      New York, NY 10011, USA
+#
+#      Wietse Venema
+#      porcupine.org
 #--
 
index ff1c0f338b50a0a4723ddc0346e7b3289413f014..ebc38fcc28cdf033b00749fd5c13723977672a04 100644 (file)
@@ -150,3 +150,5 @@ proto  proto socketmap_table qmqpd qmqpd c tls tls_misc c
  logging to the standard error stream File postlog postlog c 
  Files mantools postlink proto postconf proto cleanup cleanup c 
  many errors I O timeout lost connection File smtpd smtpd c 
+ that is unknown or known but disabled File smtpd smtpd c 
+proto  proto socketmap_table 
index 9a892a1d589ca3d310b299046bbd6e1f77d534f5..29ba11fe1cec0c63eef9e7f601ce7aee57c5fa3e 100644 (file)
@@ -96,3 +96,4 @@ v'expr
 roff
 diffs
 CLOSEFROM
+Roessner
index a35344c93269f0cf6291cf04384b19da80d73df5..9fe7aa1320ce64003f50d754976450736bb237ce 100644 (file)
@@ -2063,19 +2063,22 @@ static const char *cleanup_milter_apply(CLEANUP_STATE *state, const char *event,
        return (0);
     switch (resp[0]) {
     case 'H':
-       /* XXX Should log the reason here. */
        if (state->flags & CLEANUP_FLAG_HOLD)
            return (0);
        state->flags |= CLEANUP_FLAG_HOLD;
        action = "milter-hold";
-       text = "milter triggers HOLD action";
+       text = resp[1] ? resp + 1 : "milter triggers HOLD action";
        break;
     case 'D':
+       if (state->flags & CLEANUP_FLAG_DISCARD)
+           return (0);
        state->flags |= CLEANUP_FLAG_DISCARD;
        action = "milter-discard";
        text = "milter triggers DISCARD action";
        break;
     case 'S':
+       if (state->flags & CLEANUP_STAT_CONT)
+           return (0);
        /* XXX Can this happen after end-of-message? */
        state->flags |= CLEANUP_STAT_CONT;
        action = "milter-reject";
index 27e1ab961aec313e30d9c765fedea5264cf49331..47c291ffa4b438c7b9fb87a7bff3cddef4a89888 100644 (file)
@@ -1943,6 +1943,7 @@ mail_params.o: ../../include/check_arg.h
 mail_params.o: ../../include/dict.h
 mail_params.o: ../../include/dict_db.h
 mail_params.o: ../../include/dict_lmdb.h
+mail_params.o: ../../include/dict_sockmap.h
 mail_params.o: ../../include/get_hostname.h
 mail_params.o: ../../include/htable.h
 mail_params.o: ../../include/inet_addr_list.h
index 17fe040f603894cbf4cad5dd9a130e587bbeea2a..5147c0915af0f763f79652f61addbbf51556e5f8 100644 (file)
 #include <dict.h>
 #include <dict_db.h>
 #include <dict_lmdb.h>
+#include <dict_sockmap.h>
 #include <inet_proto.h>
 #include <vstring_vstream.h>
 #include <iostuff.h>
@@ -352,6 +353,7 @@ int     var_strict_encoding;
 int     var_verify_neg_cache;
 int     var_oldlog_compat;
 int     var_delay_max_res;
+int     var_sockmap_max_reply;
 char   *var_int_filt_classes;
 int     var_cyrus_sasl_authzid;
 
@@ -838,6 +840,7 @@ void    mail_params_init()
        VAR_MIME_BOUND_LEN, DEF_MIME_BOUND_LEN, &var_mime_bound_len, 1, 0,
        VAR_DELAY_MAX_RES, DEF_DELAY_MAX_RES, &var_delay_max_res, MIN_DELAY_MAX_RES, MAX_DELAY_MAX_RES,
        VAR_INET_WINDOW, DEF_INET_WINDOW, &var_inet_windowsize, 0, 0,
+       VAR_SOCKMAP_MAX_REPLY, DEF_SOCKMAP_MAX_REPLY, &var_sockmap_max_reply, 1, 0,
        0,
     };
     static const CONFIG_LONG_TABLE long_defaults[] = {
@@ -986,6 +989,7 @@ void    mail_params_init()
     check_overlap();
     dict_db_cache_size = var_db_read_buf;
     dict_lmdb_map_size = var_lmdb_map_size;
+    dict_sockmap_max_reply = var_sockmap_max_reply;
     inet_windowsize = var_inet_windowsize;
     if (set_logwriter_create_perms(var_maillog_file_perms) < 0)
        msg_warn("ignoring bad permissions: %s = %s",
index 316688903aac9286a40d89335757e05eba8a2bfa..25392931962e81568c42f924ad178f094ad40d03 100644 (file)
@@ -4488,6 +4488,13 @@ extern int var_smtp_tlsrpt_skip_reused_hs;
 #define DEF_FULL_NAME_ENCODING_CHARSET "utf-8"
 extern char *var_full_name_encoding_charset;
 
+ /*
+  * Limit for the sockmap reply size
+  */
+#define VAR_SOCKMAP_MAX_REPLY  "socketmap_max_reply_size"
+#define DEF_SOCKMAP_MAX_REPLY  100000  /* reply size limit */
+extern int var_sockmap_max_reply;
+
 /* LICENSE
 /* .ad
 /* .fi
index b028754b0c515e4769e1574732ead5a45bbcac8c..dbd0f0afd86523f99e6f8bf777218002188ad502 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      "20250105"
+#define MAIL_RELEASE_DATE      "20250107"
 #define MAIL_VERSION_NUMBER    "3.10"
 
 #ifdef SNAPSHOT
index c6f9bdf8892386e588dcbf62047904ac48bab699..a280134d96a8a27d892d645b70f1901bc11f5d4f 100644 (file)
@@ -524,7 +524,7 @@ static int milter8_conf_error(MILTER8 *milter)
     if (strcasecmp(milter->def_action, "accept") == 0) {
        reply = 0;
     } else if (strcasecmp(milter->def_action, "quarantine") == 0) {
-       reply = "H";
+       reply = "Hdefault_action";
     } else {
        reply = "451 4.3.5 Server configuration problem - try again later";
     }
@@ -558,7 +558,7 @@ static int milter8_comm_error(MILTER8 *milter)
     } else if (strcasecmp(milter->def_action, "tempfail") == 0) {
        reply = "451 4.7.1 Service unavailable - try again later";
     } else if (strcasecmp(milter->def_action, "quarantine") == 0) {
-       reply = "H";
+       reply = "Hdefault_action";
     } else {
        msg_warn("milter %s: unrecognized default action: %s",
                 milter->m.name, milter->def_action);
@@ -1332,14 +1332,24 @@ static const char *milter8_event(MILTER8 *milter, int event,
             * accept, discard). We should not transition, either, otherwise
             * we get out of sync.
             */
-       case SMFIR_QUARANTINE:
-           /* XXX What to do with the "reason" text? */
-           if (milter8_read_data(milter, &data_size,
-                                 MILTER8_DATA_BUFFER, milter->buf,
-                                 MILTER8_DATA_END) != 0)
-               MILTER8_EVENT_BREAK(milter->def_reply);
-           milter8_def_reply(milter, "H");
-           continue;
+       case SMFIR_QUARANTINE:{
+               VSTRING *reply;
+               ssize_t saved_size = data_size;
+
+               if (milter8_read_data(milter, &data_size,
+                                     MILTER8_DATA_BUFFER, milter->buf,
+                                     MILTER8_DATA_END) != 0)
+                   MILTER8_EVENT_BREAK(milter->def_reply);
+               /* XXX This should be reported with a call-back. */
+               reply = vstring_alloc(100);
+               if (saved_size > 100)
+                   saved_size=100;
+               vstring_sprintf(reply, "H%.*s", (int) saved_size,
+                               STR(milter->buf));
+               milter8_def_reply(milter, STR(reply));
+               vstring_free(reply);
+               continue;
+           }
 
            /*
             * Decision: skip further events of this type.
index e0fb9450372bc84eb2ac06a92a6ab1959fdc6390..90c644387a600b510fbd3ea8fb051d4d7e3bd93f 100644 (file)
@@ -16,7 +16,7 @@
 /*     to maintain compatibility between successive versions.
 /*
 /*     Arguments (multiple alternatives are separated by "\fB|\fR"):
-/* .IP "\fB-a accept|tempfail|reject|discard|skip|\fIddd x.y.z text\fR"
+/* .IP "\fB-a accept|tempfail|reject|discard|skip|quarantine \fItext\fR|\fIddd x.y.z text\fR"
 /*     Specifies a non-default reply for the MTA command specified
 /*     with \fB-c\fR. The default is \fBtempfail\fR. The \fItext\fR
 /*     is repeated once, to produce multi-line reply text.
@@ -139,6 +139,8 @@ static const struct command_map command_map[] = {
     0, 0,
 };
 
+static char *quarantine_reason;
+
 static char *reply_code;
 static char *reply_dsn;
 static char *reply_message;
@@ -385,6 +387,11 @@ static sfsistat test_eom(SMFICTX *ctx)
            if (smfi_delrcpt(ctx, del_rcpt[count]) == MI_FAILURE)
                fprintf(stderr, "smfi_delrcpt `%s' failed\n", del_rcpt[count]);
     }
+    if (quarantine_reason) {
+       if (smfi_quarantine(ctx, quarantine_reason) == MI_FAILURE)
+           fprintf(stderr, "smfi_quarantine failed\n");
+       printf("quarantine '%s'\n", quarantine_reason);
+    }
     return (test_reply(ctx, test_eom_reply));
 }
 
@@ -445,7 +452,7 @@ static struct smfiDesc smfilter =
 {
     "test-milter",
     SMFI_VERSION,
-    SMFIF_ADDRCPT | SMFIF_DELRCPT | SMFIF_ADDHDRS | SMFIF_CHGHDRS | SMFIF_CHGBODY | SMFIF_CHGFROM,
+    SMFIF_ADDRCPT | SMFIF_DELRCPT | SMFIF_ADDHDRS | SMFIF_CHGHDRS | SMFIF_CHGBODY | SMFIF_CHGFROM | SMFIF_QUARANTINE,
     test_connect,
     test_helo,
     test_mail,
@@ -570,7 +577,10 @@ int     main(int argc, char **argv)
     while ((ch = getopt(argc, argv, "a:A:b:c:C:d:D:f:h:i:lm:M:n:N:p:rv")) > 0) {
        switch (ch) {
        case 'a':
-           action = optarg;
+           if (action != 0)
+               fprintf(stderr, "ignoring extra -a option\n");
+           else
+               action = optarg;
            break;
        case 'A':
            if (add_rcpt_count >= MAX_RCPT) {
@@ -758,6 +768,13 @@ int     main(int argc, char **argv)
            cp->reply[0] = SMFIS_ACCEPT;
        } else if (strcmp(action, "discard") == 0) {
            cp->reply[0] = SMFIS_DISCARD;
+       } else if (strncmp(action, "quarantine ", 11) == 0) {
+           if (strcmp(command, "eom") != 0) {
+               fprintf(stderr, "quarantine action requires '-c eom'\n");
+               exit(1);
+           }
+           quarantine_reason = action + 11;
+           quarantine_reason += strspn(quarantine_reason, " ");
 #ifdef SMFIS_SKIP
        } else if (strcmp(action, "skip") == 0) {
            cp->reply[0] = SMFIS_SKIP;
@@ -793,6 +810,8 @@ int     main(int argc, char **argv)
                printf("reply code %s dsn %s message %s\n",
                       reply_code, reply_dsn ? reply_dsn : "(null)",
                       reply_message ? reply_message : "(null)");
+           if (quarantine_reason)
+               printf("quarantine reason %s\n", quarantine_reason);
        }
     }
 #if SMFI_VERSION > 5
index 42a82893fabe96a76cfca022ba37c120d6630940..968bac458eead41756c8b8901aaf7f41c0876c99 100644 (file)
@@ -1787,12 +1787,16 @@ static const char *check_milter_reply(SMTPD_STATE *state, const char *reply)
 
     switch (reply[0]) {
     case 'H':
+       if (state->saved_flags & CLEANUP_FLAG_HOLD)
+           return (0);
        state->saved_flags |= CLEANUP_FLAG_HOLD;
        action = "milter-hold";
+       text = reply[1] ? reply + 1 : "milter triggers HOLD action";
        reply = 0;
-       text = "milter triggers HOLD action";
        break;
     case 'D':
+       if (state->saved_flags & CLEANUP_FLAG_DISCARD)
+           return (0);
        state->saved_flags |= CLEANUP_FLAG_DISCARD;
        action = "milter-discard";
        reply = 0;
@@ -5524,6 +5528,9 @@ static int milter_unknown_reply_override(SMTPD_STATE *state)
      * 
      * As a compromise, we will not override the Postfix SMTP server's specific
      * "5XX Unknown command" etc. reply.
+     * 
+     * We're not calling check_milter_reply() because that has unwanted side
+     * effects including logging and replying with 421.
      */
     if (state->milters != 0
        && (err = milter_unknown_event(state->milters,
@@ -5531,7 +5538,7 @@ static int milter_unknown_reply_override(SMTPD_STATE *state)
        if (err[0] == '4') {
            smtpd_chat_reply(state, "%s", err);
            return (1);
-       } else if (err[0] != '5') {
+       } else if (strchr("HDS5", err[0]) == 0) {
            msg_warn("unexpected SMFIC_UNKNOWN response: %s", err);
        }
     }
index becad1ae875d63570dd4dcde32f5b80e386b9dce..8c0d4e01453998b56e5c07d71d758dbcd57a05b6 100644 (file)
@@ -119,7 +119,7 @@ typedef struct {
   * Class variables.
   */
 static int dict_sockmap_timeout = DICT_SOCKMAP_DEF_TIMEOUT;
-static int dict_sockmap_max_reply = DICT_SOCKMAP_DEF_MAX_REPLY;
+int     dict_sockmap_max_reply = DICT_SOCKMAP_DEF_MAX_REPLY;
 static int dict_sockmap_max_idle = DICT_SOCKMAP_DEF_MAX_IDLE;
 static int dict_sockmap_max_ttl = DICT_SOCKMAP_DEF_MAX_TTL;
 
index b81212aa4d8ec2a3ffbcbe9ee8065ee9a08305b9..160dfca103cd22f5568bf74a8d349e091575248e 100644 (file)
@@ -22,6 +22,7 @@
 #define DICT_TYPE_SOCKMAP      "socketmap"
 
 extern DICT *dict_sockmap_open(const char *, int, int);
+extern int dict_sockmap_max_reply;
 
 /* LICENSE
 /* .ad
index eccd1ba62426c335a677343e5a72dd0285c89368..ea68ccd34b42123def43d2dda0d398597a19e322 100644 (file)
 /*     Google, Inc.
 /*     111 8th Avenue
 /*     New York, NY 10011, USA
+/*
+/*     Wietse Venema
+/*     porcupine.org
 /*--*/
 
 /* System library. */
 #include <sys_defs.h>
 #include <stdarg.h>
 #include <ctype.h>
+#include <errno.h>
 
 /* Utility library. */
 
@@ -367,12 +371,18 @@ const char *netstring_strerror(int err)
        case NETSTRING_ERR_EOF:
        return ("unexpected disconnect");
     case NETSTRING_ERR_TIME:
+       errno = ETIMEDOUT;
        return ("time limit exceeded");
     case NETSTRING_ERR_FORMAT:
+       errno = 0;
        return ("input format error");
     case NETSTRING_ERR_SIZE:
+#ifdef EMSGSIZE
+       errno = EMSGSIZE;
+#endif
        return ("input exceeds size limit");
     default:
+       errno = 0;
        return ("unknown netstring error");
     }
 }