]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Fix checking if <path needs to be expanded
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 29 Dec 2016 18:17:57 +0000 (13:17 -0500)
committerGitLab <gitlab@git.dovecot.net>
Mon, 9 Jan 2017 17:33:42 +0000 (19:33 +0200)
src/config/config-parser.c

index 075c91918f87d258bae6f841211eb409ec77bb85..b8578f4785bb4a096b6e3bb2eeb8b06fa42cd77f 100644 (file)
@@ -780,7 +780,7 @@ static int config_write_value(struct config_parser_context *ctx,
        string_t *str = ctx->str;
        const void *var_name, *var_value, *p;
        enum setting_type var_type;
-       const char *error, *path;
+       const char *error, *path, *full_key;
        bool dump, expand_parent;
 
        switch (type) {
@@ -788,15 +788,16 @@ static int config_write_value(struct config_parser_context *ctx,
                str_append(str, value);
                break;
        case CONFIG_LINE_TYPE_KEYFILE:
+               full_key = t_strndup(str_data(ctx->str), str_len(str)-1);
                if (!ctx->expand_values) {
                        str_append_c(str, '<');
                        str_append(str, value);
                } else {
-                       if (!config_require_key(ctx, key)) {
+                       if (!config_require_key(ctx, full_key)) {
                                /* don't even try to open the file */
                        } else {
                                path = fix_relative_path(value, ctx->cur_input);
-                               if (str_append_file(str, key, path, &error) < 0) {
+                               if (str_append_file(str, full_key, path, &error) < 0) {
                                        /* file reading failed */
                                        ctx->error = p_strdup(ctx->pool, error);
                                        return -1;