(RADIATOR) Renaming cisco-avpair
GermanG
gaticag at hotmail.com
Wed Nov 6 14:56:17 CST 2002
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.
More information about the radiator
mailing list