From: Timo Sirainen Date: Fri, 16 Sep 2011 10:14:11 +0000 (+0300) Subject: lib-storage: If shared namespace prefix doesn't end with hierarchy separator, fail. X-Git-Tag: 2.0.15~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5bb2908b44c8bf5ce41160a64c67fb840a20006;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: If shared namespace prefix doesn't end with hierarchy separator, fail. --- diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index 51b38dcc30..b9e048659e 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -79,6 +79,12 @@ shared_storage_create(struct mail_storage *_storage, struct mail_namespace *ns, *error_r = "Shared namespace prefix doesn't contain %u or %n"; return -1; } + if (p[-1] != ns->sep && + (ns->flags & (NAMESPACE_FLAG_LIST_PREFIX | + NAMESPACE_FLAG_LIST_CHILDREN)) != 0) { + *error_r = "Shared namespace prefix doesn't end with hierarchy separator"; + return -1; + } /* truncate prefix after the above checks are done, so they can log the full prefix in error conditions */