dovecot-2.2: lib-storage: Allow mailbox name to begin with separ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 26 00:39:03 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/71fb4be2f666
changeset: 15113:71fb4be2f666
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 26 00:38:45 2012 +0300
description:
lib-storage: Allow mailbox name to begin with separator if mail_full_filesystem_access=yes

diffstat:

 src/lib-storage/mail-storage.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 6e90fc8dfa25 -r 71fb4be2f666 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Wed Sep 26 00:35:10 2012 +0300
+++ b/src/lib-storage/mail-storage.c	Wed Sep 26 00:38:45 2012 +0300
@@ -716,14 +716,9 @@
 	unsigned int i;
 	bool prev_sep = FALSE;
 
-	if (vname[0] == sep) {
-		*error_r = "Begins with hierarchy separator";
-		return FALSE;
-	}
-
 	/* Make sure the vname is correct: non-empty, doesn't begin or end
 	   with separator and no adjacent separators */
-	for (i = 1; vname[i] != '\0'; i++) {
+	for (i = 0; vname[i] != '\0'; i++) {
 		if (vname[i] == sep) {
 			if (prev_sep) {
 				*error_r = "Has adjacent hierarchy separators";
@@ -734,7 +729,7 @@
 			prev_sep = FALSE;
 		}
 	}
-	if (prev_sep) {
+	if (prev_sep && i > 0) {
 		*error_r = "Ends with hierarchy separator";
 		return FALSE;
 	}
@@ -779,6 +774,13 @@
 			"Character not allowed in mailbox name: '%c'", list_sep));
 		return -1;
 	}
+	if (vname[0] == ns_sep &&
+	    !box->storage->set->mail_full_filesystem_access) {
+		mail_storage_set_error(box->storage, MAIL_ERROR_PARAMS,
+			"Invalid mailbox name: Begins with hierarchy separator");
+		return -1;
+	}
+
 	if (!mailbox_name_verify_separators(vname, ns_sep, &error) ||
 	    !mailbox_list_is_valid_name(box->list, box->name, &error)) {
 		mail_storage_set_error(box->storage, MAIL_ERROR_PARAMS,


More information about the dovecot-cvs mailing list