Re: how to use exec and expr

This is a discussion on Re: how to use exec and expr within the FreeRADIUS Users forums, part of the Networking and Network Related category; From: "Ming-Ching Tiew" <mingching.tiew@redtone.com> To: <freeradius-users@lists.freeradius.org> ...


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

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2005
Ming-Ching Tiew
 
Posts: n/a
Default Re: how to use exec and expr


From: "Ming-Ching Tiew" <mingching.tiew@redtone.com>
To: <freeradius-users@lists.freeradius.org>
Sent: Tuesday, April 19, 2005 12:53 PM
Subject: how to use exec and expr


>
> I have exec and expr included in the instantiate{}. Then
> in mssql.conf, somewhere in the middle I do this :-
>
> Acct-Authentic = `%{exec: /bin/echo 123}`
>
> Then I checked the database and the log files, the values
> for Acct-Authentic did not change accordingly. What am
> I doing wrong ? I must be understanding something wrongly .....
>


OK I got the attribute changed by using attr_rewrite instead,
for example,

attr_rewrite getip
{
attribute = Acct-Session-Id
# search for IP address aaa.bbb.ccc.ddd
searchfor = ".*[^0-9]\(\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*"
replacewith = "\\1"
append = no
}

The problem I have is the replacewith string. The way I understand it is
that the replace with is a static string. In my case, I would like to
looking for a match in the string, strip everything else except the
matched string.

In shell script, it is something like this :-

.... | sed -e 's/^.*[^0-9]\(\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*$/\1/'

Note the \1 in the sed command, it strips everything except the matched.
How to do this using the attri_rewrite scheme ?

Cheers




-
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 10:11 AM.


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