changeset 13503:ea657df52a85

lib-storage: If shared namespace prefix doesn't end with hierarchy separator, fail.
author Timo Sirainen <tss@iki.fi>
date Fri, 16 Sep 2011 13:14:11 +0300
parents e57bd3e2ec27
children 19086b0d53f4
files src/lib-storage/index/shared/shared-storage.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/shared/shared-storage.c	Fri Sep 16 13:06:48 2011 +0300
+++ b/src/lib-storage/index/shared/shared-storage.c	Fri Sep 16 13:14:11 2011 +0300
@@ -79,6 +79,12 @@
 		*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 */