Olivier Girondel writes:
Subject: [courier-users] Re: APPEND command and [TRYCREATE]
Date: Wed, 20 Jun 2001 21:39:25 GMT
From: Sam Varshavchik <mrs...@courier-mta.com>
To: cour...@lists.sourceforge.net
References: <3B30...@isdnet.net>
Olivier Girondel writes:
Hi,
First, thanks for your software. Works like a charm :)
Here's a little patch to apply against imapd.c in order
to get a "[TRYCREATE]" response when appending a
mail in a non-existant mailbox.
Quoting RFC2060:
6.3.11. APPEND Command
(...)
If the destination mailbox does not exist, a server MUST return
an
error, and MUST NOT automatically create the mailbox. Unless it
is
certain that the destination mailbox can not be created, the
server
MUST send the response code "[TRYCREATE]" as the prefix of the
text
of the tagged NO response. This gives a hint to the client that
it
can attempt a CREATE command and retry the APPEND if the CREATE
is
successful.
I hope i did not miss some point in the RFCs :)
Yes, you did.
Seems like i read the source too quickly, sorry... Anyhow i need Courier
to give this TRYCREATE response when the mailbox doesn't exist,
so here is a second patch which i hope will be ok :)
Sample session (courier-imap-1.3.8.2) :
(...)
a append INBOX {3}
+ OK
123
a OK APPEND Ok.
b append INBOX.w%o*g {3}
b NO Invalid mailbox
c append INBOX.not_there {3}
c NO [TRYCREATE] Must create mailbox before append
c NO Invalid mailbox
Not quite. NO must be sent only once.
Also, all allocated memory needs to be freed, otherwise you'll have a
denial-of-service attack on your hands.