return -1;
}
break;
+ case SET_FILE:
+ break;
case SET_STRLIST:
case SET_BOOLLIST:
case SET_FILTER_ARRAY:
return 0;
}
+static int config_apply_file(struct config_parser_context *ctx,
+ const struct config_line *line,
+ const char *path, const char **output_r)
+{
+ const char *full_path, *error;
+
+ if (path[0] == '\0') {
+ *output_r = "";
+ return 0;
+ }
+ if (!ctx->expand_values) {
+ *output_r = p_strdup(ctx->pool, path);
+ return 0;
+ }
+ full_path = fix_relative_path(path, ctx->cur_input);
+ /* preserve original relative path in doveconf output */
+ if (full_path != path && ctx->expand_values)
+ path = full_path;
+ if (settings_parse_read_file(full_path, path, ctx->pool, output_r, &error) < 0) {
+ ctx->error = p_strdup(ctx->pool, error);
+ if (config_apply_error(ctx, line->key) < 0)
+ return -1;
+ /* delayed error */
+ *output_r = "";
+ }
+ return 0;
+}
+
static int
config_apply_exact_line(struct config_parser_context *ctx,
const struct config_line *line,
&l->settings[config_key->define_idx].array) < 0)
return -1;
break;
+ case SET_FILE:
+ if (config_apply_file(ctx, line, value,
+ &l->settings[config_key->define_idx].str) < 0)
+ return -1;
+ break;
default:
l->settings[config_key->define_idx].str =
p_strdup(ctx->pool, value);
default: {
const char *value = p->settings[i].str;
if (p->info->defines[i].type != SET_STR_NOVARS &&
+ p->info->defines[i].type != SET_FILE &&
strchr(p->settings[i].str, '%') != NULL) {
/* We don't know what the variables would
expand to. */
}
case SET_STR:
case SET_STR_NOVARS:
+ case SET_FILE:
case SET_ENUM: {
const char *const *val = value;
dump = FALSE;
str_truncate(ctx->value, 0);
switch (def->type) {
+ case SET_FILE:
case SET_BOOL:
case SET_SIZE:
case SET_UINT:
type = CONFIG_KEY_NORMAL;
struct config_export_setting export_set = {
.type = type,
+ .def_type = def->type,
.key = def->key,
.key_define_idx = define_idx,
.value = str_c(ctx->value),
switch (set->type) {
case CONFIG_KEY_NORMAL:
- value = p_strdup_printf(ctx->pool, "%s=%s", set->key, set->value);
+ if (set->def_type != SET_FILE)
+ value = set->value;
+ else
+ value = t_strcut(set->value, '\n');
+ value = p_strdup_printf(ctx->pool, "%s=%s", set->key, value);
break;
case CONFIG_KEY_BOOLLIST_ELEM:
/* add list index as the prefix to preserve the configured