Skip to content

Commit

Permalink
allow ::name for enum names
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Sep 3, 2023
1 parent f1ee539 commit a428fc9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib/server/tmpl_tokenize.c
Original file line number Diff line number Diff line change
Expand Up @@ -2878,6 +2878,20 @@ fr_slen_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out,
if (fr_sbuff_is_char(&our_in, '&')) return tmpl_afrom_attr_substr(ctx, NULL, out, in,
p_rules, t_rules);

/*
* ::value
*
* Treated as enum name.
*
* @todo - move the enum parsing here, and then unresolved tmpls _always_ become xlat references.
* and when we fix that, change the enum name to include the ::
*/
if (fr_sbuff_is_str_literal(&our_in, "::")) {
(void) fr_sbuff_advance(&our_in, 2);
goto do_enum;
}


/*
* Allow bareword xlats if we
* find a '%' prefix.
Expand Down Expand Up @@ -2995,6 +3009,7 @@ fr_slen_t tmpl_afrom_substr(TALLOC_CTX *ctx, tmpl_t **out,
/*
* Attempt to resolve enumeration values
*/
do_enum:
vpt = tmpl_alloc_null(ctx);

/*
Expand Down
7 changes: 7 additions & 0 deletions src/tests/keywords/enum-name
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
&Service-Type := ::Framed-User

if !(&Service-Type == ::Framed-User) {
test_fail
}

success

0 comments on commit a428fc9

Please sign in to comment.