Help with attr_rewrite/regexp

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 ...


Go Back   Usenet Forums > Networking and Network Related > FreeRADIUS Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-23-2005
David Manchado
 
Posts: n/a
Default Help with attr_rewrite/regexp

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:57 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0