From: Alan T. DeKok Date: Fri, 18 Jul 2025 14:11:14 +0000 (-0400) Subject: add %test.null() which always returns a value box of FR_TYPE_NULL X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37a3245cb649cf16887778d0ea4f4f3bee942167;p=thirdparty%2Ffreeradius-server.git add %test.null() which always returns a value box of FR_TYPE_NULL --- diff --git a/src/modules/rlm_test/rlm_test.c b/src/modules/rlm_test/rlm_test.c index b479a5d3cf3..a94a3d9d954 100644 --- a/src/modules/rlm_test/rlm_test.c +++ b/src/modules/rlm_test/rlm_test.c @@ -416,6 +416,20 @@ static xlat_action_t test_xlat_fail(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t } +/** Always return a NULL value-box + */ +static xlat_action_t test_xlat_null(TALLOC_CTX *ctx, fr_dcursor_t *out, + UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, + UNUSED fr_value_box_list_t *in) +{ + fr_value_box_t *vb; + + MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_NULL, NULL)); + fr_dcursor_append(out, vb); + + return XLAT_ACTION_DONE; +} + static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx) { rlm_test_t *inst = talloc_get_type_abort(mctx->mi->data, rlm_test_t); @@ -486,6 +500,8 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx) if (!(xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "fail", test_xlat_fail, FR_TYPE_VOID))) return -1; xlat_func_args_set(xlat, test_xlat_fail_args); + if (!module_rlm_xlat_register(mctx->mi->boot, mctx, "null", test_xlat_null, FR_TYPE_VOID)) return -1; + return 0; }