From: Arran Cudbard-Bell Date: Wed, 1 Dec 2021 14:29:12 +0000 (-0600) Subject: Descend into unresolved xlat functions too X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18f914916977ff48da02cb5f51628914f77dcb00;p=thirdparty%2Ffreeradius-server.git Descend into unresolved xlat functions too This fixes a bug where xlat functions calls that were children of an unresolved xlat function call were never instantiated, even if that call was later resolved. It presented with crashes when using %{expr:} as that function is registered by a module and is initially unresolved. --- diff --git a/src/lib/unlang/xlat_eval.c b/src/lib/unlang/xlat_eval.c index 7d40cf4848c..7ad123ea2f3 100644 --- a/src/lib/unlang/xlat_eval.c +++ b/src/lib/unlang/xlat_eval.c @@ -2127,6 +2127,21 @@ int xlat_eval_walk(xlat_exp_t *exp, xlat_walker_t walker, xlat_type_t type, void } break; + case XLAT_FUNC_UNRESOLVED: + if (!type || (type & XLAT_FUNC_UNRESOLVED)) { + ret = walker(node, uctx); + if (ret < 0) return ret; + } + + /* + * Now evaluate the function's arguments + */ + if (node->child) { + ret = xlat_eval_walk(node->child, walker, type, uctx); + if (ret < 0) return ret; + } + break; + case XLAT_ALTERNATE: if (!type || (type & XLAT_ALTERNATE)) { ret = walker(node, uctx);