fr_strerror_const("Invalid operator");
goto error_adj;
}
-
+
/*
- * This function is ONLY called for legacy operators.
+ * Validate operators for check items.
+ *
+ * We can have comparison operators for reply items, as the rlm_attr_filter module
+ * uses that.
*
- * radius_legacy_map_cmp() and radius_legacy_map_apply() do not support complex
- * comparisons or updates.
+ * However, we can't do comparisons on structural entries, except for existence checks.
*/
- if (tmpl_attr_tail_da_is_structural(map->lhs)) {
- if (fr_comparison_op[map->op]) {
+ if (!parent_p && tmpl_attr_tail_da_is_structural(map->lhs)) {
+ if (fr_comparison_op[map->op] && (map->op != T_OP_CMP_TRUE) && (map->op != T_OP_CMP_FALSE)) {
fr_sbuff_set(&our_in, &m_op);
fr_strerror_const("Comparison operators cannot be used inside of structural data types");
goto error;
case FR_TYPE_STRUCTURAL:
if ((map->op == T_OP_REG_EQ) || (map->op == T_OP_REG_NE)) {
fr_sbuff_set(&our_in, &m_op);
+ fr_assert(0);
fr_strerror_const("Regular expressions cannot be used for structural attributes");
goto error;
}
return -1;
}
+ if (fr_assignment_op[map->op]) {
+ ERROR("%s[%d] Filter %s contains invalid operator '%s'",
+ filename, entry->lineno, map->lhs->name, fr_tokens[map->op]);
+ return -1;
+ }
+
/*
* Make sure that bad things don't happen.
*/
map != NULL;
map = next_map) {
next_map = map_list_next(&entry->reply, map);
-
if (!tmpl_is_attr(map->lhs)) {
ERROR("%s[%d] Left side of reply item %s is not an attribute",
entry->filename, entry->lineno, map->lhs->name);
}
da = tmpl_attr_tail_da(map->lhs);
- if (map->op == T_OP_CMP_FALSE) {
- ERROR("%s[%d] Invalid operator '!*' for reply item %s",
- entry->filename, entry->lineno, map->lhs->name);
+ if (fr_comparison_op[map->op] && (map->op != T_OP_LE) && (map->op != T_OP_GE)) {
+ ERROR("%s[%d] Invalid operator reply item %s %s ...",
+ entry->filename, entry->lineno, map->lhs->name, fr_tokens[map->op]);
return -1;
}
Error-Cause =* ANY,
Reply-Message =* ANY,
Vendor-Specific.Microsoft.CHAP-Error =* ANY,
+ Digest-Attributes =* ANY,
Proxy-State =* ANY,
Error-Cause =* ANY,
User-Name =* ANY,