]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.9-20111012
authorWietse Venema <wietse@porcupine.org>
Wed, 12 Oct 2011 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:37:30 +0000 (06:37 +0000)
14 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/WISHLIST
postfix/html/mailq.1.html
postfix/html/newaliases.1.html
postfix/html/postconf.5.html
postfix/html/sendmail.1.html
postfix/man/man1/sendmail.1
postfix/man/man5/postconf.5
postfix/proto/postconf.proto
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/sendmail/Makefile.in
postfix/src/sendmail/sendmail.c

index 82b8f430ef88c4abb0e732703590466c1a2a8e56..d58dfe5812c2fc1f0f7e50998e32aced4beeb660 100644 (file)
@@ -16958,7 +16958,7 @@ Apologies for any names omitted.
        upgrade-configuration" append "inet_protocols = ipv4" to
        main.cf when no explicit setting is present.  This compatibility
        workaround will be phased out in a future release.  Files:
-       global/mail_params.h, conf/post-install, proto/postconf.proto.
+       util/sys_defs.h, conf/post-install, proto/postconf.proto.
 
        Incompatibility: the default smtp_address_preference value
        is now "any" instead of "ipv6", meaning choose randomly
@@ -16988,3 +16988,19 @@ Apologies for any names omitted.
        responses from a before-queue content filter as text with
        bare <LF> instead of <CR><LF>.  Found during code maintenance.
        File: smtpd/smtpd_proxy.c.
+
+20111011
+
+       Cleanup: for consistency with the SMTP standard, the
+       smtp_line_length_limit default value was increased from 990
+       characters to 998 (i.e. 1000 characters including <CR><LF>).
+       File: global/mail_params.h, proto/postconf.proto.
+
+       Cleanup: the Postfix sendmail command now always transforms
+       all input lines ending in <CR><LF> into UNIX format (lines
+       ending in <LF>).  This simplifies integration with third-party
+       mail generating applications. Specify "sendmail_fix_line_endings
+       = strict" to restore historical Postfix behavior (i.e. convert
+       all input lines ending in <CR><LF> only if the first input
+       line ends in <CR><LF>).  Files: sendmail/sendmail.c,
+       global/mail_params.h, proto/postconf.proto.
index 8079b37525c4fdaf91c8a72925a296ac9f12af47..a021021b38caa050e53f33de5355b02356afda47 100644 (file)
@@ -14,6 +14,21 @@ specifies the release date of a stable release or snapshot release.
 If you upgrade from Postfix 2.7 or earlier, read RELEASE_NOTES-2.8
 before proceeding.
 
+Incompatible changes with snapshot 201110XX
+===========================================
+
+For consistency with the SMTP standard, the smtp_line_length_limit
+default value was increased from 990 characters to 998 (i.e. 1000
+characters including <CR><LF>). Specify "smtp_line_length_limit =
+990" to restore historical Postfix behavior.
+
+To simplify integration with third-party applications, the Postfix
+sendmail command now always transforms all input lines ending in
+<CR><LF> into UNIX format (lines ending in <LF>). Specify
+"sendmail_fix_line_endings = strict" to restore historical Postfix
+behavior (i.e. convert all input lines ending in <CR><LF> only if
+the first line ends in <CR><LF>).
+
 Incompatible changes with snapshot 20110918
 ===========================================
 
index 9a0ca54ef667be767a21a5b868a4ccbc044916da..6e5dc38fd23c71cf1b47c12d0dd1c4c3db11a95e 100644 (file)
@@ -6,9 +6,26 @@ Wish list:
 
        Things to do after the stable release:
 
+       TLS_README has the priorities reversed. The section about
+       SMTP client settings begins with an exposition about client
+       certificates, which almost no-one needs. Instead, the text
+       should first explain how to turn on opportunistic TLS. After
+       that, it can discuss the gory details of higher security
+       levels for the few people who need it.
+
+       Investigate viability of memcached for applications
+       that require performance for low-security operations
+       such as sharing the postscreen cache.
+
        Investigate viability of Sendmail socket maps (the moral
        equivalent of tcp_table(5)), and dns maps.
 
+       Check if FILTER_README has the "postsuper -r" workaround
+
+       Bounces without <> in the plaintext section. Apparently,
+       some software renders the text as HTML (and therefore 
+       does not render addresses and other text inside <> ).
+
        Make the rules for how to use close-on-exec more explicit.
 
        Provide separate timeout control for dict_proxy client,
index c4efe7302a1e96ad3e295cbae143231adcc2ec23..b33a05965110cd827353a2ee80fa3f854a885ade 100644 (file)
@@ -321,6 +321,12 @@ SENDMAIL(1)                                                        SENDMAIL(1)
        summary.  See <a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including exam-
        ples.
 
+<b>COMPATIBILITY CONTROLS</b>
+       <b>sendmail_fix_line_endings (always)</b>
+              Controls how the Postfix sendmail command  converts
+              email  message line endings from &lt;CR&gt;&lt;LF&gt; into UNIX
+              format (&lt;LF&gt;).
+
 <b>TROUBLE SHOOTING CONTROLS</b>
        The <a href="DEBUG_README.html">DEBUG_README</a> file gives examples  of  how  to  trouble
        shoot a Postfix system.
@@ -343,14 +349,14 @@ SENDMAIL(1)                                                        SENDMAIL(1)
 <b>ACCESS CONTROLS</b>
        Available in Postfix version 2.2 and later:
 
-       <b><a href="postconf.5.html#authorized_flush_users">authorized_flush_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_flush_users">authorized_flush_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List  of  users  who  are  authorized  to flush the
               queue.
 
-       <b><a href="postconf.5.html#authorized_mailq_users">authorized_mailq_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_mailq_users">authorized_mailq_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List of users who are authorized to view the queue.
 
-       <b><a href="postconf.5.html#authorized_submit_users">authorized_submit_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_submit_users">authorized_submit_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List  of  users  who  are authorized to submit mail
               with the <a href="sendmail.1.html"><b>sendmail</b>(1)</a> command (and with  the  privi-
               leged <a href="postdrop.1.html"><b>postdrop</b>(1)</a> helper command).
index c4efe7302a1e96ad3e295cbae143231adcc2ec23..b33a05965110cd827353a2ee80fa3f854a885ade 100644 (file)
@@ -321,6 +321,12 @@ SENDMAIL(1)                                                        SENDMAIL(1)
        summary.  See <a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including exam-
        ples.
 
+<b>COMPATIBILITY CONTROLS</b>
+       <b>sendmail_fix_line_endings (always)</b>
+              Controls how the Postfix sendmail command  converts
+              email  message line endings from &lt;CR&gt;&lt;LF&gt; into UNIX
+              format (&lt;LF&gt;).
+
 <b>TROUBLE SHOOTING CONTROLS</b>
        The <a href="DEBUG_README.html">DEBUG_README</a> file gives examples  of  how  to  trouble
        shoot a Postfix system.
@@ -343,14 +349,14 @@ SENDMAIL(1)                                                        SENDMAIL(1)
 <b>ACCESS CONTROLS</b>
        Available in Postfix version 2.2 and later:
 
-       <b><a href="postconf.5.html#authorized_flush_users">authorized_flush_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_flush_users">authorized_flush_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List  of  users  who  are  authorized  to flush the
               queue.
 
-       <b><a href="postconf.5.html#authorized_mailq_users">authorized_mailq_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_mailq_users">authorized_mailq_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List of users who are authorized to view the queue.
 
-       <b><a href="postconf.5.html#authorized_submit_users">authorized_submit_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_submit_users">authorized_submit_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List  of  users  who  are authorized to submit mail
               with the <a href="sendmail.1.html"><b>sendmail</b>(1)</a> command (and with  the  privi-
               leged <a href="postdrop.1.html"><b>postdrop</b>(1)</a> helper command).
index 8bed75e0d50919727fbd05a2feab0987f4684aa1..5cc67421815c81b11b64272a05e6369b04cd83b0 100644 (file)
@@ -8912,6 +8912,35 @@ This feature is available in Postfix 2.3 and later.
 </p>
 
 
+</DD>
+
+<DT><b><a name="sendmail_fix_line_endings">sendmail_fix_line_endings</a>
+(default: always)</b></DT><DD>
+
+<p> Controls how the Postfix sendmail command converts email message
+line endings from &lt;CR&gt;&lt;LF&gt; into UNIX format (&lt;LF&gt;).
+</p>
+
+<dl>
+
+<dt> <b>always</b> </dt> <dd> Always convert message lines ending
+in &lt;CR&gt;&lt;LF&gt;. This setting is the default with Postfix
+2.9 and later. </dd>
+
+<dt> <b>strict</b> </dt> <dd> Convert message lines ending in
+&lt;CR&gt;&lt;LF&gt; only if the first input line ends in
+&lt;CR&gt;&lt;LF&gt;. This setting is backwards-compatible with
+Postfix 2.8 and earlier. </dd>
+
+<dt> <b>never</b> </dt> <dd> Never convert message lines ending in
+&lt;CR&gt;&lt;LF&gt;. This setting exists for completeness only.
+</dd>
+
+</dl>
+
+<p> This feature is available in Postfix 2.9 and later. </p>
+
+
 </DD>
 
 <DT><b><a name="sendmail_path">sendmail_path</a>
@@ -9615,18 +9644,21 @@ This feature is available in Postfix 2.1 and later.
 </DD>
 
 <DT><b><a name="smtp_line_length_limit">smtp_line_length_limit</a>
-(default: 990)</b></DT><DD>
+(default: 998)</b></DT><DD>
 
 <p>
 The maximal length of message header and body lines that Postfix
-will send via SMTP.  Longer lines are broken by inserting
-"&lt;CR&gt;&lt;LF&gt;&lt;SPACE&gt;". This minimizes the damage to
-MIME formatted mail.
+will send via SMTP. This limit does not include the &lt;CR&gt;&lt;LF&gt;
+at the end of each line.  Longer lines are broken by inserting
+"&lt;CR&gt;&lt;LF&gt;&lt;SPACE&gt;", to minimize the damage to MIME
+formatted mail.
 </p>
 
 <p>
-By default, the line length is limited to 990 characters, because
-some server implementations cannot receive mail with long lines.
+The Postfix limit of 998 characters not including &lt;CR&gt;&lt;LF&gt;
+is consistent with the SMTP limit of 1000 characters including
+&lt;CR&gt;&lt;LF&gt;.  The Postfix limit was 990 with Postfix 2.8
+and earlier.
 </p>
 
 
index c4efe7302a1e96ad3e295cbae143231adcc2ec23..b33a05965110cd827353a2ee80fa3f854a885ade 100644 (file)
@@ -321,6 +321,12 @@ SENDMAIL(1)                                                        SENDMAIL(1)
        summary.  See <a href="postconf.5.html"><b>postconf</b>(5)</a> for more details including exam-
        ples.
 
+<b>COMPATIBILITY CONTROLS</b>
+       <b>sendmail_fix_line_endings (always)</b>
+              Controls how the Postfix sendmail command  converts
+              email  message line endings from &lt;CR&gt;&lt;LF&gt; into UNIX
+              format (&lt;LF&gt;).
+
 <b>TROUBLE SHOOTING CONTROLS</b>
        The <a href="DEBUG_README.html">DEBUG_README</a> file gives examples  of  how  to  trouble
        shoot a Postfix system.
@@ -343,14 +349,14 @@ SENDMAIL(1)                                                        SENDMAIL(1)
 <b>ACCESS CONTROLS</b>
        Available in Postfix version 2.2 and later:
 
-       <b><a href="postconf.5.html#authorized_flush_users">authorized_flush_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_flush_users">authorized_flush_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List  of  users  who  are  authorized  to flush the
               queue.
 
-       <b><a href="postconf.5.html#authorized_mailq_users">authorized_mailq_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_mailq_users">authorized_mailq_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List of users who are authorized to view the queue.
 
-       <b><a href="postconf.5.html#authorized_submit_users">authorized_submit_users</a> (static:anyone)</b>
+       <b><a href="postconf.5.html#authorized_submit_users">authorized_submit_users</a> (<a href="DATABASE_README.html#types">static</a>:anyone)</b>
               List  of  users  who  are authorized to submit mail
               with the <a href="sendmail.1.html"><b>sendmail</b>(1)</a> command (and with  the  privi-
               leged <a href="postdrop.1.html"><b>postdrop</b>(1)</a> helper command).
index b7abb31a04cb9118516a51e653670efd0c5cc7ec..fba4317b91a06fe53ed87cf622782082bed9a8d5 100644 (file)
@@ -274,6 +274,14 @@ The following \fBmain.cf\fR parameters are especially relevant to
 this program.
 The text below provides only a parameter summary. See
 \fBpostconf\fR(5) for more details including examples.
+.SH "COMPATIBILITY CONTROLS"
+.na
+.nf
+.ad
+.fi
+.IP "\fBsendmail_fix_line_endings (always)\fR"
+Controls how the Postfix sendmail command converts email message
+line endings from <CR><LF> into UNIX format (<LF>).
 .SH "TROUBLE SHOOTING CONTROLS"
 .na
 .nf
index 98f6fd6bceab288610838f69b2a70d055b08e979..a81c2b0e0099ece48f42a62e540e59854d6f3b8a 100644 (file)
@@ -5194,6 +5194,23 @@ For safety reasons, this feature does not allow $number
 substitutions in regular expression maps.
 .PP
 This feature is available in Postfix 2.3 and later.
+.SH sendmail_fix_line_endings (default: always)
+Controls how the Postfix sendmail command converts email message
+line endings from <CR><LF> into UNIX format (<LF>).
+.IP "\fBalways\fR"
+Always convert message lines ending
+in <CR><LF>. This setting is the default with Postfix
+2.9 and later.
+.IP "\fBstrict\fR"
+Convert message lines ending in
+<CR><LF> only if the first input line ends in
+<CR><LF>. This setting is backwards-compatible with
+Postfix 2.8 and earlier.
+.IP "\fBnever\fR"
+Never convert message lines ending in
+<CR><LF>. This setting exists for completeness only.
+.PP
+This feature is available in Postfix 2.9 and later.
 .SH sendmail_path (default: see "postconf -d" output)
 A Sendmail compatibility feature that specifies the location of
 the Postfix \fBsendmail\fR(1) command. This command can be used to
@@ -5599,14 +5616,17 @@ mechanism).
 Use the native service for hosts not found in the DNS.
 .PP
 This feature is available in Postfix 2.1 and later.
-.SH smtp_line_length_limit (default: 990)
+.SH smtp_line_length_limit (default: 998)
 The maximal length of message header and body lines that Postfix
-will send via SMTP.  Longer lines are broken by inserting
-"<CR><LF><SPACE>". This minimizes the damage to
-MIME formatted mail.
-.PP
-By default, the line length is limited to 990 characters, because
-some server implementations cannot receive mail with long lines.
+will send via SMTP. This limit does not include the <CR><LF>
+at the end of each line.  Longer lines are broken by inserting
+"<CR><LF><SPACE>", to minimize the damage to MIME
+formatted mail.
+.PP
+The Postfix limit of 998 characters not including <CR><LF>
+is consistent with the SMTP limit of 1000 characters including
+<CR><LF>.  The Postfix limit was 990 with Postfix 2.8
+and earlier.
 .SH smtp_mail_timeout (default: 300s)
 The SMTP client time limit for sending the MAIL FROM command, and
 for receiving the server response.
index 4abb04d87e7bc7b169fc02e223361200bb628b50..f1e25d3836fa5e986c96b48b3b53c6bc3d22c23d 100644 (file)
@@ -4130,18 +4130,21 @@ mechanism).  </dd>
 This feature is available in Postfix 2.1 and later.
 </p>
 
-%PARAM smtp_line_length_limit 990
+%PARAM smtp_line_length_limit 998
 
 <p>
 The maximal length of message header and body lines that Postfix
-will send via SMTP.  Longer lines are broken by inserting
-"&lt;CR&gt;&lt;LF&gt;&lt;SPACE&gt;". This minimizes the damage to
-MIME formatted mail.
+will send via SMTP. This limit does not include the &lt;CR&gt;&lt;LF&gt;
+at the end of each line.  Longer lines are broken by inserting
+"&lt;CR&gt;&lt;LF&gt;&lt;SPACE&gt;", to minimize the damage to MIME
+formatted mail.
 </p>
 
 <p>
-By default, the line length is limited to 990 characters, because
-some server implementations cannot receive mail with long lines.
+The Postfix limit of 998 characters not including &lt;CR&gt;&lt;LF&gt;
+is consistent with the SMTP limit of 1000 characters including
+&lt;CR&gt;&lt;LF&gt;.  The Postfix limit was 990 with Postfix 2.8
+and earlier.
 </p>
 
 %PARAM smtp_mail_timeout 300s
@@ -14204,3 +14207,28 @@ are required to convert long queue file names into short names: </p>
 name changes. </p>
 
 <p> This feature is available in Postfix 2.9 and later.  </p>
+
+%PARAM sendmail_fix_line_endings always
+
+<p> Controls how the Postfix sendmail command converts email message
+line endings from &lt;CR&gt;&lt;LF&gt; into UNIX format (&lt;LF&gt;).
+</p>
+
+<dl>
+
+<dt> <b>always</b> </dt> <dd> Always convert message lines ending
+in &lt;CR&gt;&lt;LF&gt;. This setting is the default with Postfix
+2.9 and later. </dd>
+
+<dt> <b>strict</b> </dt> <dd> Convert message lines ending in
+&lt;CR&gt;&lt;LF&gt; only if the first input line ends in
+&lt;CR&gt;&lt;LF&gt;. This setting is backwards-compatible with
+Postfix 2.8 and earlier. </dd>
+
+<dt> <b>never</b> </dt> <dd> Never convert message lines ending in
+&lt;CR&gt;&lt;LF&gt;. This setting exists for completeness only.
+</dd>
+
+</dl>
+
+<p> This feature is available in Postfix 2.9 and later. </p>
index f181a65d9dee68936ff3c9c765b6e34540d3bdb8..ff2be2ebf9bbe0c886dc664205ae69a9b7c5dae9 100644 (file)
@@ -1080,9 +1080,9 @@ extern char *var_smtp_helo_name;
 extern bool var_smtp_rand_addr;
 
 #define VAR_SMTP_LINE_LIMIT    "smtp_line_length_limit"
-#define DEF_SMTP_LINE_LIMIT    990
+#define DEF_SMTP_LINE_LIMIT    998
 #define VAR_LMTP_LINE_LIMIT    "lmtp_line_length_limit"
-#define DEF_LMTP_LINE_LIMIT    990
+#define DEF_LMTP_LINE_LIMIT    998
 extern int var_smtp_line_limit;
 
 #define VAR_SMTP_PIX_THRESH    "smtp_pix_workaround_threshold_time"
@@ -3595,6 +3595,17 @@ extern bool var_smtpd_rec_deadline;
 #define DEF_LMTP_REC_DEADLINE  0
 extern bool var_smtp_rec_deadline;
 
+ /*
+  * Postfix sendmail command compatibility features.
+  */
+#define SM_FIX_EOL_STRICT      "strict"
+#define SM_FIX_EOL_NEVER       "never"
+#define SM_FIX_EOL_ALWAYS      "always"
+
+#define VAR_SM_FIX_EOL         "sendmail_fix_line_endings"
+#define DEF_SM_FIX_EOL         SM_FIX_EOL_ALWAYS
+extern char *var_sm_fix_eol;
+
 /* LICENSE
 /* .ad
 /* .fi
index e4ace936f64c71966a9d359be7218db3c0b75715..a59d32504121c45bec95b4ed967474924c43e01a 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      "20110930"
+#define MAIL_RELEASE_DATE      "20111012"
 #define MAIL_VERSION_NUMBER    "2.9"
 
 #ifdef SNAPSHOT
index 262b9b8f850c2a7f2e1b867dd578e1cf2dc251b0..805a3f4c8696972c7d3338101446485bfcf075c8 100644 (file)
@@ -83,6 +83,7 @@ sendmail.o: ../../include/msg_stats.h
 sendmail.o: ../../include/msg_syslog.h
 sendmail.o: ../../include/msg_vstream.h
 sendmail.o: ../../include/mymalloc.h
+sendmail.o: ../../include/name_code.h
 sendmail.o: ../../include/rec_streamlf.h
 sendmail.o: ../../include/rec_type.h
 sendmail.o: ../../include/recipient_list.h
index 14bd673d7fcfda1d4ca1cb28cd08ea0d7905d0ef..99059633eb0de650c3ac74711c167d403b7e1156 100644 (file)
 /*     this program.
 /*     The text below provides only a parameter summary. See
 /*     \fBpostconf\fR(5) for more details including examples.
+/* COMPATIBILITY CONTROLS
+/* .ad
+/* .fi
+/* .IP "\fBsendmail_fix_line_endings (always)\fR"
+/*     Controls how the Postfix sendmail command converts email message
+/*     line endings from <CR><LF> into UNIX format (<LF>).
 /* TROUBLE SHOOTING CONTROLS
 /* .ad
 /* .fi
 #include <set_ugid.h>
 #include <connect.h>
 #include <split_at.h>
+#include <name_code.h>
 
 /* Global library. */
 
@@ -494,12 +501,14 @@ typedef struct SM_STATE {
 } SM_STATE;
 
  /*
-  * Mail submission ACL
+  * Mail submission ACL, line-end fixing.
   */
 char   *var_submit_acl;
+char   *var_sm_fix_eol;
 
 static const CONFIG_STR_TABLE str_table[] = {
     VAR_SUBMIT_ACL, DEF_SUBMIT_ACL, &var_submit_acl, 0, 0,
+    VAR_SM_FIX_EOL, DEF_SM_FIX_EOL, &var_sm_fix_eol, 1, 0,
     0,
 };
 
@@ -603,7 +612,7 @@ static void enqueue(const int flags, const char *encoding,
     TOK822 *tp;
     int     rcpt_count = 0;
     enum {
-       STRIP_CR_DUNNO, STRIP_CR_DO, STRIP_CR_DONT
+       STRIP_CR_DUNNO, STRIP_CR_DO, STRIP_CR_DONT, STRIP_CR_ERROR
     }       strip_cr;
     MAIL_STREAM *handle;
     VSTRING *postdrop_command;
@@ -617,6 +626,12 @@ static void enqueue(const int flags, const char *encoding,
     const char *errstr;
     int     addr_count;
     int     level;
+    static NAME_CODE sm_fix_eol_table[] = {
+       SM_FIX_EOL_ALWAYS, STRIP_CR_DO,
+       SM_FIX_EOL_STRICT, STRIP_CR_DUNNO,
+       SM_FIX_EOL_NEVER, STRIP_CR_DONT,
+       0, STRIP_CR_ERROR,
+    };
 
     /*
      * Access control is enforced in the postdrop command. The code here
@@ -791,7 +806,11 @@ static void enqueue(const int flags, const char *encoding,
         * Process header/body lines.
         */
        skip_from_ = 1;
-       strip_cr = STRIP_CR_DUNNO;
+       strip_cr = name_code(sm_fix_eol_table, NAME_CODE_FLAG_STRICT_CASE,
+                            var_sm_fix_eol);
+       if (strip_cr == STRIP_CR_ERROR)
+           msg_fatal_status(EX_USAGE,
+                   "invalid %s value: %s", VAR_SM_FIX_EOL, var_sm_fix_eol);
        for (prev_type = 0; (type = rec_streamlf_get(VSTREAM_IN, buf, var_line_limit))
             != REC_TYPE_EOF; prev_type = type) {
            if (strip_cr == STRIP_CR_DUNNO && type == REC_TYPE_NORM) {
@@ -809,7 +828,7 @@ static void enqueue(const int flags, const char *encoding,
                skip_from_ = 0;
            }
            if (strip_cr == STRIP_CR_DO && type == REC_TYPE_NORM)
-               if (VSTRING_LEN(buf) > 0 && vstring_end(buf)[-1] == '\r')
+               while (VSTRING_LEN(buf) > 0 && vstring_end(buf)[-1] == '\r')
                    vstring_truncate(buf, VSTRING_LEN(buf) - 1);
            if ((flags & SM_FLAG_AEOF) && prev_type != REC_TYPE_CONT
                && VSTRING_LEN(buf) == 1 && *STR(buf) == '.')