]> Pileus Git - ~andy/fetchmail/commitdiff
Don't try to POP a read-only mailbox.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 19 Feb 2001 21:17:27 +0000 (21:17 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 19 Feb 2001 21:17:27 +0000 (21:17 -0000)
svn path=/trunk/; revision=3124

imap.c

diff --git a/imap.c b/imap.c
index cb78a0acdafa1d6a9f4a647127b95c22f67b88de..bf1552b9f4f842b3d1fb2e11b53c44ee3562f514 100644 (file)
--- a/imap.c
+++ b/imap.c
@@ -78,6 +78,18 @@ int imap_ok(int sock, char *argbuf)
        }
        else if (strstr(buf, "PREAUTH"))
            preauth = TRUE;
+       /*
+        * 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);
     } while
        (tag[0] != '\0' && strncmp(buf, tag, strlen(tag)));
 
@@ -181,7 +193,7 @@ static int do_imap_ntlm(int sock, struct query *ctl)
     if (outlevel >= O_MONITOR)
        report(stdout, "IMAP> %s\n", msgbuf);
       
-    strcat(msgbuf,"\r\n");
+
 
     SockWrite (sock, msgbuf, strlen (msgbuf));