From: Timo Sirainen Date: Thu, 24 Nov 2016 17:53:17 +0000 (+0200) Subject: lib-storage: Fail if no namespaces have list=yes X-Git-Tag: 2.3.0.rc1~2521 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25e4617fb7374331411baece15af67aeecacf922;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Fail if no namespaces have list=yes The previous check allowed all namespaces to have list=children. This crashed later on in mail_namespaces_get_root_sep(), because it couldn't find any list=yes namespaces. --- diff --git a/src/lib-storage/mail-namespace.c b/src/lib-storage/mail-namespace.c index 46b2397dc6..1eea385dda 100644 --- a/src/lib-storage/mail-namespace.c +++ b/src/lib-storage/mail-namespace.c @@ -263,7 +263,7 @@ namespaces_check(struct mail_namespace *namespaces, const char **error_r) { struct mail_namespace *ns, *inbox_ns = NULL; unsigned int subscriptions_count = 0; - bool visible_namespaces = FALSE; + bool visible_namespaces = FALSE, have_list_yes = FALSE; char ns_sep, list_sep = '\0'; for (ns = namespaces; ns != NULL; ns = ns->next) { @@ -308,6 +308,8 @@ namespaces_check(struct mail_namespace *namespaces, const char **error_r) } if ((ns->flags & (NAMESPACE_FLAG_LIST_PREFIX | NAMESPACE_FLAG_LIST_CHILDREN)) != 0) { + if ((ns->flags & NAMESPACE_FLAG_LIST_PREFIX) != 0) + have_list_yes = TRUE; if (list_sep == '\0') list_sep = ns_sep; else if (list_sep != ns_sep) { @@ -324,7 +326,7 @@ namespaces_check(struct mail_namespace *namespaces, const char **error_r) *error_r = "inbox=yes namespace missing"; return FALSE; } - if (list_sep == '\0') { + if (!have_list_yes) { *error_r = "list=yes namespace missing"; return FALSE; }