rewrite or unlang problem

Libor Astalos astli at seznam.cz
Fri Dec 18 21:54:51 CET 2009


Hi I'm trying to change access-request:

rad_recv: Access-Request packet from host 192.168.3.171 port 39838, id=98, length=142
	NAS-Port-Type = Ethernet
	NAS-Port = 2200961369
	Calling-Station-Id = "1:0:24:81:44:41:1f"
	Called-Station-Id = "dhcp1"
	User-Name = "00:24:81:44:41:1F"
	User-Password = ""
	Agent-Remote-Id = "\000\006\000\025w\262\234\260"
	Agent-Circuit-Id = "\000\004\000\001\001\013"
	NAS-Identifier = "MikroTik"
	NAS-IP-Address = 192.168.3.171

I need to change User-Name similar to this statement:

update request {
   User-Name := %{request:Agent-Remote-Id}
}

but radiusd prints this: expand: %{User-Name} -> %{request:Agent-Remote-Id} and is searching in sql this string, not correct "\000\006\000\025w\262\234\260"

Is there a way to reach this issue in freeradius similar to gnu-radius as shown below?

string
decode_agent_remote_id()
{
        string agent;
        string newagent;

        agent = gsub("%"," ",tohex(%[Agent-Remote-Id]));

        newagent =field(agent,3)+":"+field(agent,4)+":"+field(agent,5)+":"+field(agent,6)+":"+field(agent,7)+":"+field(agent,8);
        %[Orig-User-Name] = %[User-Name];
        %[User-Name] = newagent+"port:"+field(gsub("%","",tohex(%[Agent-Circuit-Id])),6);
        return 0;
} 

thanks for advice

Libor



More information about the Freeradius-Users mailing list