]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
settings_parser_info.check_func() now gets pool parameter if it wants to change settings.
authorTimo Sirainen <tss@iki.fi>
Wed, 8 Apr 2009 02:17:36 +0000 (22:17 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 8 Apr 2009 02:17:36 +0000 (22:17 -0400)
--HG--
branch : HEAD

src/auth/auth-settings.c
src/config/config-parser.c
src/imap/imap-settings.c
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h
src/lib-storage/mail-storage-settings.c
src/login-common/login-settings.c
src/pop3/pop3-settings.c

index 16745ba237b0da2fdf151c9aae811342972c9c2c..fe9fd62f9397bba90539c0afec0f2ec77cf4091a 100644 (file)
@@ -12,7 +12,7 @@ extern struct setting_parser_info auth_socket_setting_parser_info;
 extern struct setting_parser_info auth_setting_parser_info;
 extern struct setting_parser_info auth_root_setting_parser_info;
 
-static bool auth_settings_check(void *_set, const char **error_r);
+static bool auth_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #define DEF(type, name) \
@@ -287,7 +287,7 @@ static void fix_base_path(struct auth_settings *set, const char **str)
 }
 
 /* <settings checks> */
-static bool auth_settings_check(void *_set ATTR_UNUSED,
+static bool auth_settings_check(void *_set ATTR_UNUSED, pool_t pool ATTR_UNUSED,
                                const char **error_r ATTR_UNUSED)
 {
 #ifndef CONFIG_BINARY
@@ -341,7 +341,7 @@ struct auth_settings *auth_settings_read(const char *name)
                        settings_parser_get_error(parser));
        }
 
-       if (settings_parser_check(parser, &error) < 0)
+       if (settings_parser_check(parser, settings_pool, &error) < 0)
                i_fatal("Invalid settings: %s", error);
 
        set = settings_parser_get(parser);
index a11b2cd5673143790a3e8e4703508cdceb39ac3a..39c45aa7f8f52169a24f6626ef953a12f288551d 100644 (file)
@@ -526,7 +526,7 @@ prevfile:
                if (l->parser == NULL)
                        continue;
 
-               if (!settings_parser_check(l->parser, &errormsg)) {
+               if (!settings_parser_check(l->parser, pool, &errormsg)) {
                        i_fatal("Error in configuration file %s: %s",
                                path, errormsg);
                }
index 95aa6e8ba95d00f526a7a12bf989b03894dce96b..d2dfb5cd3e120b2a251b8a28e21a8274abd53b0d 100644 (file)
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-static bool imap_settings_check(void *_set, const char **error_r);
+static bool imap_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #undef DEFLIST
@@ -85,7 +85,8 @@ static void fix_base_path(struct imap_settings *set, const char **str)
 }
 
 /* <settings checks> */
-static bool imap_settings_check(void *_set, const char **error_r)
+static bool imap_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+                               const char **error_r)
 {
        struct imap_settings *set = _set;
 
@@ -157,7 +158,7 @@ void imap_settings_read(const struct imap_settings **set_r,
        if (value != NULL)
                parse_expand_vars(parser, value);
 
-       if (settings_parser_check(parser, &error) < 0)
+       if (settings_parser_check(parser, settings_pool, &error) < 0)
                i_fatal("Invalid settings: %s", error);
 
        sets = settings_parser_get_list(parser);
index 7fbbbb755eba0af11d902393ba6f31ed87f56a24..3b43e0365ae19ed0205e702c4d26ad62d79308e7 100644 (file)
@@ -642,8 +642,9 @@ int settings_parse_exec(struct setting_parser_context *ctx,
        return ret;
 }
 
-static bool settings_parser_check_info(const struct setting_parser_info *info,
-                                      void *set, const char **error_r)
+static bool
+settings_parser_check_info(const struct setting_parser_info *info, pool_t pool,
+                          void *set, const char **error_r)
 {
        const struct setting_define *def;
        const ARRAY_TYPE(void_array) *val;
@@ -651,7 +652,7 @@ static bool settings_parser_check_info(const struct setting_parser_info *info,
        unsigned int i, count;
 
        if (info->check_func != NULL) {
-               if (!info->check_func(set, error_r))
+               if (!info->check_func(set, pool, error_r))
                        return FALSE;
        }
 
@@ -665,7 +666,7 @@ static bool settings_parser_check_info(const struct setting_parser_info *info,
 
                children = array_get(val, &count);
                for (i = 0; i < count; i++) {
-                       if (!settings_parser_check_info(def->list_info,
+                       if (!settings_parser_check_info(def->list_info, pool,
                                                        children[i], error_r))
                                return FALSE;
                }
@@ -673,13 +674,13 @@ static bool settings_parser_check_info(const struct setting_parser_info *info,
        return TRUE;
 }
 
-bool settings_parser_check(struct setting_parser_context *ctx,
+bool settings_parser_check(struct setting_parser_context *ctx, pool_t pool,
                           const char **error_r)
 {
        unsigned int i;
 
        for (i = 0; i < ctx->root_count; i++) {
-               if (!settings_parser_check_info(ctx->roots[i].info,
+               if (!settings_parser_check_info(ctx->roots[i].info, pool,
                                                ctx->roots[i].set_struct,
                                                error_r))
                    return FALSE;
index 5d6fdcad0e49c1f4d86966cf5e5840cda12df187..0efe10add372076f0bcb71316dad363eb1d2d59e 100644 (file)
@@ -57,7 +57,7 @@ struct setting_parser_info {
        size_t parent_offset;
        size_t type_offset;
        size_t struct_size;
-       bool (*check_func)(void *set, const char **error_r);
+       bool (*check_func)(void *set, pool_t pool, const char **error_r);
 };
 ARRAY_DEFINE_TYPE(setting_parser_info, struct setting_parser_info);
 
@@ -120,7 +120,7 @@ int settings_parse_exec(struct setting_parser_context *ctx,
                        const char *bin_path, const char *config_path,
                        const char *service);
 /* Call all check_func()s to see if currently parsed settings are valid. */
-bool settings_parser_check(struct setting_parser_context *ctx,
+bool settings_parser_check(struct setting_parser_context *ctx, pool_t pool,
                           const char **error_r);
 
 /* While parsing values, specifies if STR_VARS strings are already expanded. */
index c5a287640fa866234c51b27e171733c612e8b2a7..e72b866940bbdecc72b9dc93568c1901bf383fcc 100644 (file)
@@ -11,8 +11,8 @@
 
 #include <stddef.h>
 
-static bool mail_storage_settings_check(void *_set, const char **error_r);
-static bool namespace_settings_check(void *_set, const char **error_r);
+static bool mail_storage_settings_check(void *_set, pool_t pool, const char **error_r);
+static bool namespace_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #define DEF(type, name) \
@@ -213,7 +213,8 @@ void mail_storage_namespace_defines_init(pool_t pool)
 }
 
 /* <settings checks> */
-static bool mail_storage_settings_check(void *_set, const char **error_r)
+static bool mail_storage_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+                                       const char **error_r)
 {
        const struct mail_storage_settings *set = _set;
 
@@ -228,7 +229,8 @@ static bool mail_storage_settings_check(void *_set, const char **error_r)
        return TRUE;
 }
 
-static bool namespace_settings_check(void *_set, const char **error_r)
+static bool namespace_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+                                    const char **error_r)
 {
        struct mail_namespace_settings *ns = _set;
        struct mail_namespace_settings *const *namespaces;
index 61784bc1325222f79229dcf9adfe0999fabac5f8..3ec2cd82621e7931308b9d11bf7cb0073421bfc4 100644 (file)
@@ -7,7 +7,7 @@
 #include <stddef.h>
 #include <unistd.h>
 
-static bool login_settings_check(void *_set, const char **error_r);
+static bool login_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #define DEF(type, name) \
@@ -137,7 +137,8 @@ static int ssl_settings_check(void *_set ATTR_UNUSED, const char **error_r)
 #endif
 }
 
-static bool login_settings_check(void *_set, const char **error_r)
+static bool login_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+                                const char **error_r)
 {
        struct login_settings *set = _set;
 
@@ -191,7 +192,7 @@ struct login_settings *login_settings_read(void)
                        settings_parser_get_error(parser));
        }
 
-       if (settings_parser_check(parser, &error) < 0)
+       if (settings_parser_check(parser, settings_pool, &error) < 0)
                i_fatal("Invalid settings: %s", error);
 
        set = settings_parser_get(parser);
index c5ac88bd57bc59299ec63592c8ef1f6b2dc09bcb..5e6017bcaef4073682b7b8c1013fd0a4a21c5e0e 100644 (file)
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-static bool pop3_settings_check(void *_set, const char **error_r);
+static bool pop3_settings_check(void *_set, pool_t pool, const char **error_r);
 
 #undef DEF
 #undef DEFLIST
@@ -84,7 +84,8 @@ static void fix_base_path(struct pop3_settings *set, const char **str)
 }
 
 /* <settings checks> */
-static bool pop3_settings_check(void *_set, const char **error_r)
+static bool pop3_settings_check(void *_set, pool_t pool ATTR_UNUSED,
+                               const char **error_r)
 {
        struct pop3_settings *set = _set;
 
@@ -156,7 +157,7 @@ void pop3_settings_read(const struct pop3_settings **set_r,
        if (value != NULL)
                parse_expand_vars(parser, value);
 
-       if (settings_parser_check(parser, &error) < 0)
+       if (settings_parser_check(parser, settings_pool, &error) < 0)
                i_fatal("Invalid settings: %s", error);
 
        sets = settings_parser_get_list(parser);