From 02ea25516886d5f305b416442fca51802bd16f46 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Thu, 23 Jul 2026 13:29:15 +0200 Subject: [PATCH] %log.destination() doesn't _require_ a file. --- src/lib/unlang/xlat_builtin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index 9fe562db11b..f2e04d316d0 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -1384,11 +1384,16 @@ static xlat_action_t xlat_func_log_dst(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor MEM(dbg = talloc_memdup(request, log, sizeof(*log))); dbg->parent = log; + /* + * If we have a filename passed to us, then it over-rides + * the one in the "log foo { ... }" destination. + */ + if (file) MEM(dbg->file = talloc_strdup(dbg, file->vb_strvalue)); + /* * Open the new filename. */ dbg->dst = L_DST_FILES; - dbg->file = talloc_strdup(dbg, file->vb_strvalue); dbg->fd = open(dbg->file, O_WRONLY | O_CREAT | O_CLOEXEC, 0600); if (dbg->fd < 0) { REDEBUG("Failed opening %s - %s", dbg->file, fr_syserror(errno)); -- 2.47.3