Skip to content

Commit

Permalink
better handle single-character expansions. Fixes #2216
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Jan 5, 2025
1 parent fe4037f commit 072af4f
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/lib/pair.c
Original file line number Diff line number Diff line change
Expand Up @@ -1905,11 +1905,32 @@ FR_TOKEN fr_pair_raw_from_str(char const **ptr, VALUE_PAIR_RAW *raw)
* Only report as double quoted if it contained valid
* a valid xlat expansion.
*/
raw->quote = T_SINGLE_QUOTED_STRING;
p = strchr(raw->r_opand, '%');
if (p && (p[1] == '{')) {
raw->quote = quote;
} else {
raw->quote = T_SINGLE_QUOTED_STRING;

while (p) {
/*
* %{...}
*/
if (p[1] == '{') {
raw->quote = T_DOUBLE_QUOTED_STRING;
break;
}

/*
* Single-character expansions. See src/main/xlat.c
*/
if (strchr("cdelmntCDGHIMSTYv", p[1])) {
raw->quote = T_DOUBLE_QUOTED_STRING;
break;
}

/*
* Skip %%
*/
if (p[1] == '%') p++;

p = strchr(p + 1, '%');
}

break;
Expand Down

0 comments on commit 072af4f

Please sign in to comment.