]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Error out if setting tmpl cast failed
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 25 Oct 2021 18:19:24 +0000 (14:19 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 25 Oct 2021 18:19:24 +0000 (14:19 -0400)
src/lib/server/cf_parse.c
src/lib/unlang/compile.c

index 9906522911d7b19a831b968dd528639f6026b493..b374e48ccbbe1d120ef50411d172cfd9b32b5e51 100644 (file)
@@ -254,7 +254,10 @@ int cf_pair_parse_value(TALLOC_CTX *ctx, void *out, UNUSED void *base, CONF_ITEM
                        return -1;
                }
 
-               tmpl_cast_set(vpt, cast);
+               if (tmpl_cast_set(vpt, cast) < 0) {
+                       cf_log_perr(cp, "Failed setting tmpl type");
+                       return -1;
+               }
 
                /*
                 *      Non-blocking xlat's
index 9fb2550a470cad44208b9e1bc9278e2ca85c5a3e..ef35afd051215efb06116014059036babcad719f 100644 (file)
@@ -497,7 +497,10 @@ static bool pass2_fixup_cond_map(fr_cond_t *c, CONF_ITEM *ci, fr_dict_t const *d
        /*
         *      Force the RHS to be cast to whatever the LHS da is.
         */
-       (void) tmpl_cast_set(map->rhs, tmpl_da(map->lhs)->type);
+       if ((tmpl_cast_set(map->rhs, tmpl_da(map->lhs)->type) < 0) ||
+           (tmpl_enumv_set(map->rhs, tmpl_da(map->rhs)) < 0)) {
+               cf_log_perr(map->ci, "Failed setting rhs type");
+       };
 
        if (map->op != T_OP_CMP_EQ) {
                cf_log_err(map->ci, "Must use '==' for comparisons with virtual attribute %s", map->lhs->name);