Re: Help with attr_rewrite/regexp

2005-03-24 Thread Alan DeKok
David Manchado [EMAIL PROTECTED] wrote:
 I'm trying to rewrite User-Name attribute with attr_rewrite with no success.

  It's a bug in attr_rewrite.  The CVS snapshot from tomorrow has the
fix.

  Alan DeKok.


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Help with attr_rewrite/regexp

2005-03-23 Thread David Manchado
Hello,

I'm trying to rewrite User-Name attribute with attr_rewrite with no success.

What I want to do is to rewrite the username in the form 
[EMAIL PROTECTED] into [EMAIL PROTECTED] due to 
limitations on the provider (let's say each realm has a charge ;D)

If the problem is the delimitator character - there is no problem in using 
another or also to use one for separate service from access and access from 
username.

The main attr_rewrite config is:

attr_rewrite rw-rlm_services {
attribute = User-Name
# may be packet, reply, proxy, proxy_reply or config
searchin = packet
searchfor = see below
replacewith = service %{1} - access %{2} - username %{3} - realm 
%{4}
ignore_case = yes
new_attribute = no
max_matches = 10
## If set to yes then the replace string will be appended to the 
original string
append = no
}


I've been trying the following regexp for searchfor parameter and the result 
for replacewith (always service %{1} - access %{2} - username %{3} - realm 
%{4} for debugging) is also attached:

* ^(\\w*)\\-(\\w*)\\-((\\w*)[(\\.\\w*)?]*)@(\\w*)$
[EMAIL PROTECTED]' to 'service service - access access-usernam - 
username [EMAIL PROTECTED] - realm  '

* ^(\\w*)\\-(\\w*)\\-(\\w*)@(\\w*)$
'[EMAIL PROTECTED]' to 'service service - access access-usernam - 
username [EMAIL PROTECTED] - realm  '

* ^(\\w*)\\-(\\w*)\\-(\\w*)\\@(\\w*)$
'[EMAIL PROTECTED]' to 'service service - access access-usernam - 
username [EMAIL PROTECTED] - realm  '

* ^(\\w*)-(\\w*)-(\\w*)@(\\w*)$
'[EMAIL PROTECTED]' to 'service service - access access-usernam - 
username [EMAIL PROTECTED] - realm  '

* ^(.*)-(.*)-(.*)@(.*)$
'[EMAIL PROTECTED]' to 'service service - access access-usernam - 
username [EMAIL PROTECTED] - realm  '

I'm always getting the same result, I've checked the regexp in regexp editor 
and it seems to be ok but it does not work.

Here you are other tests in order to try to understand the behaviour
* ^(.*)-(.*)$
'[EMAIL PROTECTED]' to 'service service-access - access 
[EMAIL PROTECTED] - username  - realm  '

* ^(.*)@(.*)$
'[EMAIL PROTECTED]' to 'service service-access_username - access 
realm - username  - realm '

Any help would be appreciated.

Thanks!
-- 
David Manchado

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html