(RADIATOR) Renaming cisco-avpair

Hugh Irvine hugh at open.com.au
Fri Nov 8 16:29:37 CST 2002


Hello German -

The only thing you can do is walk the entire attriubute list looking 
for whatever you want to.

Have a look at the routines in Radius/AttrVal.pm (change_attr or 
delete_attr for example).

regards

Hugh


On Friday, Nov 8, 2002, at 15:29 Canada/Eastern, GermanG wrote:

> Hugh:
>
> OK, I called in a list context:
> "...
>     if (@ciscoavpair = $p->get_attr('cisco-avpair'))
> ..."
> and it works.
> Now I want to get a set of similar named attributes that begin with 
> "cisco",
> for example "cisco-avpair" "cisco-h323-gw-id" and so on.
> I`ve tried with a regular expresion this way: 
> $p->get_attr('/^cisco/')) but
> it didn´t work.
> I`ve tried single quotes, double quotes, no quotes and neither seems to
> work.
> How can this be done?
>
>
> regards,
> German Gatica
>
> ----- Original Message -----
> From: "Hugh Irvine" <hugh at open.com.au>
> To: "GermanG" <gaticag at hotmail.com>
> Cc: <radiator at open.com.au>
> Sent: Thursday, November 07, 2002 4:00 AM
> Subject: Re: (RADIATOR) Renaming cisco-avpair
>
>
>>
>> Hello German -
>>
>> If you call $p->get_attr(..) in a list context instead of a scalar
>> context, you will get the complete list.
>>
>> Have a look at the code in Radius/AttrVal.pm.
>>
>> regards
>>
>> Hugh
>>
>>
>> On Thursday, November 7, 2002, at 07:56 AM, GermanG wrote:
>>
>>> Hello,
>>>
>>> I would like to save Radius accounting tickets from a Cisco AS5300 in
>>> a SQL
>>> database but Cisco AS5300 is sending multiple attributes 
>>> cisco-avpair.
>>> I
>>> would like to save all cisco-avpair so I need to rename them.
>>> For example,
>>> An original cisco-avpair like this:
>>> cisco-avpair = "connect-progress=41"
>>> I want it like this:
>>> cisco-avpair-connect-progress = "41"
>>> or just
>>> connect-progress = "41"
>>>
>>> I made a hook (based on /goddies/hooks.txt) for add a new attribute
>>> for each
>>> cisco-avpair.
>>> But this hook only catch the first cisco-avpair and I can not find 
>>> the
>>> way
>>> to analize the rest of cisco-avpair.
>>>
>>> Hook code:
>>> ############################
>>> # -*- mode: Perl -*-
>>> # Converts cisco-avpair into different attributes
>>> #
>>> sub
>>> {
>>>     my $p = ${$_[0]};
>>>     my $ciscoavpair;
>>>     my $ciscoavpair_name;
>>>     my $ciscoavpair_value;
>>>     if ($ciscoavpair = $p->get_attr('cisco-avpair'))
>>>     {
>>> $ciscoavpair =~ /=/;
>>> $ciscoavpair_name = $`;
>>> $ciscoavpair_value = $';
>>> $p->add_attr("cisco-avpair-$ciscoavpair_name", $ciscoavpair_value)
>>>     }
>>>     return;
>>> }
>>> #
>>> ############################
>>>
>>> I´ve read the "sub get_attr" from /Radius/AttrVal.pm and found that 
>>> if
>>> you
>>> ask for
>>> an attribute in a scalar context only returns the first one (that´s 
>>> my
>>> case!).
>>> How can I ask for an attribute in another way? (maybe as an array 
>>> but,
>>> How?)
>>> Does anyboby have anything that could help on this?
>>>
>>> I´ve tried with a "while" instead of an "if" , the result was a loop
>>> with
>>> the same (first) cisco-avpair.
>>> If I add a "->delete_attr" after the add, the result (as said in
>>> /Radius/AttrVal.pm ) deletes all cisco-avpair.
>>>
>>>
>>> Best Regards,
>>> German Gatica
>>> ===
>>> Archive at http://www.open.com.au/archives/radiator/
>>> Announcements on radiator-announce at open.com.au
>>> To unsubscribe, email 'majordomo at open.com.au' with
>>> 'unsubscribe radiator' in the body of the message.
>>>
>>>
>>
>> NB: I am travelling this week, so there may be delays in our
>> correspondence.
>>
>> --
>> Radiator: the most portable, flexible and configurable RADIUS server
>> anywhere. Available on *NIX, *BSD, Windows 95/98/2000, NT, MacOS X.
>> -
>> Nets: internetwork inventory and management - graphical, extensible,
>> flexible with hardware, software, platform and database independence.
>>
>> ===
>> Archive at http://www.open.com.au/archives/radiator/
>> Announcements on radiator-announce at open.com.au
>> To unsubscribe, email 'majordomo at open.com.au' with
>> 'unsubscribe radiator' in the body of the message.
>>
>
>

NB: I am travelling this week, so there may be delays in our 
correspondence.

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows 95/98/2000, NT, MacOS X.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.

===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list