diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-06-20 05:02:11 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-06-20 05:02:11 +0000 |
commit | 327eb432aa6884bf3bac6ef0dd6c63e0dc5198f2 (patch) | |
tree | a478a8d56ceaa437a8ed7ed99843ecff9b25e0b7 | |
parent | e95b8d68642cbd3b9a10509547e706db85a21883 (diff) | |
download | fetchmail-327eb432aa6884bf3bac6ef0dd6c63e0dc5198f2.tar.gz fetchmail-327eb432aa6884bf3bac6ef0dd6c63e0dc5198f2.tar.bz2 fetchmail-327eb432aa6884bf3bac6ef0dd6c63e0dc5198f2.zip |
Miscellaneous bug fixes.
svn path=/trunk/; revision=3361
-rw-r--r-- | NEWS | 4 | ||||
-rwxr-xr-x | fetchmailconf | 10 | ||||
-rw-r--r-- | options.c | 2 | ||||
-rw-r--r-- | rfc822.c | 2 | ||||
-rw-r--r-- | sink.c | 4 | ||||
-rw-r--r-- | transact.c | 50 |
6 files changed, 50 insertions, 22 deletions
@@ -5,6 +5,10 @@ * Fix bug that prevented messages from being marked oversized unless -v was on. * Byrial Jensen made the tracepoll information RFC822-conformant. * Reorder code to avoid accessing line buffers after they have been freed. +* Steven Krings's patch to deal with over-long header lines. +* Fix for Debian bug #101500. +* Updated Danish translation by Byrial Jensen. +* Chris Maio's patch for POP3 with BSMTP. fetchmail-5.8.7 (Sun Jun 17 12:02:17 EDT 2001), 20749 lines: diff --git a/fetchmailconf b/fetchmailconf index 650e3e8b..c84a9b4e 100755 --- a/fetchmailconf +++ b/fetchmailconf @@ -94,7 +94,7 @@ class Server: self.plugout = None # Plugin command for going to listener self.netsec = None # IPV6 security options self.principal = None # Kerberos principal - self.tracepolls = FALSE # Add X-Fetchmail-Account header? + self.tracepolls = FALSE # Add trace-poll info to headers self.users = [] # List of user entries for site Server.typemap = ( ('pollname', 'String'), @@ -104,7 +104,7 @@ class Server: ('protocol', 'String'), ('port', 'Int'), ('uidl', 'Boolean'), - ('auth', 'String'), + ('auth', 'String'), ('timeout', 'Int'), ('envelope', 'String'), ('envskip', 'Int'), @@ -168,8 +168,8 @@ class Server: else: res = res + " " - if self.tracepolls: - res = res + "tracepolls\n" + if self.tracepolls: + res = res + "tracepolls\n" if self.interface: res = res + "interface " + str(self.interface) @@ -292,7 +292,7 @@ class User: if self.localnames: res = res + "is" for x in self.localnames: - res = res + " " + x + res = res + " " + `x` res = res + " here" if (self.keep != UserDefaults.keep or self.flush != UserDefaults.flush @@ -672,7 +672,7 @@ struct query *ctl; /* option record to be initialized */ P(_(" -E, --envelope envelope address header\n")); P(_(" -Q, --qvirtual prefix to remove from local user id\n")); P(_(" --principal mail service principal\n")); - P(_(" --addaccthdr add an X-Fetchmail-Account header (\"label <user@host>\")\n")); + P(_(" --tracepolls add poll-tracing information to Received header\n")); P(_(" -u, --username specify users's login on server\n")); P(_(" -a, --all retrieve old and new messages\n")); @@ -16,7 +16,7 @@ #include "fetchmail.h" #include "i18n.h" -#define HEADER_END(p) ((p)[0] == '\n' && ((p)[1] != ' ' && (p)[1] != '\t' && (p)[1] != '\0')) +#define HEADER_END(p) ((p)[0] == '\n' && ((p)[1] != ' ' && (p)[1] != '\t')) #ifdef TESTMAIN static int verbose; @@ -938,7 +938,7 @@ int open_sink(struct query *ctl, struct msgblk *msg, void release_sink(struct query *ctl) /* release the per-message output sink, whether it's a pipe or SMTP socket */ { - if (ctl->bsmtp) + if (ctl->bsmtp && sinkfp) fclose(sinkfp); else if (ctl->mda) { @@ -984,7 +984,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) return(FALSE); } } - else if (ctl->bsmtp) + else if (ctl->bsmtp && sinkfp) { int error; @@ -387,6 +387,7 @@ int readheaders(int sock, for (remaining = fetchlen; remaining > 0 || protocol->delimited; remaining -= linelen) { char *line; + int overlong = FALSE; line = xmalloc(sizeof(buf)); linelen = 0; @@ -404,6 +405,19 @@ int readheaders(int sock, linelen += n; msgblk.msglen += n; + /* + * Try to gracefully handle the case, where the length of a + * line exceeds MSGBUFSIZE. + */ + if ( n && buf[n-1] != '\n' ) { + unsigned int llen = strlen(line); + overlong = TRUE; + line = realloc(line, llen + n + 1); + strcpy(line + llen, buf); + ch = ' '; /* So the next iteration starts */ + continue; + } + /* lines may not be properly CRLF terminated; fix this for qmail */ if (ctl->forcecr) { @@ -416,17 +430,27 @@ int readheaders(int sock, } } - /* - * Decode MIME encoded headers. We MUST do this before - * looking at the Content-Type / Content-Transfer-Encoding - * headers (RFC 2046). - */ - if (ctl->mimedecode) - UnMimeHeader(buf); - - line = (char *) realloc(line, strlen(line) + strlen(buf) +1); + /* + * Decode MIME encoded headers. We MUST do this before + * looking at the Content-Type / Content-Transfer-Encoding + * headers (RFC 2046). + */ + if ( ctl->mimedecode && overlong ) { + /* + * If we received an overlong line, we have to decode the + * whole line at once. + */ + line = (char *) realloc(line, strlen(line) + strlen(buf) +1); + strcat(line, buf); + UnMimeHeader(line); + } + else { + if ( ctl->mimedecode ) + UnMimeHeader(buf); - strcat(line, buf); + line = (char *) realloc(line, strlen(line) + strlen(buf) +1); + strcat(line, buf); + } /* check for end of headers */ if (EMPTYLINE(line)) @@ -444,8 +468,8 @@ int readheaders(int sock, */ if (protocol->delimited && line[0] == '.' && EMPTYLINE(line+1)) { - free(line); has_nuls = (linelen != strlen(line)); + free(line); goto process_headers; } @@ -1006,7 +1030,7 @@ int readheaders(int sock, * This header is technically invalid under RFC822. * POP3, IMAP, etc. are not legal mail-parameter values. */ - sprintf(buf, "\tby %s with %s (fetchmail-%s)", + sprintf(buf, "\tby %s with %s (fetchmail-%s", fetchmailhost, protocol->name, VERSION); @@ -1016,7 +1040,7 @@ int readheaders(int sock, ctl->server.pollname, ctl->remotename); } - strcat(buf, "\r\n"); + strcat(buf, ")\r\n"); n = stuffline(ctl, buf); if (n != -1) { |