fetchmail-friends
[Top] [All Lists]

Re: [fetchmail] POP3 retrieval problems on fetchmail 6.1.0

2002-10-06 22:45:05
Quoting from Sunil Shetye's mail on Thu, Oct 03, 2002 at 02:23:43PM +0530:
Oops! This was due to my patch to optimise for retained mails. The
problem is that readbody cannot be suppressed for POP3 as the body is
already being sent. Here is a patch which suppresses reading the body
only if the protocol supports it. This logic is extended to transient
(dns) and refused (duplicate mail) errors.

Another bug is that the headers after X-IMAP: are not read before
returning PS_RETAINED. This doesn't matter in POP3 as the remaining
headers will get read (incorrectly) as part of the body.

Here is a patch which fixes this:

============================================================
diff -Naur fetchmail-6.1.0.orig/transact.c fetchmail-6.1.0/transact.c
--- fetchmail-6.1.0.orig/transact.c     Mon Sep 23 03:48:19 2002
+++ fetchmail-6.1.0/transact.c  Mon Oct  7 11:04:08 2002
@@ -371,6 +371,7 @@
     flag               no_local_matches = FALSE;
     flag               headers_ok, has_nuls;
     int                        olderrs, good_addresses, bad_addresses;
+    int                        retain_mail = 0;
 
     sizeticker = 0;
     has_nuls = headers_ok = FALSE;
@@ -558,9 +559,8 @@
 #endif /* POP2_ENABLE */
            if (num == 1 && !strncasecmp(line, "X-IMAP:", 7)) {
                free(line);
-               free(msgblk.headers);
-               msgblk.headers = NULL;
-               return(PS_RETAINED);
+               retain_mail = 1;
+               continue;
            }
 
        /*
@@ -798,6 +798,13 @@
     }
 
  process_headers:    
+
+    if (retain_mail)
+    {
+       free(msgblk.headers);
+       msgblk.headers = NULL;
+       return(PS_RETAINED);
+    }
     /*
      * When mail delivered to a multidrop mailbox on the server is
      * addressed to multiple people on the client machine, there will
============================================================

Sunil Shetye.

<Prev in Thread] Current Thread [Next in Thread>