[dovecot-cvs] dovecot/src/lib-storage mail-storage.c,1.75,1.76
tss at dovecot.org
tss at dovecot.org
Fri Mar 30 21:32:01 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv29314
Modified Files:
mail-storage.c
Log Message:
mailbox_open/create: Moved the mailbox name validation and error clearing
into common mail-storage.c
Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- mail-storage.c 30 Mar 2007 14:12:48 -0000 1.75
+++ mail-storage.c 30 Mar 2007 18:31:57 -0000 1.76
@@ -330,6 +330,13 @@
int mail_storage_mailbox_create(struct mail_storage *storage, const char *name,
bool directory)
{
+ mail_storage_clear_error(storage);
+
+ if (!mailbox_list_is_valid_create_name(storage->list, name)) {
+ mail_storage_set_error(storage, "Invalid mailbox name");
+ return -1;
+ }
+
return storage->v.mailbox_create(storage, name, directory);
}
@@ -408,6 +415,13 @@
{
struct mailbox *box;
+ mail_storage_clear_error(storage);
+
+ if (!mailbox_list_is_valid_existing_name(storage->list, name)) {
+ mail_storage_set_error(storage, "Invalid mailbox name");
+ return NULL;
+ }
+
box = storage->v.mailbox_open(storage, name, input, flags);
if (hook_mailbox_opened != NULL && box != NULL)
hook_mailbox_opened(box);
More information about the dovecot-cvs
mailing list