changeset 888:986e89b61520 HEAD

CREATE mailbox<hierarchy separator> failed always.
author Timo Sirainen <tss@iki.fi>
date Thu, 02 Jan 2003 14:35:37 +0200
parents 06776a31f50c
children f6e6812bd872
files src/imap/cmd-create.c
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-create.c	Thu Jan 02 14:20:46 2003 +0200
+++ b/src/imap/cmd-create.c	Thu Jan 02 14:35:37 2003 +0200
@@ -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))
+	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, 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 (mailbox[strlen(mailbox)-1] == client->storage->hierarchy_sep) {
-		/* 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)) {
+	if (!ignore &&
+	    !client->storage->create_mailbox(client->storage, mailbox)) {
 		client_send_storage_error(client);
 		return TRUE;
 	}