fetchmail-friends
[Top] [All Lists]

Re: [fetchmail][BUG] fetchmail can no longer do IMAP message checking

2001-03-07 06:54:09
On Wed, Mar 07, 2001 at 12:02:36AM -0300, hmh(_at_)debian(_dot_)org wrote:
On Mon, 05 Mar 2001, michaell(_at_)collegenet(_dot_)com wrote:
fetchmail: IMAP< A0003 OK [READ-ONLY] Ok
fetchmail: IMAP> A0004 SEARCH UNSEEN
[...]


fetchmail: IMAP< A0003 OK [READ-ONLY] Ok
fetchmail: mailbox selection failed

Isn't this the new IMAP read-only folder behaviour showing?  I don't know
much about IMAP, but it looks like your inbox is marked read-only, so
fetchmail refuses to touch it.


I did some digging around in the code (and looked at the NEWS file).  Your 
right, fetchmail bails if the mailbox is set to READ-ONLY.  But, when doing a 
check, fetchmail uses the EXAMINE instead of SELECT (from imap.c):

        ok = gen_transact(sock, 
                          check_only ? "EXAMINE \"%s\"" : "SELECT \"%s\"",
                          folder ? folder : "INBOX");

So it would make complete sense for the IMAP server to enter READ-ONLY mode.  
The code bails using the following:

        /*
        * The server may decide to make the mailbox read-only, 
        * which causes fetchmail to go into a endless loop
        * fetching the same message over and over again. 
        * 
        * This checks for the condition and aborts if 
        * the mailbox is read-only. 
        *
        * See RFC 2060 section 6.3.1 (SELECT).
        */ 
        else if (strstr(buf, "[READ-ONLY]"))
                return(PS_LOCKBUSY);

Section 6.3.2 states that for an EXAMINE, the mailbox should be identified as 
READ-ONLY.


I'm sure there are better ways to handle the endless loop condition besides 
aborting.  But in the mean time, could this temporary fix be modified to allow 
read-only access on an EXAMINE call?

-- 
Michael Lee