]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
settings: Don't crash if no namespaces or services have been created.
authorTimo Sirainen <tss@iki.fi>
Wed, 2 Sep 2009 21:45:35 +0000 (17:45 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 2 Sep 2009 21:45:35 +0000 (17:45 -0400)
--HG--
branch : HEAD

src/lib-storage/mail-storage-settings.c
src/master/master-settings.c

index 2ef4e34daf5755f111187de2ca2c64da9a20eb41..0c3e74f668d008532c95c479b850c90b6cbf545e 100644 (file)
@@ -347,7 +347,13 @@ static bool namespace_settings_check(void *_set, pool_t pool ATTR_UNUSED,
        }
 
        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;
index ed99bc93516e5f2fe490eca2e639536bfb8c9804..b1293262af6d49b7e09adad75cc143f4335670c8 100644 (file)
@@ -278,11 +278,12 @@ master_settings_verify(void *_set, pool_t pool, const char **error_r)
 
        /* check that we have at least one service. the actual service
           structure validity is checked later while creating them. */
-       services = array_get(&set->services, &count);
-       if (count == 0) {
+       if (!array_is_created(&set->services) ||
+           array_count(&set->services) == 0) {
                *error_r = "No services defined";
                return FALSE;
        }
+       services = array_get(&set->services, &count);
        for (i = 0; i < count; i++) {
                if (*services[i]->name == '\0') {
                        *error_r = t_strdup_printf(