From: Timo Sirainen Date: Thu, 2 Sep 2010 14:53:08 +0000 (+0100) Subject: lib-storage: If shared namespace uses %% in location, but not in prefix, fail with... X-Git-Tag: 2.0.2~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c62f5b16742dbcd9ecc96a691a3a87a58aabb6a2;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: If shared namespace uses %% in location, but not in prefix, fail with error. --- diff --git a/src/lib-storage/mail-namespace.c b/src/lib-storage/mail-namespace.c index 2a0005551d..0d0a137c7f 100644 --- a/src/lib-storage/mail-namespace.c +++ b/src/lib-storage/mail-namespace.c @@ -125,8 +125,12 @@ namespace_add(struct mail_user *user, ns->mail_set = mail_set; ns->prefix = i_strdup(ns_set->prefix); - if (ns->type == NAMESPACE_SHARED && strchr(ns->prefix, '%') != NULL) { - /* dynamic shared namespace */ + if (ns->type == NAMESPACE_SHARED && + (strchr(ns->prefix, '%') != NULL || + strchr(ns->set->location, '%') != NULL)) { + /* dynamic shared namespace. the above check catches wrong + mixed %% usage, but still allows for specifying a shared + namespace to an explicit location without any %% */ ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL; driver = "shared"; } else {