From: Dr. Stephen Henson Date: Thu, 19 May 2016 16:22:57 +0000 (+0100) Subject: Use correct EOL in headers. X-Git-Tag: OpenSSL_1_1_0-pre6~761 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2197494da6a2f4b1cc7024bb647c775f277f53c5;p=oweals%2Fopenssl.git Use correct EOL in headers. RT#1817 Reviewed-by: Rich Salz --- diff --git a/apps/cms.c b/apps/cms.c index 1c3069f764..3a9b7af7b9 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -216,6 +216,7 @@ int cms_main(int argc, char **argv) unsigned char *pwri_pass = NULL, *pwri_tmp = NULL; unsigned char *secret_key = NULL, *secret_keyid = NULL; long ltmp; + const char *mime_eol = "\n"; OPTION_CHOICE o; if ((vpm = X509_VERIFY_PARAM_new()) == NULL) @@ -348,6 +349,7 @@ int cms_main(int argc, char **argv) flags |= CMS_NOOLDMIMETYPE; break; case OPT_CRLFEOL: + mime_eol = "\r\n"; flags |= CMS_CRLFEOL; break; case OPT_NOOUT: @@ -1040,11 +1042,11 @@ int cms_main(int argc, char **argv) CMS_ContentInfo_print_ctx(out, cms, 0, NULL); } else if (outformat == FORMAT_SMIME) { if (to) - BIO_printf(out, "To: %s\n", to); + BIO_printf(out, "To: %s%s", to, mime_eol); if (from) - BIO_printf(out, "From: %s\n", from); + BIO_printf(out, "From: %s%s", from, mime_eol); if (subject) - BIO_printf(out, "Subject: %s\n", subject); + BIO_printf(out, "Subject: %s%s", subject, mime_eol); if (operation == SMIME_RESIGN) ret = SMIME_write_CMS(out, cms, indata, flags); else diff --git a/apps/smime.c b/apps/smime.c index ae1b017461..f9f3d23787 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -134,6 +134,7 @@ int smime_main(int argc, char **argv) FORMAT_PEM; int vpmtouched = 0, rv = 0; ENGINE *e = NULL; + const char *mime_eol = "\n"; if ((vpm = X509_VERIFY_PARAM_new()) == NULL) return 1; @@ -224,6 +225,7 @@ int smime_main(int argc, char **argv) break; case OPT_CRLFEOL: flags |= PKCS7_CRLFEOL; + mime_eol = "\r\n"; break; case OPT_RAND: inrand = opt_arg(); @@ -574,11 +576,11 @@ int smime_main(int argc, char **argv) PEM_write_bio_PKCS7(out, p7); else { if (to) - BIO_printf(out, "To: %s\n", to); + BIO_printf(out, "To: %s%s", to, mime_eol); if (from) - BIO_printf(out, "From: %s\n", from); + BIO_printf(out, "From: %s%s", from, mime_eol); if (subject) - BIO_printf(out, "Subject: %s\n", subject); + BIO_printf(out, "Subject: %s%s", subject, mime_eol); if (outformat == FORMAT_SMIME) { if (operation == SMIME_RESIGN) rv = SMIME_write_PKCS7(out, p7, indata, flags); diff --git a/doc/apps/cms.pod b/doc/apps/cms.pod index 2c7566499d..4876ef1521 100644 --- a/doc/apps/cms.pod +++ b/doc/apps/cms.pod @@ -74,6 +74,7 @@ B B [B<-noattr>] [B<-nosmimecap>] [B<-binary>] +[B<-crlfeol>] [B<-asciicrlf>] [B<-nodetach>] [B<-certfile file>] @@ -340,6 +341,11 @@ effectively using CR and LF as end of line: as required by the S/MIME specification. When this option is present no translation occurs. This is useful when handling binary data which may not be in MIME format. +=item B<-crlfeol> + +normally the output file uses a single B as end of line. When this +option is present B is used instead. + =item B<-asciicrlf> when signing use ASCII CRLF format canonicalisation. This strips trailing diff --git a/doc/apps/smime.pod b/doc/apps/smime.pod index 8b58ccc699..4dc737893a 100644 --- a/doc/apps/smime.pod +++ b/doc/apps/smime.pod @@ -14,6 +14,8 @@ B B [B<-resign>] [B<-verify>] [B<-pk7out>] +[B<-binary>] +[B<-crlfeol>] [B<-[cipher]>] [B<-in file>] [B<-CAfile file>] @@ -245,6 +247,11 @@ effectively using CR and LF as end of line: as required by the S/MIME specification. When this option is present no translation occurs. This is useful when handling binary data which may not be in MIME format. +=item B<-crlfeol> + +normally the output file uses a single B as end of line. When this +option is present B is used instead. + =item B<-nodetach> when signing a message use opaque signing: this form is more resistant