]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
hoist checks to common code
authorAlan T. DeKok <aland@freeradius.org>
Fri, 8 Jan 2021 16:31:43 +0000 (11:31 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 9 Jan 2021 20:02:17 +0000 (15:02 -0500)
src/lib/server/cond_tokenize.c

index 81cd7826d2d3c2216668d4407609131470225640..2691b27c5d2b2334466ab7a494b698d92be8c763 100644 (file)
@@ -1082,7 +1082,7 @@ static int cond_forbid_groups(tmpl_t *vpt, fr_sbuff_t *in, fr_sbuff_marker_t *m_
        return 0;
 }
 
-static ssize_t cond_tokenize_operand(TALLOC_CTX *ctx, tmpl_t **out,
+static ssize_t cond_tokenize_operand(fr_cond_t *c, tmpl_t **out,
                                     fr_sbuff_marker_t *opd_start, fr_sbuff_t *in,
                                     tmpl_rules_t const *rules)
 {
@@ -1160,7 +1160,7 @@ static ssize_t cond_tokenize_operand(TALLOC_CTX *ctx, tmpl_t **out,
 #endif
        }
 
-       slen = tmpl_afrom_substr(ctx, &vpt, &our_in, type, p_rules, rules);
+       slen = tmpl_afrom_substr(c, &vpt, &our_in, type, p_rules, rules);
        if (!vpt) {
                fr_sbuff_advance(&our_in, slen * -1);
 
@@ -1227,6 +1227,8 @@ static ssize_t cond_tokenize_operand(TALLOC_CTX *ctx, tmpl_t **out,
                goto error;
        }
 
+       if (tmpl_is_attr_unresolved(vpt)) c->pass2_fixup = PASS2_FIXUP_ATTR;
+
        *out = vpt;
 
        fr_sbuff_marker(opd_start, in);
@@ -1331,7 +1333,6 @@ static ssize_t cond_tokenize(TALLOC_CTX *ctx, fr_cond_t **out,
                fr_sbuff_advance(&our_in, slen * -1);
                goto error;
        }
-       if (tmpl_is_attr_unresolved(lhs)) c->pass2_fixup = PASS2_FIXUP_ATTR;
 
 #ifdef HAVE_REGEX
        /*
@@ -1489,7 +1490,6 @@ static ssize_t cond_tokenize(TALLOC_CTX *ctx, fr_cond_t **out,
                        fr_sbuff_advance(&our_in, slen * -1);
                        goto error;
                }
-               if (tmpl_is_attr_unresolved(rhs)) c->pass2_fixup = PASS2_FIXUP_ATTR;
 
                /*
                 *      Groups can't be on the RHS of a comparison, either