]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Change variable expansion failure in default settings from panic to...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 21 Dec 2023 20:21:16 +0000 (15:21 -0500)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:10 +0000 (12:34 +0200)
Following commits add %{home} to default settings, which may fail to expand
if home directory isn't set.

src/lib-settings/settings.c

index c7c22f8900f7a0179d1569baecdc899a81fc397b..0c6ba85706b064da2b3bafc846712b636d6008a2 100644 (file)
@@ -608,7 +608,8 @@ settings_mmap_apply_defaults(struct settings_apply_ctx *ctx,
                                                   ctx->func_contexts,
                                                   &error) <= 0 &&
                            (ctx->flags & SETTINGS_GET_FLAG_FAKE_EXPAND) == 0) {
-                               i_panic("BUG: Failed to expand default setting %s=%s variables: %s",
+                               *error_r = t_strdup_printf(
+                                       "Failed to expand default setting %s=%s variables: %s",
                                        key, value, error);
                                return -1;
                        }
@@ -1523,8 +1524,10 @@ settings_instance_override(struct settings_apply_ctx *ctx,
                                                   ctx->func_contexts,
                                                   &error) <= 0 &&
                            (ctx->flags & SETTINGS_GET_FLAG_FAKE_EXPAND) == 0) {
-                               i_panic("BUG: Failed to expand default setting %s=%s variables: %s",
+                               *error_r = t_strdup_printf(
+                                       "Failed to expand default setting %s=%s variables: %s",
                                        key, value, error);
+                               return -1;
                        }
                        value = str_c(ctx->str);
                }