dynamically selecting, which attribute to evaluate

Stefan A. a.freeradius at premit.de
Wed Dec 1 12:21:48 CET 2010


Hello,

I'm trying to dynamically select Attributes to check their values.

I have an application, which puts attribute (representing Prepaid Tickets)
into the Accept table.

All possible TicketTypes are defined in the dictionary.

Example: Ticket245-trigger-reactivation = 200



Depending on different other attributes, I have to check this attribute.


In /sites-available/default I have the following Lines


1. to select the TicketType:

	If (.....){
		update control {
 			TicketType	:= "Ticket245"
		}
	}

and then to evaluate TicetType specific Attributes...

	if ("reply:%{control:TicketType}-trigger-reactivation" != ""){
		do something
	}


This will evaluate to true forever because it is not empty...
	"reply:Ticket245-trigger-reactivation" != ""  



If I change this to 
	If ("%{reply:%{control:TicketType}-trigger-reactivation}"!= ""){
		do something
	}

It evaluates to False:
++? if ("%{reply:%{control:TicketType}-trigger-reactivation}" != "")
        expand: %{reply:%{control:TicketType}-trigger-reactivation} ->

Why does it not expand the %{control:TicketType} to Ticket245 in this
situation?



If I omit the outer "":

	if (%{reply:%{control:TicketType}-trigger-reactivation} != ""){
		do something
	}
I will get this error while loading the configuration:

Bare %{...} is invalid in condition at:
%{reply:%{control:VolumeBucket}-trigger-reactivation})


How may I dynamically select Attributes to check for?



Thanks for a hint.
Regards
Stefan





More information about the Freeradius-Users mailing list