Space after exec module - is it a bug?
Phil Mayers
p.mayers at imperial.ac.uk
Mon Dec 15 12:37:23 CET 2008
Lech Karol Pawłaszek wrote:
> Hello.
>
> I've encountered a weird problem. Tested on the newest stable (2.1.3)
> too. Well it's not a problem anymore since I found out a way to make my
> unlangish things work but:
>
> I wanted to check some things in post-auth. I am passing some arguments
> to my script and I want to do something based on the script's output
>
> 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
> case 0 {
> update reply {
> Tunnel-Private-Group-Id := "2000"
> }
> }
> case "1" {
> update reply {
> Tunnel-Private-Group-Id := "1999"
> }
> }
> case "2 " {
> update reply {
> Tunnel-Private-Group-Id := "999"
> }
> }
> }
>
> As you can see it's not a rocket science. script prints a number 0, 1 or
> 2 and exits. What's weird is that only the last case example will work.
> Is this intentional that there has to be a space in case expression?
>
> The same applies to this situation:
>
> if ("%{Calling-Station-Id} " == "%{exec:/script2 %{Calling-Station-Id}") {
> $do_anything
> }
Ditto missing } on the %{exec}
>
> when script2 only prints the argument. Why there is a need for a space?
> It won't work with this expression:
>
> if ("%{Calling-Station-Id}" == "%{exec:/script2 %{Calling-Station-Id}")
> {
> $never_here
> }
>
> Kind regards,
>
> PS script2 looks like this:
>
> #!/usr/bin/python
> import sys
>
> if __name__ == "__main__":
> print sys.argv[1]
>
More information about the Freeradius-Users
mailing list