This is a discussion on Help with attr_rewrite/regexp within the FreeRADIUS Users forums, part of the Networking and Network Related category; Hello, I'm trying to rewrite User-Name attribute with attr_rewrite with no success. What I want to do is ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 service-access-username@realm into username@service.access.realm 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*)$" service-access-username@realm' to 'service service - access access-usernam - username username@realm - realm ' * "^(\\w*)\\-(\\w*)\\-(\\w*)@(\\w*)$" 'service-access-username@realm' to 'service service - access access-usernam - username username@realm - realm ' * "^(\\w*)\\-(\\w*)\\-(\\w*)\\@(\\w*)$" 'service-access-username@realm' to 'service service - access access-usernam - username username@realm - realm ' * "^(\\w*)-(\\w*)-(\\w*)@(\\w*)$" 'service-access-username@realm' to 'service service - access access-usernam - username username@realm - realm ' * "^(.*)-(.*)-(.*)@(.*)$" 'service-access-username@realm' to 'service service - access access-usernam - username username@realm - 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 * "^(.*)-(.*)$" 'service-access-username@realm' to 'service service-access - access username@realm - username - realm ' * "^(.*)@(.*)$" 'service-access_username@realm' 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 |