dovecot-2.0: lib-storage: Don't crash if root mail directory isn...

dovecot at dovecot.org dovecot at dovecot.org
Mon Apr 5 03:07:18 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/373e2b3a050a
changeset: 11054:373e2b3a050a
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Apr 05 03:07:14 2010 +0300
description:
lib-storage: Don't crash if root mail directory isn't given.

diffstat:

 src/lib-storage/mail-storage.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 87b7fc7f1e7d -r 373e2b3a050a src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Mon Apr 05 02:56:31 2010 +0300
+++ b/src/lib-storage/mail-storage.c	Mon Apr 05 03:07:14 2010 +0300
@@ -130,7 +130,7 @@
 				"Unknown mail storage driver %s", driver);
 			return NULL;
 		}
-		i_assert(list_set->root_dir != NULL);
+
 		storage_class->v.get_list_settings(ns, list_set);
 		return storage_class;
 	}
@@ -154,7 +154,6 @@
 	}
 	return NULL;
 }
-
 static int
 mail_storage_create_root(struct mailbox_list *list,
 			 enum mail_storage_flags flags, const char **error_r)
@@ -256,8 +255,9 @@
 			return -1;
 	}
 
-	if ((flags & MAIL_STORAGE_FLAG_NO_AUTODETECTION) != 0 &&
-	    list_set.root_dir == NULL) {
+	if ((list_set.root_dir == NULL || *list_set.root_dir == '\0') &&
+	    (driver != NULL ||
+	     (flags & MAIL_STORAGE_FLAG_NO_AUTODETECTION) != 0)) {
 		*error_r = "Root mail directory not given";
 		return -1;
 	}


More information about the dovecot-cvs mailing list