SET_FLAG_HIDDEN = BIT(0),
};
+enum setting_apply_flags {
+ /* Used when applying override settings (e.g. userdb or -o parameter) */
+ SETTING_APPLY_FLAG_OVERRIDE = BIT(0),
+};
+
#define SETTING_DEFINE_LIST_END { 0, 0, NULL, 0, NULL, NULL }
struct setting_define {
/* This is called for every setting that is parsed. *value is already
the final pointer stored into the settings struct. If it's modified,
- it should usually be allocated from set->pool. override=TRUE for
- settings overridden via userdb/cli. */
+ it should usually be allocated from set->pool. */
bool (*setting_apply)(struct event *event, void *set,
const char *key, const char **value,
- bool override, const char **error_r);
+ enum setting_apply_flags flags, const char **error_r);
/* This is called after %variable expansion. */
bool (*check_func)(void *set, pool_t pool, const char **error_r);
/* The event parameter can be used with settings_get*() to access other
/* call settings_apply() before variable expansion */
if (ctx->info->setting_apply != NULL &&
!ctx->info->setting_apply(ctx->event, ctx->set_struct, key, &value,
- FALSE, error_r)) {
+ 0, error_r)) {
*error_r = t_strdup_printf("Invalid setting %s=%s: %s",
key, orig_value, *error_r);
return -1;
if (ctx->info->setting_apply != NULL &&
!ctx->info->setting_apply(ctx->event, ctx->set_struct, key,
- &value, TRUE, &error))
+ &value,
+ SETTING_APPLY_FLAG_OVERRIDE,
+ &error))
i_panic("BUG: Failed to apply default setting %s=%s: %s",
key, value, error);
}
if (ctx->info->setting_apply != NULL &&
!ctx->info->setting_apply(ctx->event, ctx->set_struct, key,
- &value, TRUE, error_r)) {
+ &value,
+ SETTING_APPLY_FLAG_OVERRIDE,
+ error_r)) {
*error_r = t_strdup_printf(
"Failed to override configuration from %s: "
"Invalid %s=%s: %s",
#include "mail-storage-settings.h"
#include "iostream-ssl.h"
-static bool mail_storage_settings_apply(struct event *event, void *_set, const char *key, const char **value, bool override, const char **error_r);
+static bool mail_storage_settings_apply(struct event *event, void *_set, const char *key, const char **value, enum setting_apply_flags, const char **error_r);
static bool mail_storage_settings_ext_check(struct event *event, void *_set, pool_t pool, const char **error_r);
static bool namespace_settings_ext_check(struct event *event, void *_set, pool_t pool, const char **error_r);
static bool mailbox_settings_check(void *_set, pool_t pool, const char **error_r);
-static bool mail_user_settings_apply(struct event *event, void *_set, const char *key, const char **value, bool override, const char **error_r);
+static bool mail_user_settings_apply(struct event *event, void *_set, const char *key, const char **value, enum setting_apply_flags, const char **error_r);
static bool mail_user_settings_check(void *_set, pool_t pool, const char **error_r);
#undef DEF
static bool
mail_storage_settings_apply(struct event *event ATTR_UNUSED, void *_set,
const char *key, const char **value,
- bool override, const char **error_r ATTR_UNUSED)
+ enum setting_apply_flags flags,
+ const char **error_r ATTR_UNUSED)
{
struct mail_storage_settings *set = _set;
if (strcmp(key, "mail_location") == 0) {
set->unexpanded_mail_location = *value;
- set->unexpanded_mail_location_override = override;
+ set->unexpanded_mail_location_override =
+ (flags & SETTING_APPLY_FLAG_OVERRIDE) != 0;
}
return TRUE;
}
static bool
mail_user_settings_apply(struct event *event ATTR_UNUSED, void *_set,
const char *key, const char **value,
- bool override ATTR_UNUSED,
+ enum setting_apply_flags flags ATTR_UNUSED,
const char **error_r ATTR_UNUSED)
{
struct mail_user_settings *set = _set;