]> Pileus Git - ~andy/fetchmail/commitdiff
Miscellaneous bug fixes.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 20 Jun 2001 05:02:11 +0000 (05:02 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 20 Jun 2001 05:02:11 +0000 (05:02 -0000)
svn path=/trunk/; revision=3361

NEWS
fetchmailconf
options.c
rfc822.c
sink.c
transact.c

diff --git a/NEWS b/NEWS
index 1bc55f5e7bcb77d767128e26e3ef8023b7c182d1..57c13458eb520cee3d30a309f9d8c16f0bd2e0bf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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:
 
index 650e3e8befc8b0ed6e30069adaa8c19dea889be0..c84a9b4e74911fbee17a319c06924b57e34636d0 100755 (executable)
@@ -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
index c1f77554c4eac36ecdaca26d5d3c550d252e53c6..d9e5aa14855d084029736edaf17e5ac6cf10f7ed 100644 (file)
--- a/options.c
+++ b/options.c
@@ -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"));
index 4724b8e2a9993f1ae7f4f250fee15ec076cfd1d2..909b1b7b93f8c0e202eb04b0c0b1af719f206b3c 100644 (file)
--- a/rfc822.c
+++ b/rfc822.c
@@ -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;
diff --git a/sink.c b/sink.c
index fb671b6ee8aff8f9711fb9c3cac0dcd1c221f483..4bf5fd9cf66e644362cc9924f54053d267bbd010 100644 (file)
--- a/sink.c
+++ b/sink.c
@@ -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;
 
index 73c133f707527bff04762f675b3dea5ef02bec49..b758a6f9dfa61d6a1056b0757db4e41a777d7436 100644 (file)
@@ -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)
            {