Regular expression - Trying to rewrite User-Name

Guy Fraser guy at incentre.net
Thu May 11 22:31:47 CEST 2006


On Thu, 2006-11-05 at 15:13 -0400, Damian Porter wrote:
>  
> I have bee struggling with problem for a few days now.
>  
> I use Centos 4.3 and freeradius 1.0.1. I am trying to rewrite a
> username to include dashes. see my statement below in the rewrite
> section.
>  
>            searchfor = "([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-
> z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})
>             replacewith = "%{1}-%{2}-%{3}-%{4}-%{5}-%{6}"  
>  
> this is the output that i am getting in my radius.log file. 
> Thu May 11 14:36:24 2006 : Info: rlm_sql_mysql: Starting connect to
> MySQL server for #0
> Thu May 11 14:36:24 2006 : Info: rlm_sql_mysql: Starting connect to
> MySQL server for #1
> Thu May 11 14:36:24 2006 : Info: rlm_sql_mysql: Starting connect to
> MySQL server for #2 
> Thu May 11 14:36:24 2006 : Info: rlm_sql_mysql: Starting connect to
> MySQL server for #3
> Thu May 11 14:36:24 2006 : Info: rlm_sql_mysql: Starting connect to
> MySQL server for #4
> Thu May 11 14:36:24 2006 : Info: Ready to process requests. 
> Thu May 11 14:36:39 2006 : Auth: Login incorrect: [0e35-353afe-3afe19-
> fe19/NOPASSWORD] (from client$
> Thu May 11 14:38:49 2006 : Auth: Login incorrect: [13ce-ce20f9-20f949-
> f949/NOPASSWORD] (from client$
> Thu May 11 14:38:56 2006 : Auth: Login incorrect: [0e35-353ad7-3ad71b-
> d71b/NOPASSWORD] (from client$ 
>  
>  
> PS i have even gone as far as downloading regular expression programs
> to check my code. If anybody has any suggestions or has encounted this
> problem before let me know.

I have no idea if that is supposed to work, but I noticed what appears 
to be a problem:

0e35-353ad7-3ad71b-d71b

Can not be parsed with :

([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})
([a-z0-9]{2})

Because ;
1) 0e35-353ad7-3ad71b-d71b is 24 charcters not 12
2) You have no provisions for '-' characters.

So your search will not get a match.





More information about the Freeradius-Users mailing list