ssize_t end;
char *spaces, *text;
+ ERROR("INPUT %s", ptr);
+
/*
* Parse the condition. If it succeeded, stop
* trying to expand the buffer.
*/
slen = fr_cond_tokenize(cs, &cond,
- &t_rules, &FR_SBUFF_IN(ptr, strlen(ptr)));
+ &t_rules, &FR_SBUFF_IN(ptr, strlen(ptr)), true);
if (slen > 0) break;
end = -slen;
* condition, expand the variables, and reparse the
* condition.
*/
- if (strchr(ptr, '$') != NULL) {
+ {
ssize_t my_slen;
talloc_free(cond);
return NULL;
}
- my_slen = fr_cond_tokenize(cs, &cond, &t_rules, &FR_SBUFF_IN(buff[3], strlen(buff[3])));
+ my_slen = fr_cond_tokenize(cs, &cond, &t_rules, &FR_SBUFF_IN(buff[3], strlen(buff[3])), false);
if (my_slen <= 0) {
ptr = buff[3];
slen = my_slen;
slen = my_slen;
goto parse_error;
}
- } else {
- ssize_t my_slen;
-
- my_slen = xlat_tokenize_expression(cs, &head, &FR_SBUFF_IN(buff[2], strlen(buff[2])), &p_rules, &t_rules);
- if (my_slen <= 0) {
- ptr = buff[2];
- slen = my_slen;
- goto parse_error;
- }
#endif
}
fr_cond_t *cond;
} fr_cond_iter_t;
-ssize_t fr_cond_tokenize(CONF_SECTION *cs, fr_cond_t **head, tmpl_rules_t const *rules, fr_sbuff_t *in) CC_HINT(nonnull(1,2,4));
+ssize_t fr_cond_tokenize(CONF_SECTION *cs, fr_cond_t **head, tmpl_rules_t const *rules, fr_sbuff_t *in, bool flag) CC_HINT(nonnull(1,2,4));
-int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs, fr_sbuff_marker_t *m_rhs) CC_HINT(nonnull(1));
+int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs, fr_sbuff_marker_t *m_rhs, bool flag) CC_HINT(nonnull(1));
ssize_t cond_print(fr_sbuff_t *out, fr_cond_t const *c);
/** Promote the types in a FOO OP BAR comparison.
*
*/
-int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs, fr_sbuff_marker_t *m_rhs)
+int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs, fr_sbuff_marker_t *m_rhs, bool flag)
{
fr_type_t lhs_type, rhs_type;
fr_type_t cast_type;
}
}
+ /*
+ * Skip casting.
+ */
+ if (flag) return 0;
+
/*
* Cast both sides to the promoted type.
*/
* @param[in] in the start of the string to process. Should be "(..."
* @param[in] brace look for a closing brace (how many deep we are)
* @param[in] t_rules for attribute parsing
+ * @param[in] flag temporary hack
* @return
* - Length of the string skipped.
* - < 0 (the offset to the offending error) on error.
*/
static ssize_t cond_tokenize(TALLOC_CTX *ctx, fr_cond_t **out,
CONF_SECTION *cs, fr_sbuff_t *in, int brace,
- tmpl_rules_t const *t_rules)
+ tmpl_rules_t const *t_rules, bool flag)
{
fr_sbuff_t our_in = FR_SBUFF(in);
ssize_t slen;
/*
* Children are allocated from the parent.
*/
- slen = cond_tokenize(c, &c->data.child, cs, &our_in, brace + 1, t_rules);
+ slen = cond_tokenize(c, &c->data.child, cs, &our_in, brace + 1, t_rules, flag);
if (slen <= 0) {
fr_sbuff_advance(&our_in, slen * -1);
goto error;
* Promote the data types to the appropriate
* values.
*/
- if (fr_cond_promote_types(c, &our_in, &m_lhs, &m_rhs) < 0) {
+ if (fr_cond_promote_types(c, &our_in, &m_lhs, &m_rhs, flag) < 0) {
goto error;
}
} /* parse OP RHS */
* siblings are allocated from their older
* siblings.
*/
- slen = cond_tokenize(child, &child->next, cs, &our_in, brace, t_rules);
+ slen = cond_tokenize(child, &child->next, cs, &our_in, brace, t_rules, flag);
if (slen <= 0) {
fr_sbuff_advance(&our_in, slen * -1);
goto error;
* siblings are allocated from their older
* siblings.
*/
- slen = cond_tokenize(c, &c->next, cs, &our_in, brace, t_rules);
+ slen = cond_tokenize(c, &c->next, cs, &our_in, brace, t_rules, flag);
if (slen <= 0) {
fr_sbuff_advance(&our_in, slen * -1);
goto error;
* @param[out] head the parsed condition structure
* @param[in] rules for parsing operands.
* @param[in] in the start of the string to process.
+ * @param[in] flag temporary hack
* @return
* - Length of the string skipped.
* - < 0 (the offset to the offending error) on error.
*/
-ssize_t fr_cond_tokenize(CONF_SECTION *cs, fr_cond_t **head, tmpl_rules_t const *rules, fr_sbuff_t *in)
+ssize_t fr_cond_tokenize(CONF_SECTION *cs, fr_cond_t **head, tmpl_rules_t const *rules, fr_sbuff_t *in, bool flag)
{
ssize_t slen;
fr_sbuff_t our_in = FR_SBUFF(in);
*head = NULL;
- slen = cond_tokenize(cs, head, cs, &our_in, 0, rules);
+ slen = cond_tokenize(cs, head, cs, &our_in, 0, rules, flag);
if (slen <= 0) return slen;
/*