[dovecot-cvs] dovecot/src/imap cmd-create.c,1.14,1.14.2.1

tss at dovecot.org tss at dovecot.org
Tue Mar 13 19:18:39 EET 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv27821

Modified Files:
      Tag: branch_1_0
	cmd-create.c 
Log Message:
If trying to create <mailbox><real separator>, give an error instead of
working like <virtual separator>.



Index: cmd-create.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-create.c,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -d -r1.14 -r1.14.2.1
--- cmd-create.c	13 Jan 2006 20:25:59 -0000	1.14
+++ cmd-create.c	13 Mar 2007 17:18:37 -0000	1.14.2.1
@@ -1,11 +1,12 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "common.h"
+#include "namespace.h"
 #include "commands.h"
 
 bool cmd_create(struct client_command_context *cmd)
 {
-	struct mail_storage *storage;
+	struct namespace *ns;
 	const char *mailbox, *full_mailbox;
 	bool directory;
 	size_t len;
@@ -15,13 +16,12 @@
 		return FALSE;
 	full_mailbox = mailbox;
 
-	storage = client_find_storage(cmd, &mailbox);
-	if (storage == NULL)
+	ns = client_find_namespace(cmd, &mailbox);
+	if (ns == NULL)
 		return TRUE;
 
-	len = strlen(mailbox);
-	if (len == 0 ||
-	    mailbox[len-1] != mail_storage_get_hierarchy_sep(storage))
+	len = strlen(full_mailbox);
+	if (len == 0 || full_mailbox[len-1] != ns->sep)
 		directory = FALSE;
 	else {
 		/* name ends with hierarchy separator - client is just
@@ -35,8 +35,8 @@
 	if (!client_verify_mailbox_name(cmd, full_mailbox, FALSE, TRUE))
 		return TRUE;
 
-	if (mail_storage_mailbox_create(storage, mailbox, directory) < 0)
-		client_send_storage_error(cmd, storage);
+	if (mail_storage_mailbox_create(ns->storage, mailbox, directory) < 0)
+		client_send_storage_error(cmd, ns->storage);
 	else
 		client_send_tagline(cmd, "OK Create completed.");
 	return TRUE;



More information about the dovecot-cvs mailing list