From: Timo Sirainen Date: Wed, 8 Apr 2009 02:17:36 +0000 (-0400) Subject: settings_parser_info.check_func() now gets pool parameter if it wants to change settings. X-Git-Tag: 2.0.alpha1~1007 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d63b4241643b6014d49ff356f14e0f3ee43068a8;p=thirdparty%2Fdovecot%2Fcore.git settings_parser_info.check_func() now gets pool parameter if it wants to change settings. --HG-- branch : HEAD --- diff --git a/src/auth/auth-settings.c b/src/auth/auth-settings.c index 16745ba237..fe9fd62f93 100644 --- a/src/auth/auth-settings.c +++ b/src/auth/auth-settings.c @@ -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) } /* */ -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); diff --git a/src/config/config-parser.c b/src/config/config-parser.c index a11b2cd567..39c45aa7f8 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -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); } diff --git a/src/imap/imap-settings.c b/src/imap/imap-settings.c index 95aa6e8ba9..d2dfb5cd3e 100644 --- a/src/imap/imap-settings.c +++ b/src/imap/imap-settings.c @@ -9,7 +9,7 @@ #include #include -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) } /* */ -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); diff --git a/src/lib-settings/settings-parser.c b/src/lib-settings/settings-parser.c index 7fbbbb755e..3b43e0365a 100644 --- a/src/lib-settings/settings-parser.c +++ b/src/lib-settings/settings-parser.c @@ -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; diff --git a/src/lib-settings/settings-parser.h b/src/lib-settings/settings-parser.h index 5d6fdcad0e..0efe10add3 100644 --- a/src/lib-settings/settings-parser.h +++ b/src/lib-settings/settings-parser.h @@ -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. */ diff --git a/src/lib-storage/mail-storage-settings.c b/src/lib-storage/mail-storage-settings.c index c5a287640f..e72b866940 100644 --- a/src/lib-storage/mail-storage-settings.c +++ b/src/lib-storage/mail-storage-settings.c @@ -11,8 +11,8 @@ #include -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) } /* */ -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; diff --git a/src/login-common/login-settings.c b/src/login-common/login-settings.c index 61784bc132..3ec2cd8262 100644 --- a/src/login-common/login-settings.c +++ b/src/login-common/login-settings.c @@ -7,7 +7,7 @@ #include #include -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); diff --git a/src/pop3/pop3-settings.c b/src/pop3/pop3-settings.c index c5ac88bd57..5e6017bcae 100644 --- a/src/pop3/pop3-settings.c +++ b/src/pop3/pop3-settings.c @@ -9,7 +9,7 @@ #include #include -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) } /* */ -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);