aboutsummaryrefslogtreecommitdiffstats
path: root/imap.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-02-19 21:17:27 +0000
committerEric S. Raymond <esr@thyrsus.com>2001-02-19 21:17:27 +0000
commit1fd41e10f792129a16f555e09aea71e61c0fd102 (patch)
treeb3ec24c23fc96a2fac87565e50284803bbaf95cb /imap.c
parente5595d4f911a74b566929394fafe47b5dbe71a28 (diff)
downloadfetchmail-1fd41e10f792129a16f555e09aea71e61c0fd102.tar.gz
fetchmail-1fd41e10f792129a16f555e09aea71e61c0fd102.tar.bz2
fetchmail-1fd41e10f792129a16f555e09aea71e61c0fd102.zip
Don't try to POP a read-only mailbox.
svn path=/trunk/; revision=3124
Diffstat (limited to 'imap.c')
-rw-r--r--imap.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/imap.c b/imap.c
index cb78a0ac..bf1552b9 100644
--- 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));