diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-01-27 02:13:33 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-01-27 02:13:33 +0000 |
commit | 60e6d78753d7cba662a3eee29c05d5b4d52e4551 (patch) | |
tree | 741f3948ae0daab8a94f90a20ea9287cde29ffa3 | |
parent | a2897f032fb00167b1844c7f298e128e33527733 (diff) | |
download | fetchmail-60e6d78753d7cba662a3eee29c05d5b4d52e4551.tar.gz fetchmail-60e6d78753d7cba662a3eee29c05d5b4d52e4551.tar.bz2 fetchmail-60e6d78753d7cba662a3eee29c05d5b4d52e4551.zip |
CR-strip fix.
svn path=/trunk/; revision=833
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | driver.c | 120 | ||||
-rw-r--r-- | imap.c | 3 |
3 files changed, 88 insertions, 41 deletions
@@ -3,12 +3,18 @@ ------------------------------------------------------------------------------ fetchmail-3.2 () +features -- + +* Better error notification on IMAP select failure. + bugs -- * The code can now handle arbitrarily long address lists. * Fix RFC822 parsing to strip comments at end of bare addresses. +* Explicitly strip CRs out of fetched mail. + ------------------------------------------------------------------------------ fetchmail-3.1 (Fri Jan 24 12:45:18 EST 1997) @@ -763,25 +763,37 @@ char *realname; /* real name of host */ } /* write all the headers */ - if (ctl->mda) - n = fwrite(headers, 1, oldlen, sinkfp); - else if (sinkfp) - n = SockWrite(headers, 1, oldlen, sinkfp); - - if (n < 0) + if (sinkfp) { - free(headers); - headers = NULL; - error(0, errno, "writing RFC822 headers"); if (ctl->mda) { - pclose(sinkfp); - signal(SIGCHLD, sigchld); + char *sp, *tp; + + for (sp = tp = headers; *sp; sp++) + if (*sp != '\r') + *tp++ = *sp; + *tp = '\0'; + + n = fwrite(headers, 1, oldlen, sinkfp); } - return(PS_IOERR); + else + n = SockWrite(headers, 1, oldlen, sinkfp); + + if (n < 0) + { + free(headers); + headers = NULL; + error(0, errno, "writing RFC822 headers"); + if (ctl->mda) + { + pclose(sinkfp); + signal(SIGCHLD, sigchld); + } + return(PS_IOERR); + } + else if (outlevel == O_VERBOSE) + fputs("#", stderr); } - else if (outlevel == O_VERBOSE) - fputs("#", stderr); free(headers); headers = NULL; @@ -828,19 +840,33 @@ char *realname; /* real name of host */ strcat(errmsg, "\n"); /* ship out the error line */ - if (ctl->mda) - fwrite(errmsg, 1, strlen(errmsg), sinkfp); - else if (sinkfp) - SockWrite(errmsg, 1, strlen(errmsg), sinkfp); + if (sinkfp) + { + if (ctl->mda) + { + char *sp, *tp; + + for (sp = tp = headers; *sp; sp++) + if (*sp != '\r') + *tp++ = *sp; + *tp = '\0'; + fwrite(errmsg, 1, strlen(errmsg), sinkfp); + } + else + SockWrite(errmsg, 1, strlen(errmsg), sinkfp); + } } free_str_list(&xmit_names); /* issue the delimiter line */ - if (ctl->mda) - fputs("\r\n", sinkfp); - else if (sinkfp) - SockWrite("\r\n", 1, 2, sinkfp); + if (sinkfp) + { + if (ctl->mda) + fputc('\n', sinkfp); + else + SockWrite("\r\n", 1, 2, sinkfp); + } /* * Body processing starts here @@ -871,31 +897,43 @@ char *realname; /* real name of host */ if (buf[1] == '\r' && buf[2] == '\n') break; - /* SMTP byte-stuffing */ - if (*buf == '.') - if (ctl->mda) - fputs(".", sinkfp); - else if (sinkfp) - SockWrite(buf, 1, 1, sinkfp); - /* ship out the text line */ - if (ctl->mda) - n = fwrite(buf, 1, strlen(buf), sinkfp); - else if (sinkfp) - n = SockWrite(buf, 1, strlen(buf), sinkfp); - - if (n < 0) + if (sinkfp) { - error(0, errno, "writing message text"); + /* SMTP byte-stuffing */ + if (*buf == '.') + if (ctl->mda) + fputs(".", sinkfp); + else + SockWrite(buf, 1, 1, sinkfp); + if (ctl->mda) { - pclose(sinkfp); - signal(SIGCHLD, sigchld); + char *sp, *tp; + + for (sp = tp = headers; *sp; sp++) + if (*sp != '\r') + *tp++ = *sp; + *tp = '\0'; + + n = fwrite(buf, 1, strlen(buf), sinkfp); } - return(PS_IOERR); + else if (sinkfp) + n = SockWrite(buf, 1, strlen(buf), sinkfp); + + if (n < 0) + { + error(0, errno, "writing message text"); + if (ctl->mda) + { + pclose(sinkfp); + signal(SIGCHLD, sigchld); + } + return(PS_IOERR); + } + else if (outlevel == O_VERBOSE) + fputc('*', stderr); } - else if (outlevel == O_VERBOSE) - fputc('*', stderr); } /* @@ -128,7 +128,10 @@ static int imap_getrange(FILE *sockfp, struct query *ctl, int*countp, int*newp) "SELECT %s", ctl->mailbox ? ctl->mailbox : "INBOX"); if (ok != 0) + { + error(0, 0, "mailbox selection failed"); return(ok); + } *countp = count; |