(RADIATOR) Renaming cisco-avpair

GermanG gaticag at hotmail.com
Fri Nov 8 14:29:17 CST 2002


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