dovecot-2.0: settings: Don't crash if no namespaces or services ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 3 00:45:43 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/0830fbbdfecd
changeset: 9857:0830fbbdfecd
user: Timo Sirainen <tss at iki.fi>
date: Wed Sep 02 17:45:35 2009 -0400
description:
settings: Don't crash if no namespaces or services have been created.
diffstat:
2 files changed, 12 insertions(+), 5 deletions(-)
src/lib-storage/mail-storage-settings.c | 8 +++++++-
src/master/master-settings.c | 9 +++++----
diffs (38 lines):
diff -r 6103d925e018 -r 0830fbbdfecd src/lib-storage/mail-storage-settings.c
--- a/src/lib-storage/mail-storage-settings.c Wed Sep 02 16:48:06 2009 -0400
+++ b/src/lib-storage/mail-storage-settings.c Wed Sep 02 17:45:35 2009 -0400
@@ -347,7 +347,13 @@ static bool namespace_settings_check(voi
}
if (ns->alias_for != NULL) {
- namespaces = array_get(&ns->user_set->namespaces, &count);
+ if (array_is_created(&ns->user_set->namespaces)) {
+ namespaces = array_get(&ns->user_set->namespaces,
+ &count);
+ } else {
+ namespaces = NULL;
+ count = 0;
+ }
for (i = 0; i < count; i++) {
if (strcmp(namespaces[i]->prefix, ns->alias_for) == 0)
break;
diff -r 6103d925e018 -r 0830fbbdfecd src/master/master-settings.c
--- a/src/master/master-settings.c Wed Sep 02 16:48:06 2009 -0400
+++ b/src/master/master-settings.c Wed Sep 02 17:45:35 2009 -0400
@@ -278,11 +278,12 @@ master_settings_verify(void *_set, pool_
/* check that we have at least one service. the actual service
structure validity is checked later while creating them. */
+ if (!array_is_created(&set->services) ||
+ array_count(&set->services) == 0) {
+ *error_r = "No services defined";
+ return FALSE;
+ }
services = array_get(&set->services, &count);
- if (count == 0) {
- *error_r = "No services defined";
- return FALSE;
- }
for (i = 0; i < count; i++) {
if (*services[i]->name == '\0') {
*error_r = t_strdup_printf(
More information about the dovecot-cvs
mailing list