diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-10-08 06:21:04 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-10-08 06:21:04 +0000 |
commit | 5d344bf47fcf2b5afd46d72576b129296e2c634a (patch) | |
tree | 5bed6da17f5fd371a86ebe1227d55be6a0896861 | |
parent | 81784685082ba83c0374a7f2181e9df7e1454e1a (diff) | |
download | fetchmail-5d344bf47fcf2b5afd46d72576b129296e2c634a.tar.gz fetchmail-5d344bf47fcf2b5afd46d72576b129296e2c634a.tar.bz2 fetchmail-5d344bf47fcf2b5afd46d72576b129296e2c634a.zip |
Don't send \r\n to MDAs.
svn path=/trunk/; revision=245
-rw-r--r-- | driver.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -310,7 +310,7 @@ struct hostrec *queryctl; if (delimited && *bufp == 0) break; /* end of message */ } - strcat(bufp, inheaders ? "\n" : "\r\n"); + strcat(bufp, "\n"); if (inheaders) { @@ -334,6 +334,9 @@ struct hostrec *queryctl; * We deal with RFC822 continuation lines here. * Replace previous '\n' with '\r' so nxtaddr * and reply_hack will be able to see past it. + * (We know this safe because SocketGets stripped + * out all carriage returns in the read loop above + * and we haven't reintroduced any since then.) * We'll undo this before writing the header. */ if (isspace(bufp[0])) @@ -411,6 +414,13 @@ struct hostrec *queryctl; if (*cp == '\r') *cp = '\n'; + /* + * Strictly speaking, we ought to replace all LFs + * with CR-LF before shipping to an SMTP listener. + * Since most SMTP listeners built since the mid-1980s + * (and *all* Unix listeners) accept lone LF as equivalent + * to CR-LF, we'll skip this particular contortion. + */ if (write(mboxfd,headers,oldlen) < 0) { free(headers); @@ -428,7 +438,7 @@ struct hostrec *queryctl; if (*bufp == '.' && queryctl->mda[0] == 0) write(mboxfd, ".", 1); - /* write this line to the file */ + /* write this line to the file -- comment about CR-LF vs. LF applies */ if (write(mboxfd,bufp,strlen(bufp)) < 0) { perror("gen_readmsg: writing message text"); |