our_lhs_rules = *lhs_rules;
+ /*
+ * Bare words on the LHS are always attributes.
+ *
+ * It doesn't make sense to allow "5 = 4". Or, "5 = NAS-Port".
+ *
+ * The conditions do allow "5 == NAS-Port", but
+ * they use a different parser for that.
+ */
+
+ /*
+ * Absolute references are from the root.
+ */
+ if (!fr_sbuff_next_if_char(&our_in, '.')) {
+ parent = NULL;
+
+ lhs_root:
+ slen = tmpl_afrom_attr_substr(map, NULL, &map->lhs, &our_in,
+ &map_parse_rules_bareword_quoted, &our_lhs_rules);
+ break;
+ }
+
/*
* Allow for ".foo" to refer to the current
* parents list. Allow for "..foo" to refer to
* the grandparent list.
*/
- if (our_lhs_rules.attr.prefix != TMPL_ATTR_REF_PREFIX_YES) {
- /*
- * Absolute references are from the root.
- */
- if (!fr_sbuff_next_if_char(&our_in, '.')) {
- parent = NULL;
- goto lhs_root;
- }
- /*
- * Relative references must have a parent.
- */
+ /*
+ * Relative references must have a parent.
+ */
+ if (!parent) {
+ fr_strerror_const("Unexpected location for relative attribute - no parent attribute exists");
+ goto error;
+ }
+
+ /*
+ * Multiple '.' means "go to our parents parent".
+ */
+ while (fr_sbuff_next_if_char(&our_in, '.')) {
if (!parent) {
- fr_strerror_const("Unexpected location for relative attribute - no parent attribute exists");
+ fr_strerror_const("Too many '.' in relative reference");
goto error;
}
+ parent = parent->parent;
+ }
- /*
- * Multiple '.' means "go to our parents parent".
- */
- while (fr_sbuff_next_if_char(&our_in, '.')) {
- if (!parent) {
- fr_strerror_const("Too many '.' in relative reference");
- goto error;
- }
- parent = parent->parent;
- }
-
- if (!parent) goto lhs_root;
-
- /*
- * Start looking in the correct parent, not in whatever we were handed.
- */
- fr_assert(tmpl_is_attr(parent->lhs));
- our_lhs_rules.attr.namespace = tmpl_attr_tail_da(parent->lhs);
+ if (!parent) goto lhs_root;
- slen = tmpl_afrom_attr_substr(map, NULL, &map->lhs, &our_in,
- &map_parse_rules_bareword_quoted, &our_lhs_rules);
- break;
- }
+ /*
+ * Start looking in the correct parent, not in whatever we were handed.
+ */
+ fr_assert(tmpl_is_attr(parent->lhs));
+ our_lhs_rules.attr.namespace = tmpl_attr_tail_da(parent->lhs);
- lhs_root:
slen = tmpl_afrom_attr_substr(map, NULL, &map->lhs, &our_in,
&map_parse_rules_bareword_quoted, &our_lhs_rules);
break;