]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
no need to call cond_eval_map()
authorAlan T. DeKok <aland@freeradius.org>
Mon, 29 Mar 2021 19:06:25 +0000 (15:06 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 Mar 2021 15:12:33 +0000 (16:12 +0100)
src/lib/server/cond_tokenize.c
src/lib/unlang/switch.c

index ad7b709210673c2c41ea023752748cf6bcf763f3..6f5e19818dd33bf99626701629f68fee6a12df76 100644 (file)
@@ -658,15 +658,19 @@ static int cond_normalise(TALLOC_CTX *ctx, fr_token_t lhs_type, fr_cond_t **c_ou
                    tmpl_is_data(c->data.map->rhs)) {
                        int rcode;
 
-                       rcode = cond_eval_map(NULL, 0, c);
+                       fr_assert(c->next == NULL);
+
+                       rcode = cond_eval(NULL, RLM_MODULE_NOOP, c);
+                       fr_assert(rcode >= 0);
                        TALLOC_FREE(c->data.map);
 
-                       if (rcode) {
+                       if (rcode > 0) {
                                c->type = COND_TYPE_TRUE;
                        } else {
                                c->type = COND_TYPE_FALSE;
                        }
 
+                       c->negate = false;
                        goto check_true; /* it's no longer a map */
                }
 
index de731dfdfc5277f0cd2e9d7c52b01e3fde60bf21..0327a1d3cfa6c31db70565c59db38e7e5f0440f8 100644 (file)
@@ -147,7 +147,7 @@ static unlang_action_t unlang_switch(rlm_rcode_t *p_result, request_t *request,
                 *
                 *      Note that we don't need to do any casting of the RHS
                 */
-               if (cond_eval_map(request, 0, &cond) == 1) {
+               if (cond_eval(request, RLM_MODULE_NOOP, &cond) == 1) {
                        found = this;
                        break;
                }