dovecot-1.2: If shared_storage_get_namespace() fails due to ns p...

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 3 19:35:08 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/2b6107437df3
changeset: 8904:2b6107437df3
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Apr 03 12:34:45 2009 -0400
description:
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..

diffstat:

1 file changed, 10 insertions(+), 2 deletions(-)
src/lib-storage/index/shared/shared-storage.c |   12 ++++++++++--

diffs (31 lines):

diff -r 20e6fa42d081 -r 2b6107437df3 src/lib-storage/index/shared/shared-storage.c
--- 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 @@ int shared_storage_get_namespace(struct 
 	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 @@ int shared_storage_get_namespace(struct 
 		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;


More information about the dovecot-cvs mailing list