]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Fix crash when using %variables in SET_FILE type settings
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 11 Jul 2025 11:08:06 +0000 (14:08 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 11 Jul 2025 11:24:06 +0000 (14:24 +0300)
For example this prevented using:

crypt_global_public_key_file = %{userdb:public_file}

src/lib-settings/settings.c

index 72126555b2b70ed6c767e80f8e6d990f501bb4b1..64880c6fb9b17b8a40ffe21555c488720415be95 100644 (file)
@@ -872,7 +872,10 @@ settings_var_expand(struct settings_apply_ctx *ctx, unsigned int key_idx,
                return 0;
        } else if (ctx->info->defines[key_idx].type == SET_FILE) {
                file.path = str_c(ctx->str);
-               *value = settings_file_get_value(&ctx->mpool->pool, &file);
+               if (settings_parse_read_file(file.path, file.path,
+                                            &ctx->mpool->pool, NULL,
+                                            value, error_r) < 0)
+                       return -1;
        } else {
                *value = p_strdup(&ctx->mpool->pool, str_c(ctx->str));
        }