[dovecot-cvs] dovecot/src/imap cmd-create.c,1.2,1.3
cras at procontrol.fi
cras at procontrol.fi
Thu Jan 2 14:35:39 EET 2003
Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv2789
Modified Files:
cmd-create.c
Log Message:
CREATE mailbox<hierarchy separator> failed always.
Index: cmd-create.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-create.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cmd-create.c 23 Sep 2002 16:57:58 -0000 1.2
+++ cmd-create.c 2 Jan 2003 12:35:37 -0000 1.3
@@ -6,19 +6,26 @@
int cmd_create(Client *client)
{
const char *mailbox;
+ int ignore;
/* <mailbox> */
if (!client_read_string_args(client, 1, &mailbox))
return FALSE;
- if (!client_verify_mailbox_name(client, mailbox, FALSE, TRUE))
- return TRUE;
-
- if (mailbox[strlen(mailbox)-1] == client->storage->hierarchy_sep) {
+ ignore = mailbox[strlen(mailbox)-1] == client->storage->hierarchy_sep;
+ if (ignore) {
/* name ends with hierarchy separator - client is just
informing us that it wants to create a mailbox under
- this name. we don't need that information. */
- } else if (!client->storage->create_mailbox(client->storage, mailbox)) {
+ this name. we don't need that information, but verify
+ that the mailbox name is valid */
+ mailbox = t_strndup(mailbox, strlen(mailbox)-1);
+ }
+
+ if (!client_verify_mailbox_name(client, mailbox, FALSE, !ignore))
+ return TRUE;
+
+ if (!ignore &&
+ !client->storage->create_mailbox(client->storage, mailbox)) {
client_send_storage_error(client);
return TRUE;
}
More information about the dovecot-cvs
mailing list