Freeradius not unescaping \ and "

Alan DeKok aland at deployingradius.com
Tue Sep 7 12:37:19 CEST 2010


Murray Long wrote:
> When passing variables to the perl module,
> "void fr_print_string(const char *in, size_t inlen, char *out, size_t outlen)"
> Escapes all special characters (including '\')

  Yes.

> When variables are returned from perl,
> VALUE_PAIR *pairparsevalue(VALUE_PAIR *vp, const char *value)
> unescapes special characters, but ignores "\\"

  ? I'm not sure how you conclude that.  The code in the v2.1.x branch
handles escaping of '\\' for "string" attributes.  See pairparsevalue(),
the "while" loop:

   while (*cp && (length < (sizeof(vp->vp_strvalue) - 1))) {
	char c = *cp++;

	if (c == '\\') {
		switch (*cp) {
			...
			case '\'':
				c = '\'';
				cp++;
				break;
			...

> I've patched the pairparsevalue function to handle an escaped
> backslash, which has solved my problems.  However this is my first
> time looking at freeradius source, so have no idea what knock-on
> effects this will have, so please could someone review this for me.

  What code did you change?

  Alan DeKok.



More information about the Freeradius-Users mailing list