changeset 8904:2b6107437df3 HEAD

If shared_storage_get_namespace() fails due to ns prefix pattern mismatch, log an error. Although should this ever happen? Maybe they should be asserts..
author Timo Sirainen <tss@iki.fi>
date Fri, 03 Apr 2009 12:34:45 -0400
parents 20e6fa42d081
children b567f5f42b3d
files src/lib-storage/index/shared/shared-storage.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/shared/shared-storage.c	Thu Apr 02 19:52:58 2009 -0400
+++ b/src/lib-storage/index/shared/shared-storage.c	Fri Apr 03 12:34:45 2009 -0400
@@ -145,8 +145,12 @@
 	p = storage->ns_prefix_pattern;
 	for (name = *_name; *p != '\0';) {
 		if (*p != '%') {
-			if (*p != *name)
+			if (*p != *name) {
+				mail_storage_set_critical(_storage,
+					"Invalid namespace prefix %s vs %s",
+					storage->ns_prefix_pattern, *_name);
 				return -1;
+			}
 			p++; name++;
 			continue;
 		}
@@ -167,8 +171,12 @@
 		p++;
 
 		next = strchr(name, *p != '\0' ? *p : _storage->ns->sep);
-		if (next == NULL)
+		if (next == NULL) {
+			mail_storage_set_critical(_storage,
+				"Invalid namespace prefix %s vs %s",
+				storage->ns_prefix_pattern, *_name);
 			return -1;
+		}
 
 		*dest = t_strdup_until(name, next);
 		name = next;