Spaces in the end of User-Name.

admin bp at iptv.by
Wed Jan 19 12:30:16 CET 2011


Alexander Clouter <alex at digriz.org.uk> писал(а) в своём письме Wed, 19 Jan  
2011 10:54:11 +0200:

> Ideally you should do something like:
> ----
> authorization {
> 	[snipped]
>
> 	if (User-Name =~ /^\s/ || User-Name =~ /\s$/) {
> 		update reply {
> 			Reply-Message := "Remove spaces from User-Name"
> 		}
> 		reject
> 	}
>
> 	[snipped]
> }
> ----

Something doesn't work.

sites-enabled/default:
authorize {
         preprocess
         chap
         mschap
         suffix
         files
         sql
         logintime
         auth
}

radiusd.conf:
exec auth {
    program = "/usr/local/freeradius/run/Money %u %n %{NAS-Port}"
    wait = yes
    input_pairs = request
    shell_escape = yes
    output = no
    output_pairs = reply
}

If I check existence of spaces in User-Name in my program  
/usr/local/freeradius/run/Money all works.
If I insert

if (User-Name =~ /^\s/ || User-Name =~ /\s$/) {
		update reply {
			Reply-Message := "Remove spaces from User-Name"
		}
		reject
}

in section authorize{} in any place the user with spaces in User-Name  
successfully transits authorization.

This unlang-code doesn't work too

if (User-Name =~ /(.+)\s+$/i) {
		update request {
			User-Name := "%{1}"
		}
}

Where I was mistaken?
FreeRADIUS Version 2.1.10





More information about the Freeradius-Users mailing list