Translate characters

Alan DeKok aland at deployingradius.com
Fri May 4 16:16:15 CEST 2012


Xbert_badstuber wrote:
> Is there anything I can do in the freeradius to change the characters to
> different ones? Example: To make “/” as “-“ and “:” as “_”. So the
> NAS-Port-ID would look like “1-1-4_1001.129” instead. Is it possible to
> translate characters in Freeradius? If possible, how do i make it?

  You can't translate the characters, but you can re-write the
attribute.  I'd use a regex:

	if (NAS-Port-Id =~ /^(.)/(.)/(.):(.*)$/) {
		update request {
			NAS-Port-Id := "%1_%2_%3_%4"
		}
	}

  You may have to play with the regex to get it to match your exact
case, but the idea is there.

  Alan DeKok.


More information about the Freeradius-Users mailing list