Space after exec module - is it a bug?

Lech Karol Pawłaszek ike at szluug.org
Mon Dec 15 12:55:56 CET 2008


Phil Mayers wrote:
> Lech Karol Pawłaszek wrote:
[...]
>> switch "%{exec:/script %{User-Name}
>> %{outer.request:Calling-Station-Id}" {
> 
> You're missing a closing }
> 
> I suspect this is adding a trailing " " to the output
[...]
>> if ("%{Calling-Station-Id} " == "%{exec:/script2
>> %{Calling-Station-Id}") {
>>     $do_anything
>> }
> 
> Ditto missing } on the %{exec}

Argh! True. However I still have the same symptoms even if I'll put the
missing brace like this:

switch "%{exec:/script %{User-Name} %{outer.request:Calling-Station-Id}}"
[...]

Some logs:

The case when there is no space:
Mon Dec 15 12:51:38 2008 : Auth: Login OK: [test/<via Auth-Type = EAP>]
(from client localhost port 0 via TLS tunnel)
Mon Dec 15 12:51:38 2008 : Info: +- entering group post-auth {...}
Mon Dec 15 12:51:38 2008 : Info: Executing /root/test.py %{User-Name}
%{outer.request:Calling-Station-Id}
Mon Dec 15 12:51:38 2008 : Info: 	expand: %{User-Name} -> test
Mon Dec 15 12:51:38 2008 : Info: 	expand:
%{outer.request:Calling-Station-Id} -> 02-00-00-00-00-01
Mon Dec 15 12:51:38 2008 : Debug: Exec-Program output: 1
Mon Dec 15 12:51:38 2008 : Debug: Exec-Program-Wait: plaintext: 1
Mon Dec 15 12:51:38 2008 : Debug: Exec-Program: returned: 0
Mon Dec 15 12:51:38 2008 : Info: result 0
Mon Dec 15 12:51:38 2008 : Info: 	expand: %{exec:/root/test.py
%{User-Name} %{outer.request:Calling-Station-Id}} -> 1
Mon Dec 15 12:51:38 2008 : Info: ++- entering switch
%{exec:/root/test.py %{User-Name} %{outer.request:Calling-Station-Id}} {...}
Mon Dec 15 12:51:38 2008 : Info: +++- switch %{exec:/root/test.py
%{User-Name} %{outer.request:Calling-Station-Id}} returns noop
Mon Dec 15 12:51:38 2008 : Info: ++- group post-auth returns noop
} # server inner-tunnel
Mon Dec 15 12:51:38 2008 : Info: [peap] Got tunneled reply code 2
	Tunnel-Private-Group-Id:0 = "2000"

(Tunnel-Private-Group-Id = "2000" is the default. It sould be 1999 here
because /root/test.py returned 1)


The case when there is a space:
Mon Dec 15 12:53:04 2008 : Auth: Login OK: [test/<via Auth-Type = EAP>]
(from client localhost port 0 via TLS tunnel)
Mon Dec 15 12:53:04 2008 : Info: +- entering group post-auth {...}
Mon Dec 15 12:53:04 2008 : Info: Executing /root/test.py %{User-Name}
%{outer.request:Calling-Station-Id}
Mon Dec 15 12:53:04 2008 : Info: 	expand: %{User-Name} -> test
Mon Dec 15 12:53:04 2008 : Info: 	expand:
%{outer.request:Calling-Station-Id} -> 02-00-00-00-00-01
Mon Dec 15 12:53:04 2008 : Debug: Exec-Program output: 2
Mon Dec 15 12:53:04 2008 : Debug: Exec-Program-Wait: plaintext: 2
Mon Dec 15 12:53:04 2008 : Debug: Exec-Program: returned: 0
Mon Dec 15 12:53:04 2008 : Info: result 0
Mon Dec 15 12:53:04 2008 : Info: 	expand: %{exec:/root/test.py
%{User-Name} %{outer.request:Calling-Station-Id}} -> 2
Mon Dec 15 12:53:04 2008 : Info: ++- entering switch
%{exec:/root/test.py %{User-Name} %{outer.request:Calling-Station-Id}} {...}
Mon Dec 15 12:53:04 2008 : Info: +++- entering case 2  {...}
Mon Dec 15 12:53:04 2008 : Info: ++++[reply] returns noop
Mon Dec 15 12:53:04 2008 : Info: +++- case 2  returns noop
Mon Dec 15 12:53:04 2008 : Info: ++- switch %{exec:/root/test.py
%{User-Name} %{outer.request:Calling-Station-Id}} returns noop
} # server inner-tunnel
Mon Dec 15 12:53:04 2008 : Info: [peap] Got tunneled reply code 2
	Tunnel-Private-Group-Id:0 = "999"

Kind regards,

-- 
Lech Karol Pawłaszek <ike>
"You will never see me fall from grace" [KoRn]



More information about the Freeradius-Users mailing list