if (t_rules->disallow_filters) {
fr_strerror_const("Filters not allowed here");
if (err) *err = TMPL_ATTR_ERROR_FILTER_NOT_ALLOWED;
- return -1; /* Error at index 0 */
+ fr_sbuff_set_to_start(&our_name);
+ return fr_sbuff_error(&our_name);
}
ar->ar_filter_type = TMPL_ATTR_FILTER_TYPE_INDEX;
int ret;
char *unresolved;
size_t len;
- fr_slen_t slen;
if (depth > FR_DICT_MAX_TLV_STACK) {
fr_strerror_const("Attribute nesting too deep");
.ar_parent = parent,
};
- slen = tmpl_attr_parse_filter(err, ar, name, t_rules);
- if (slen < 0) {
- fr_sbuff_advance(name, -slen);
- goto error;
- }
+ if (tmpl_attr_parse_filter(err, ar, name, t_rules) < 0) goto error;
+
/*
* Insert the ar into the list of attribute references
*/
if (err) *err = TMPL_ATTR_ERROR_NESTING_TOO_DEEP;
error:
fr_sbuff_marker_release(&m_s);
- return -1;
+ return fr_sbuff_error(name);
}
/*
* - The type of attribute.
* - If this is the leaf attribute reference.
*/
- slen = tmpl_attr_parse_filter(err, ar, name, t_rules);
- if (slen < 0) {
- fr_sbuff_advance(name, -slen);
- goto error;
- }
+ if (tmpl_attr_parse_filter(err, ar, name, t_rules) < 0) goto error;
/*
* At the end of the attribute reference. If there's a
} else if (slen > 0) { /* Found a filter */
tmpl_attr_list_insert_tail(&vpt->data.attribute.ar, ar);
} else if (slen < 0) { /* Filter error */
- fr_sbuff_advance(&our_name, -slen);
goto error;
}
vpt->type = TMPL_TYPE_LIST;
}
if (fr_type_is_non_leaf(cast)) {
fr_strerror_printf("Forbidden data type '%s' in cast", fr_type_to_str(cast));
- FR_SBUFF_MARKER_ERROR_RETURN(&m);
+ FR_SBUFF_ERROR_RETURN(&m);
}
if (!fr_sbuff_next_if_char(&our_in, close)) {
/** Return the current position in the sbuff as a negative offset
*
*/
-#define FR_SBUFF_ERROR_RETURN(_sbuff) return -(fr_sbuff_used(_sbuff))
-
-/** Return the current position in the sbuff as a negative offset
- *
- */
-#define FR_SBUFF_MARKER_ERROR_RETURN(_marker) return -(fr_sbuff_used(_marker))
+#define FR_SBUFF_ERROR_RETURN(_sbuff_or_marker) return fr_sbuff_error(_sbuff_or_marker)
/** Return the current adjusted position in the sbuff as a negative offset
*
# user forces incompatible types, then that's an error.
#
condition <ipaddr>&Filter-Id == <blerg>&Framed-IP-Address
-match ERROR offset 23: Unknown data type
+match ERROR offset 24: Unknown data type
condition <blerg>&Filter-Id == "foo"
-match ERROR offset 1: Unknown data type
+match ERROR offset 2: Unknown data type
#
# Normalize things
# Forbidden data types in cast
#
condition (<vsa>"foo" == &User-Name)
-match ERROR offset 2: Forbidden data type 'vsa' in cast
+match ERROR offset 3: Forbidden data type 'vsa' in cast
#
# If the LHS is a cast to a type, and the RHS is an attribute
# Casting attributes of different size
#
condition <ipaddr>&Tmp-uint64-0 == &Framed-IP-Address
-match ERROR offset 8: Cannot cast type 'uint64' to 'ipaddr'
+match ERROR offset 9: Cannot cast type 'uint64' to 'ipaddr'
#
# LHS is a prefix, which _might_ be castable to an address
match true
condition &request.Foo+Bar == 'request.Foo+Bar'
-match ERROR offset 12: Unexpected text after attribute reference
+match ERROR offset 13: Unexpected text after attribute reference
condition 'request.Foo+d' == &request.Foo+Bar
-match ERROR offset 31: Unexpected text after attribute reference
+match ERROR offset 32: Unexpected text after attribute reference
# Attribute tags are not allowed for unknown attributes
condition &request.FooBar:0 == &request.FooBar
-match ERROR offset 15: Unexpected text after attribute reference
+match ERROR offset 16: Unexpected text after attribute reference
condition ¬-a-list:User-Name == ¬-a-list:User-Name
-match ERROR offset 11: Unexpected text after attribute reference
+match ERROR offset 12: Unexpected text after attribute reference
# . is a valid dictionary name attribute, so we can't error out in pass1
condition ¬-a-packet.User-Name == ¬-a-packet.User-Name
# Too many dots, point to the thing that's wrong
condition &Vendor-Specific.WiMAX.Packet-Flow-Descriptor..Uplink-QOS-Id[0]
-match ERROR offset 46: Zero length attribute name: Unresolved attributes are not allowed here
+match ERROR offset 47: Zero length attribute name: Unresolved attributes are not allowed here
# Trailing dots, point to the dot that's an error
condition &Vendor-Specific.WiMAX.Packet-Flow-Descriptor.Uplink-QOS-Id[0].
-match ERROR offset 62: Parent type of nested attribute Uplink-QOS-Id must be of type "struct", "tlv", "vendor", "vsa" or "group", got "uint8"
+match ERROR offset 63: Parent type of nested attribute Uplink-QOS-Id must be of type "struct", "tlv", "vendor", "vsa" or "group", got "uint8"
count
match 19
match ERROR offset 2: Invalid char ' ' in expression
xlat %{\t}
-match ERROR offset 2: Invalid attribute name
+match ERROR offset 3: Invalid attribute name
xlat %{\n}
-match ERROR offset 2: Invalid attribute name
+match ERROR offset 3: Invalid attribute name
xlat %{foo }
match ERROR offset 5: Invalid char ' ' in expression
match ERROR offset 2: No operand found. Expected &ref, literal, 'quoted literal', "%{expansion}", or enum value
xlat_purify ((ok || handled) foo)
-match ERROR offset 17: Invalid operator
+match ERROR offset 18: Invalid operator
# escapes in names are illegal
xlat_purify (ok\ foo || handled)
match (&Service-Type == NULL)
xlat_purify (ok FOO handled)
-match ERROR offset 4: Invalid operator
+match ERROR offset 5: Invalid operator
xlat_purify (ok !x handled)
-match ERROR offset 4: Invalid operator
+match ERROR offset 5: Invalid operator
xlat_purify (ok =x handled)
match ERROR offset 4: Invalid operator
# Casting attributes of different size
#
xlat_purify <ipaddr>&Tmp-uint64-0 == &Framed-IP-Address
-match ERROR offset 8: Cannot cast type 'uint64' to 'ipaddr'
+match ERROR offset 9: Cannot cast type 'uint64' to 'ipaddr'
#
# LHS is a prefix, which _might_ be castable to an address
# This one is really unknown
xlat_purify &26.24757.84.9.5.15 == 0x1a99
-match ERROR offset 17: Unknown attributes not allowed here
+match ERROR offset 18: Unknown attributes not allowed here
#match &Vendor-Specific.WiMAX.Packet-Flow-Descriptor-v2.Classifier.Src-Spec.15 == 0x1a99
#
match true
xlat_purify &request.Foo == 'request.Foo'
-match ERROR offset 9: Attribute 'Foo' not found in namespace 'internal': Unresolved attributes are not allowed here
+match ERROR offset 10: Attribute 'Foo' not found in namespace 'internal': Unresolved attributes are not allowed here
xlat_purify ¬-a-list.User-Name == ¬-a-list.User-Name
-match ERROR offset 1: Attribute 'not' not found. Searched in: RADIUS, internal: Unresolved attributes are not allowed here
+match ERROR offset 2: Attribute 'not' not found. Searched in: RADIUS, internal: Unresolved attributes are not allowed here
# . is a valid dictionary name attribute, so we can't error out in pass1
xlat_purify ¬-a-packet.User-Name == ¬-a-packet.User-Name
-match ERROR offset 1: Attribute 'not' not found. Searched in: RADIUS, internal: Unresolved attributes are not allowed here
+match ERROR offset 2: Attribute 'not' not found. Searched in: RADIUS, internal: Unresolved attributes are not allowed here
#
# The LHS is a string with ASCII 5C 30 30 30 inside of it vs the RHS which should contain ASCII 0.