]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.9-20240106
authorWietse Venema <wietse@porcupine.org>
Sat, 6 Jan 2024 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <ietf-dane@dukhovni.org>
Sun, 7 Jan 2024 01:19:16 +0000 (20:19 -0500)
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/html/postconf.5.html
postfix/html/smtpd.8.html
postfix/man/man5/postconf.5
postfix/man/man8/smtpd.8
postfix/proto/postconf.proto
postfix/proto/stop.double-history
postfix/src/global/mail_version.h
postfix/src/global/smtp_stream.c
postfix/src/smtpd/smtpd.c

index d6e357af423a8a140354e1696ca450ff4ffcb8e9..ec655022f9243a59226cca5926fa47126c646c91 100644 (file)
@@ -27661,8 +27661,8 @@ Apologies for any names omitted.
        and "normalize". The default setting "normalize" (and "yes")
        will accept bare newlines from local or remote SMTP clients,
        but if any DATA content line ends in <CR><LF>, require the
-       standard End-of-DATA form <CR><LF>.<CR><LF> and skip plus
-       log non-standard End-of-DATA forms. This may fail to receive
+       standard End-of-DATA form <CR><LF>.<CR><LF> and skip
+       non-standard End-of-DATA forms. This may fail to receive
        email from legitimate clients that send a mix of lines
        ending in <LF> and <CR><LF>. If such clients exist, they
        need to be excluded with smtpd_forbid_bare_newline_exclusions.
@@ -27672,3 +27672,16 @@ Apologies for any names omitted.
        Tooling: mantools/dehtml was breaking words in code examples,
        causing false spellchecker errors. File: mantools/dehtml,
        proto/stop.double-proto-html.
+
+20240105
+
+       Cleanup: don't spam the log with unexpected End-of-DATA
+       forms. Files: proto/postconf.proto, smtpd/smtpd.c,
+       RELEASE_NOTES.
+
+20240106
+
+       Bugfix: with smtpd_forbid_bare_newline enabled, do not
+       "strip" extra <CR> characters before <LF>. This avoids
+       ambiguity when a client sends extra <CR> characters as in
+       <CR><LF>.<CR><CR><LF>. File: global/smtp_stream.c.
index d5b101140ae000f9a5da30ea0a2e2dd155e744eb..5ead75a50ed5b08f9e7f7936bd8f4534cdbd9410 100644 (file)
@@ -32,8 +32,13 @@ Major changes with snapshot 20240102
 This updates Postfix fixes for SMTP smuggling attacks, For background,
 see https://www.postfix.org/smtp-smuggling.html
 
-This release improves configuration (see below) and logging (it now
-includes helo, mail, and rcpt information if available).
+This release improves configuration (see below) and logging for rejected
+input (it now includes helo, mail, and rcpt information if available).
+This will be back ported to Postfix 3.8.5, 3.7.10, 3.6.14, and 3.5.24.
+
+- Stricter enforcement of <CR><LF>.<CR><LF>; earlier versions ignored
+  extra <CR> before <LF>, causing ambiguity about what the client
+  actually sent.
 
 - The new setting "smtpd_forbid_bare_newline = normalize" allows
   bare newlines from local and remote SMTP clients that send bare
@@ -52,30 +57,29 @@ The recommended Postfix 3.9 settings (i.e. the defaults) are now:
 
     # Allow bare newlines from local and remote SMTP clients. If any DATA
     # content line ends in <CR><LF>, require the standard End-of-DATA form
-    # <CR><LF>.<CR><LF> and skip non-standard End-of-DATA forms with
-    # logging that looks like:
-    #
-    #    skipping unexpected <LF>.<LF> in DATA from...
-    #    skipping unexpected <LF>.<CR><LF> in DATA from...
+    # <CR><LF>.<CR><LF>, and skip other End-of-DATA forms.
     #
-    # This may fail to receive email from legitimate clients that send a
-    # mix of lines ending in <LF> and <CR><LF>. If such clients exist,
-    # they need to be excluded with smtpd_forbid_bare_newline_exclusions.
+    # This may cause problems for legitimate clients that send
+    # non-standard line endings such web applications, netcat, fax
+    # machines, or load balancer health checks. Such clients need to be
+    # excluded with smtpd_forbid_bare_newline_exclusions.
     #
     smtpd_forbid_bare_newline = normalize
     smtpd_forbid_bare_newline_exclusions = $mynetworks
 
 Alternative settings:
 
-    # Reject bare newlines from remote SMTP clients, but allow them from
-    # local non-standard clients such as netcat, fax machines, or load
-    # balancer health checks.
+    # Reject bare newlines from remote SMTP clients. Require the standard
+    # End-of-DATA form <CR><LF>.<CR><LF>.
+    #
+    # This will cause problems for legitimate clients that send
+    # non-standard line endings such web applications, netcat, fax
+    # machines, or load balancer health checks. Such clients need to be
+    # excluded with smtpd_forbid_bare_newline_exclusions.
     #
     smtpd_forbid_bare_newline = reject
     smtpd_forbid_bare_newline_exclusions = $mynetworks
 
-This will be back ported to Postfix 3.8.5, 3.7.10, 3.6.14, and 3.5.24.
-
 Incompatible changes with snapshot 20231221
 ===========================================
 
index 449e10ba33ecfe1e2ac83a0136f8e904fe97518b..225df2cbe7302eebaf3bb6fae11a0c921f50545e 100644 (file)
@@ -15924,10 +15924,10 @@ This feature is available in Postfix 2.0 and later.
 <DT><b><a name="smtpd_forbid_bare_newline">smtpd_forbid_bare_newline</a>
 (default: Postfix &ge; 3.9: normalize)</b></DT><DD>
 
-<p> Disconnect, reject, or normalize commands and email message
-content when a remote SMTP client sends lines ending in &lt;LF&gt;.
-Such line endings are commonly allowed with UNIX-based SMTP servers,
-but they violate the <a href="https://tools.ietf.org/html/rfc5321">RFC 5321</a> requirement that lines must end in
+<p> Reject or normalize commands and email message content when a
+remote SMTP client sends lines ending in &lt;LF&gt;. Such line
+endings are commonly allowed with UNIX-based SMTP servers, but they
+violate the <a href="https://tools.ietf.org/html/rfc5321">RFC 5321</a> requirement that lines must end in
 &lt;CR&gt;&lt;LF&gt;. <.p>
 
 <p> Specify one of the following values (case does not matter): </p>
@@ -15938,29 +15938,25 @@ but they violate the <a href="https://tools.ietf.org/html/rfc5321">RFC 5321</a>
 SMTP clients that send lines ending in the non-standard &lt;LF&gt;,
 and treat those line endings as if the client sent the standard
 &lt;CR&gt;&lt;LF&gt;. However, if an SMTP client sends any DATA
-content line ending in the standard &lt;CR&gt;&lt;LF&gt;, support
-only the standard End-of-DATA form
-&lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;, and skip non-standard
-End-of-DATA forms after logging them as:
-<blockquote>
-<pre>
-skipping unexpected &lt;LF&gt;.&lt;LF&gt; in DATA from...
-skipping unexpected &lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; in DATA from...
-</pre>
-</blockquote>
-This may fail to receive email from legitimate SMTP clients that
-send DATA content with a mix of line endings. Such clients need
-to be excluded with <a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a>. </dd>
+content line ending in the standard &lt;CR&gt;&lt;LF&gt;, require
+the standard End-of-DATA form &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;,
+and skip non-standard End-of-DATA forms. <br> This may fail to
+receive email from legitimate SMTP clients that send non-standard
+line endings such web applications, netcat, fax machines, or load
+balancer health checks. Such clients need to be excluded with
+<a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a>. </dd>
 
 <dt> <b>yes</b> </dt> <dd> Alias for "normalize". </dd>
 
 <dt> <b>reject</b> </dt> <dd> When an SMTP client sends a command
 or message content line ending in &lt;LF&gt;, log a "bare &lt;LF&gt;
-received" error, and reject the command or message content with
-<a href="postconf.5.html#smtpd_forbid_bare_newline_reject_code">smtpd_forbid_bare_newline_reject_code</a>. This will fail to receive
-email from legitimate SMTP clients that send command or message
-content with lines ending in &lt;LF&gt;. Such clients need to be
-excluded with <a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a>.  </dd>
+received" error, reject the command or message content with
+<a href="postconf.5.html#smtpd_forbid_bare_newline_reject_code">smtpd_forbid_bare_newline_reject_code</a>, and require the standard
+End-of-DATA form &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;. <br>
+This will fail to receive email from legitimate SMTP clients that
+send non-standard line endings such web applications, netcat, fax
+machines, or load balancer health checks. Such clients need to be
+excluded with <a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a>. </dd>
 
 <dt> <b>no</b> </dt> <dd> Treat all lines ending in &lt;LF&gt;
 as if the client sent &lt;CR&gt;&lt;LF&gt;. This option is fully
@@ -15975,12 +15971,14 @@ href="https://www.postfix.org/smtp-smuggling.html"> SMTP smuggling</a>.
 
 <blockquote>
 <pre>
-# Allow bare newlines from local and remote SMTP clients. If any
-# DATA content line ends in &lt;CR&gt;&lt;LF&gt;, require the standard End-of-DATA
-# form &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; and skip plus log non-standard forms.
-# This may fail to receive email from legitimate clients that send a
-# mix of lines ending in &lt;LF&gt; and &lt;CR&gt;&lt;LF&gt;. If such clients exist,
-# they need to be excluded with <a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a>.
+# Allow bare newlines from local and remote SMTP clients. If any DATA
+# content line ends in &lt;CR&gt;&lt;LF&gt;, require the standard End-of-DATA form
+# &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; and skip other End-of-DATA forms.
+#
+# This may cause problems for legitimate clients that send
+# non-standard line endings such as web applications, netcat, fax
+# machines, or load balancer health checks. Such clients need to be
+# excluded with <a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a>.
 #
 <a href="postconf.5.html#smtpd_forbid_bare_newline">smtpd_forbid_bare_newline</a> = normalize
 <a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a> = $<a href="postconf.5.html#mynetworks">mynetworks</a>
@@ -15989,9 +15987,13 @@ href="https://www.postfix.org/smtp-smuggling.html"> SMTP smuggling</a>.
 
 <blockquote>
 <pre>
-# Reject bare newlines from remote SMTP clients, but allow them from
-# local non-standard clients such as netcat, fax machines, or load
-# balancer health checks.
+# Reject bare newlines from remote SMTP clients. Require the standard
+# End-of-DATA form &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;.
+#
+# This will cause problems for legitimate clients that send
+# non-standard line endings such as web applications, netcat, fax
+# machines, or load balancer health checks. Such clients need to be
+# excluded with <a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a>.
 #
 <a href="postconf.5.html#smtpd_forbid_bare_newline">smtpd_forbid_bare_newline</a> = reject
 <a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a> = $<a href="postconf.5.html#mynetworks">mynetworks</a>
index c48c494c3a3ee4dfed5fb7037321a120eca03b4d..cfeeed9829d08be842be09d2c73dadcbc6b50f2e 100644 (file)
@@ -998,8 +998,8 @@ SMTPD(8)                                                              SMTPD(8)
        Available in Postfix 3.9, 3.8.4, 3.7.9, 3.6.13, 3.5.23 and later:
 
        <b><a href="postconf.5.html#smtpd_forbid_bare_newline">smtpd_forbid_bare_newline</a> (Postfix</b> &gt;<b>= 3.9: normalize)</b>
-              Disconnect, reject, or normalize commands and email message con-
-              tent when a remote SMTP client sends lines ending in &lt;LF&gt;.
+              Reject  or  normalize  commands and email message content when a
+              remote SMTP client sends lines ending in &lt;LF&gt;.
 
        <b><a href="postconf.5.html#smtpd_forbid_bare_newline_exclusions">smtpd_forbid_bare_newline_exclusions</a> ($<a href="postconf.5.html#mynetworks">mynetworks</a>)</b>
               Exclude the  specified  clients  from  <a href="postconf.5.html#smtpd_forbid_bare_newline">smtpd_forbid_bare_newline</a>
index 6d7d45177f74d9b9b3d1287b5a2fde81ea2bc366..0de744d6bf5dd7bb959118dcef50ae17ba3a5e78 100644 (file)
@@ -11004,10 +11004,10 @@ parameter $name expansion.
 .PP
 This feature is available in Postfix 2.0 and later.
 .SH smtpd_forbid_bare_newline (default: Postfix >= 3.9: normalize)
-Disconnect, reject, or normalize commands and email message
-content when a remote SMTP client sends lines ending in <LF>.
-Such line endings are commonly allowed with UNIX\-based SMTP servers,
-but they violate the RFC 5321 requirement that lines must end in
+Reject or normalize commands and email message content when a
+remote SMTP client sends lines ending in <LF>. Such line
+endings are commonly allowed with UNIX\-based SMTP servers, but they
+violate the RFC 5321 requirement that lines must end in
 <CR><LF>. <.p>
 .PP
 Specify one of the following values (case does not matter):
@@ -11016,24 +11016,15 @@ Maintain compatibility with legacy
 SMTP clients that send lines ending in the non\-standard <LF>,
 and treat those line endings as if the client sent the standard
 <CR><LF>. However, if an SMTP client sends any DATA
-content line ending in the standard <CR><LF>, support
-only the standard End\-of\-DATA form
-<CR><LF>.<CR><LF>, and skip non\-standard
-End\-of\-DATA forms after logging them as:
-.sp
-.in +4
-.nf
-.na
-.ft C
-skipping unexpected <LF>.<LF> in DATA from...
-skipping unexpected <LF>.<CR><LF> in DATA from...
-.fi
-.ad
-.ft R
-.in -4
-This may fail to receive email from legitimate SMTP clients that
-send DATA content with a mix of line endings. Such clients need
-to be excluded with smtpd_forbid_bare_newline_exclusions.
+content line ending in the standard <CR><LF>, require
+the standard End\-of\-DATA form <CR><LF>.<CR><LF>,
+and skip non\-standard End\-of\-DATA forms.
+.br
+This may fail to
+receive email from legitimate SMTP clients that send non\-standard
+line endings such web applications, netcat, fax machines, or load
+balancer health checks. Such clients need to be excluded with
+smtpd_forbid_bare_newline_exclusions.
 .br
 .IP "\fByes\fR"
 Alias for "normalize".
@@ -11041,10 +11032,13 @@ Alias for "normalize".
 .IP "\fBreject\fR"
 When an SMTP client sends a command
 or message content line ending in <LF>, log a "bare <LF>
-received" error, and reject the command or message content with
-smtpd_forbid_bare_newline_reject_code. This will fail to receive
-email from legitimate SMTP clients that send command or message
-content with lines ending in <LF>. Such clients need to be
+received" error, reject the command or message content with
+smtpd_forbid_bare_newline_reject_code, and require the standard
+End\-of\-DATA form <CR><LF>.<CR><LF>.
+.br
+This will fail to receive email from legitimate SMTP clients that
+send non\-standard line endings such web applications, netcat, fax
+machines, or load balancer health checks. Such clients need to be
 excluded with smtpd_forbid_bare_newline_exclusions.
 .br
 .IP "\fBno\fR"
@@ -11061,12 +11055,14 @@ Examples:
 .nf
 .na
 .ft C
-# Allow bare newlines from local and remote SMTP clients. If any
-# DATA content line ends in <CR><LF>, require the standard End\-of\-DATA
-# form <CR><LF>.<CR><LF> and skip plus log non\-standard forms.
-# This may fail to receive email from legitimate clients that send a
-# mix of lines ending in <LF> and <CR><LF>. If such clients exist,
-# they need to be excluded with smtpd_forbid_bare_newline_exclusions.
+# Allow bare newlines from local and remote SMTP clients. If any DATA
+# content line ends in <CR><LF>, require the standard End\-of\-DATA form
+# <CR><LF>.<CR><LF> and skip other End\-of\-DATA forms.
+#
+# This may cause problems for legitimate clients that send
+# non\-standard line endings such as web applications, netcat, fax
+# machines, or load balancer health checks. Such clients need to be
+# excluded with smtpd_forbid_bare_newline_exclusions.
 #
 smtpd_forbid_bare_newline = normalize
 smtpd_forbid_bare_newline_exclusions = $mynetworks
@@ -11079,9 +11075,13 @@ smtpd_forbid_bare_newline_exclusions = $mynetworks
 .nf
 .na
 .ft C
-# Reject bare newlines from remote SMTP clients, but allow them from
-# local non\-standard clients such as netcat, fax machines, or load
-# balancer health checks.
+# Reject bare newlines from remote SMTP clients. Require the standard
+# End\-of\-DATA form <CR><LF>.<CR><LF>.
+#
+# This will cause problems for legitimate clients that send
+# non\-standard line endings such as web applications, netcat, fax
+# machines, or load balancer health checks. Such clients need to be
+# excluded with smtpd_forbid_bare_newline_exclusions.
 #
 smtpd_forbid_bare_newline = reject
 smtpd_forbid_bare_newline_exclusions = $mynetworks
index 25b1f48a4b85e49a883a712a464c99be6f2e206d..b068d813386bc77aa7c6b63d254e072f51bcf5d3 100644 (file)
@@ -871,8 +871,8 @@ command pipelining constraints.
 .PP
 Available in Postfix 3.9, 3.8.4, 3.7.9, 3.6.13, 3.5.23 and later:
 .IP "\fBsmtpd_forbid_bare_newline (Postfix >= 3.9: normalize)\fR"
-Disconnect, reject, or normalize commands and email message
-content when a remote SMTP client sends lines ending in <LF>.
+Reject or normalize commands and email message content when a
+remote SMTP client sends lines ending in <LF>.
 .IP "\fBsmtpd_forbid_bare_newline_exclusions ($mynetworks)\fR"
 Exclude the specified clients from smtpd_forbid_bare_newline
 enforcement.
index f0b835099ab1d9926eb98790e89329aa540ddada..bbc3c77ba0aa29fd4b1144f81321521058eb6668 100644 (file)
@@ -19068,10 +19068,10 @@ MinProtocol = TLSv1
 
 %PARAM smtpd_forbid_bare_newline Postfix &ge; 3.9: normalize
 
-<p> Disconnect, reject, or normalize commands and email message
-content when a remote SMTP client sends lines ending in &lt;LF&gt;.
-Such line endings are commonly allowed with UNIX-based SMTP servers,
-but they violate the RFC 5321 requirement that lines must end in
+<p> Reject or normalize commands and email message content when a
+remote SMTP client sends lines ending in &lt;LF&gt;. Such line
+endings are commonly allowed with UNIX-based SMTP servers, but they
+violate the RFC 5321 requirement that lines must end in
 &lt;CR&gt;&lt;LF&gt;. <.p>
 
 <p> Specify one of the following values (case does not matter): </p>
@@ -19082,29 +19082,25 @@ but they violate the RFC 5321 requirement that lines must end in
 SMTP clients that send lines ending in the non-standard &lt;LF&gt;,
 and treat those line endings as if the client sent the standard
 &lt;CR&gt;&lt;LF&gt;. However, if an SMTP client sends any DATA
-content line ending in the standard &lt;CR&gt;&lt;LF&gt;, support
-only the standard End-of-DATA form
-&lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;, and skip non-standard
-End-of-DATA forms after logging them as:
-<blockquote>
-<pre>
-skipping unexpected &lt;LF&gt;.&lt;LF&gt; in DATA from...
-skipping unexpected &lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; in DATA from...
-</pre>
-</blockquote>
-This may fail to receive email from legitimate SMTP clients that
-send DATA content with a mix of line endings. Such clients need
-to be excluded with smtpd_forbid_bare_newline_exclusions. </dd>
+content line ending in the standard &lt;CR&gt;&lt;LF&gt;, require
+the standard End-of-DATA form &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;,
+and skip non-standard End-of-DATA forms. <br> This may fail to
+receive email from legitimate SMTP clients that send non-standard
+line endings such web applications, netcat, fax machines, or load
+balancer health checks. Such clients need to be excluded with
+smtpd_forbid_bare_newline_exclusions. </dd>
 
 <dt> <b>yes</b> </dt> <dd> Alias for "normalize". </dd>
 
 <dt> <b>reject</b> </dt> <dd> When an SMTP client sends a command
 or message content line ending in &lt;LF&gt;, log a "bare &lt;LF&gt;
-received" error, and reject the command or message content with
-smtpd_forbid_bare_newline_reject_code. This will fail to receive
-email from legitimate SMTP clients that send command or message
-content with lines ending in &lt;LF&gt;. Such clients need to be
-excluded with smtpd_forbid_bare_newline_exclusions.  </dd>
+received" error, reject the command or message content with
+smtpd_forbid_bare_newline_reject_code, and require the standard
+End-of-DATA form &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;. <br>
+This will fail to receive email from legitimate SMTP clients that
+send non-standard line endings such web applications, netcat, fax
+machines, or load balancer health checks. Such clients need to be
+excluded with smtpd_forbid_bare_newline_exclusions. </dd>
 
 <dt> <b>no</b> </dt> <dd> Treat all lines ending in &lt;LF&gt;
 as if the client sent &lt;CR&gt;&lt;LF&gt;. This option is fully
@@ -19119,12 +19115,14 @@ href="https://www.postfix.org/smtp-smuggling.html"> SMTP smuggling</a>.
 
 <blockquote>
 <pre>
-# Allow bare newlines from local and remote SMTP clients. If any
-# DATA content line ends in &lt;CR&gt;&lt;LF&gt;, require the standard End-of-DATA
-# form &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; and skip plus log non-standard forms.
-# This may fail to receive email from legitimate clients that send a
-# mix of lines ending in &lt;LF&gt; and &lt;CR&gt;&lt;LF&gt;. If such clients exist,
-# they need to be excluded with smtpd_forbid_bare_newline_exclusions.
+# Allow bare newlines from local and remote SMTP clients. If any DATA
+# content line ends in &lt;CR&gt;&lt;LF&gt;, require the standard End-of-DATA form
+# &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt; and skip other End-of-DATA forms.
+#
+# This may cause problems for legitimate clients that send
+# non-standard line endings such as web applications, netcat, fax
+# machines, or load balancer health checks. Such clients need to be
+# excluded with smtpd_forbid_bare_newline_exclusions.
 #
 smtpd_forbid_bare_newline = normalize
 smtpd_forbid_bare_newline_exclusions = $mynetworks
@@ -19133,9 +19131,13 @@ smtpd_forbid_bare_newline_exclusions = $mynetworks
 
 <blockquote>
 <pre>
-# Reject bare newlines from remote SMTP clients, but allow them from
-# local non-standard clients such as netcat, fax machines, or load
-# balancer health checks.
+# Reject bare newlines from remote SMTP clients. Require the standard
+# End-of-DATA form &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;.
+#
+# This will cause problems for legitimate clients that send
+# non-standard line endings such as web applications, netcat, fax
+# machines, or load balancer health checks. Such clients need to be
+# excluded with smtpd_forbid_bare_newline_exclusions.
 #
 smtpd_forbid_bare_newline = reject
 smtpd_forbid_bare_newline_exclusions = $mynetworks
index 7b32c1fda8009182b52e26c704c64aa61b60aedd..aaca3c97653d5623918a7a4d87da46758ac17b9e 100644 (file)
@@ -88,3 +88,5 @@ proto  proto aliases proto virtual proto ADDRESS_REWRITING_README html
  smtpd smtpd c global smtp_stream hc global cleanup_user h 
  smtpd smtpd c smtpd smtpd_check c 
  keep reading message content after an unexpected LF LF 
+ forms Files proto postconf proto smtpd smtpd c 
+ CR LF CR CR LF File global smtp_stream c 
index b2f0c79994c93a2496ac4843b6c2db81cff80958..d112501807d274110fc9d233617b37cd2e837c17 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      "20240104"
+#define MAIL_RELEASE_DATE      "20240106"
 #define MAIL_VERSION_NUMBER    "3.9"
 
 #ifdef SNAPSHOT
index b22d245a1ecd76145e9e3446897f043ce36a96dd..769b9c08178702f5d782a8c1861e01de0a2215d9 100644 (file)
@@ -431,11 +431,15 @@ int     smtp_get_noexcept(VSTRING *vp, VSTREAM *stream, ssize_t bound, int flags
         */
     case '\n':
        vstring_truncate(vp, VSTRING_LEN(vp) - 1);
-       if (smtp_forbid_bare_lf
-           && (VSTRING_LEN(vp) == 0 || vstring_end(vp)[-1] != '\r'))
-           smtp_seen_bare_lf = smtp_forbid_bare_lf;
-       while (VSTRING_LEN(vp) > 0 && vstring_end(vp)[-1] == '\r')
-           vstring_truncate(vp, VSTRING_LEN(vp) - 1);
+       if (smtp_forbid_bare_lf) {
+           if (VSTRING_LEN(vp) == 0 || vstring_end(vp)[-1] != '\r')
+               smtp_seen_bare_lf = smtp_forbid_bare_lf;
+           else
+               vstring_truncate(vp, VSTRING_LEN(vp) - 1);
+       } else {
+           while (VSTRING_LEN(vp) > 0 && vstring_end(vp)[-1] == '\r')
+               vstring_truncate(vp, VSTRING_LEN(vp) - 1);
+       }
        VSTRING_TERMINATE(vp);
        /* FALLTRHOUGH */
 
index 1fe3b003cfc57981ab8543236556810e2a634156..86c7c84d612b9b4a060a104dc77a089b552467ed 100644 (file)
 /* .PP
 /*     Available in Postfix 3.9, 3.8.4, 3.7.9, 3.6.13, 3.5.23 and later:
 /* .IP "\fBsmtpd_forbid_bare_newline (Postfix >= 3.9: normalize)\fR"
-/*     Disconnect, reject, or normalize commands and email message
-/*     content when a remote SMTP client sends lines ending in <LF>.
+/*     Reject or normalize commands and email message content when a
+/*     remote SMTP client sends lines ending in <LF>.
 /* .IP "\fBsmtpd_forbid_bare_newline_exclusions ($mynetworks)\fR"
 /*     Exclude the specified clients from smtpd_forbid_bare_newline
 /*     enforcement.
@@ -3623,7 +3623,7 @@ static void receive_data_message(SMTPD_STATE *state,
     int     prev_rec_type;
     int     first = 1;
     int     prev_seen_bare_lf = 0;
-    int     expect_crlf_dot = 0;
+    int     expect_crlf_dot = IS_BARE_LF_REJECT(smtp_forbid_bare_lf);
 
     /*
      * If deadlines are enabled, increase the time budget as message content
@@ -3667,14 +3667,9 @@ static void receive_data_message(SMTPD_STATE *state,
                out_record(out_stream, REC_TYPE_NORM, "", 0);
        }
        if (prev_rec_type != REC_TYPE_CONT && *start == '.') {
-           if (len == 1 && prev_seen_bare_lf && expect_crlf_dot) {
-               if (IS_BARE_LF_NORMALIZE(prev_seen_bare_lf))
-                   msg_info("%s: skipping unexpected <LF>.%s in DATA from %s",
-                            state->queue_id ? state->queue_id : "NOQUEUE",
-                            smtp_seen_bare_lf ? "<LF>" : "<CR><LF>",
-                            state->namaddr);
+           if (len == 1 && expect_crlf_dot
+               && (smtp_seen_bare_lf || prev_seen_bare_lf))
                continue;
-           }
            if (proxy == 0 ? (++start, --len) == 0 : len == 1)
                break;
        }