* There is no longer a need to use `%{expr:..}` to do math in conditions. Using the math in-place will work, as with `if (1 + 2 == 3)`. See xref:unlang/condition/expression.adoc[expressions].
-* If you want to check that an attribute exists _and_ has a particular value, use `if !(&Attr == value)`, instead of `if (&Attr != value)`. The difference us that if the attribute does not exist, it will match the condition `(&Attr != value)`, because the attribute has no value.
-
-// Copyright (C) 2021 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
+// Copyright (C) 2023 Network RADIUS SAS. Licenced under CC-by-NC 4.0.
// This documentation was developed by Network RADIUS SAS.
rcode = fr_value_calc_binary_op(dst, dst, default_type, a, op, b);
if (rcode < 0) {
- RPEDEBUG("Failed calculating result, returning NULL");
- goto done;
+ talloc_free(dst);
+ return XLAT_ACTION_FAIL;
}
/*
*/
if (enumv) dst->enumv = enumv;
-done:
fr_dcursor_append(out, dst);
VALUE_BOX_LIST_VERIFY((fr_value_box_list_t *)out->dlist);
return XLAT_ACTION_DONE;
XLAT_BINARY_FUNC(op_lshift, T_LSHIFT)
static xlat_arg_parser_t const binary_cmp_xlat_args[] = {
- { .required = true, .type = FR_TYPE_VOID },
- { .required = true, .type = FR_TYPE_VOID },
+ { .required = false, .type = FR_TYPE_VOID },
+ { .required = false, .type = FR_TYPE_VOID },
XLAT_ARG_PARSER_TERMINATOR
};
static xlat_action_t xlat_cmp_op(TALLOC_CTX *ctx, fr_dcursor_t *out,
UNUSED xlat_ctx_t const *xctx,
- request_t *request, fr_value_box_list_t *in,
+ UNUSED request_t *request, fr_value_box_list_t *in,
fr_token_t op)
{
int rcode;
rcode = fr_value_calc_list_cmp(dst, dst, &a->vb_group, op, &b->vb_group);
if (rcode < 0) {
talloc_free(dst);
- RPEDEBUG("Failed calculating result, returning fail");
return XLAT_ACTION_FAIL;
}
*/
rcode = fr_value_calc_unary_op(dst, dst, op, vb);
if ((rcode < 0) || fr_type_is_null(dst->type)) {
- RPEDEBUG("Failed calculating result, returning NULL");
- fr_value_box_init_null(dst);
+ talloc_free(dst);
+ return XLAT_ACTION_FAIL;
}
fr_dcursor_append(out, dst);