]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: settings_check() now also checks dynamic parsers.
authorTimo Sirainen <tss@iki.fi>
Fri, 25 Jun 2010 14:02:57 +0000 (15:02 +0100)
committerTimo Sirainen <tss@iki.fi>
Fri, 25 Jun 2010 14:02:57 +0000 (15:02 +0100)
--HG--
branch : HEAD

src/lib-settings/settings-parser.c

index 2d4f640bdd0234ecab9ea708cee19241a700a197..fcb225ce9911db48c5f69b8ccf52458cde224000 100644 (file)
@@ -1027,6 +1027,26 @@ int settings_parse_exec(struct setting_parser_context *ctx,
        return ret;
 }
 
+static bool
+settings_check_dynamic(const struct setting_parser_info *info, pool_t pool,
+                      void *set, const char **error_r)
+{
+       unsigned int i;
+
+       if (info->dynamic_parsers == NULL)
+               return TRUE;
+
+       for (i = 0; info->dynamic_parsers[i].name != NULL; i++) {
+               struct dynamic_settings_parser *dyn = &info->dynamic_parsers[i];
+
+               if (!settings_check(dyn->info, pool,
+                                   PTR_OFFSET(set, dyn->struct_offset),
+                                   error_r))
+                       return FALSE;
+       }
+       return TRUE;
+}
+
 bool settings_check(const struct setting_parser_info *info, pool_t pool,
                    void *set, const char **error_r)
 {
@@ -1055,7 +1075,7 @@ bool settings_check(const struct setting_parser_info *info, pool_t pool,
                                return FALSE;
                }
        }
-       return TRUE;
+       return settings_check_dynamic(info, pool, set, error_r);
 }
 
 bool settings_parser_check(struct setting_parser_context *ctx, pool_t pool,