(RADIATOR) Renaming cisco-avpair

Dave Kitabjian dave at netcarrier.com
Wed Nov 6 15:32:04 CST 2002


This may not be worth much, but...

You might consider deleting each cisco-avpair attribute from the list after you recode it, and then add it back in "the right way", such as cisco-avpair-connect-progress = "41". That way, you'll get the next one in line the next time you call get_attr() because the first one will be gone.

Dave
:)

> -----Original Message-----
> From: GermanG [mailto:gaticag at hotmail.com] 
> Sent: Wednesday, November 06, 2002 3:56 PM
> To: radiator at open.com.au
> Subject: (RADIATOR) Renaming cisco-avpair
> 
> 
> 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.
> 
===
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