evaluate.c & strings with "\" in them

Alan DeKok aland at deployingradius.com
Thu Oct 11 14:28:34 CEST 2012


Phil Mayers wrote:
> This seems a bit crazy,

  Yes.

> but is also inconsistent with the "users"-file
> stuff in valuepair.c - this uses radius_xlat (or vp_prints_value
> directly, now) which finishes up in "vp_prints_value(..., -1) which
> means "value verbatim", so doesn't need quad-escaping.

  Yes.

> The fix is pretty simple:
> 
> https://github.com/philmayers/freeradius-server/commit/2695a37464560dbd42b108a46d0fa70ab7ae45af

  Good.

> ...but is sadly not a backwards-compatible change.

  That's fine for 3.0.

> The other thing is, do we actually need to handle "\" inside // at all,
> with the exception of escaping the regex delimiter? Or could we just
> pass "\" straight through to to the regex engine? To give you an idea of
> what I mean (with a bit of extra flags magic too):
> 
> https://github.com/philmayers/freeradius-server/commit/7c322b36d603d0189c729477eab5ef704ba317b0

  Just do:

	if (*p != '/') return getregex2(...);

  And have it do basic checks for sanity.

> The choice of "!" is arbitrary, could be anything, indeed, could be
> selectable sed-style by inspecting the 1st character:

  Yeah.

> ...but letting it be something other than "/" helps avoid leaning
> toothpick syndrome.

  That's nice.

> Thoughts welcome. Just idly playing here really.

  I'ts OK.  I'll do the pull. :)

  Alan DeKok.


More information about the Freeradius-Devel mailing list