Hi Andrew,

On Mar 29,  2:37pm, Andrew wrote:
> Subject: (RADIATOR) Having trouble rewriting attributes
> Hi ho.  I'm trying to get Radiator to do some fun attribute rewriting to
> keep my various NASs happy.  Ascends don't seem to like some attributes
> when they're IETF standard, so I'm trying to rewrite the attribtes into
> the Ascend-specific ones.
I have an ascend dictionary with the new Ascend vendor specific attributes
(replacing the old ones commandeered from IETF) in Radiator format if you would
like it.

>
> At the moment, I'm playing with the PreHandlerHook function, but I'm
> having very little success, even with Mike's example.  Using Mike's
> example:
>    PreHandlerHook sub { $_[0]->add_attr('test-attr', 'test-value'); }
>
> I see the following error:
> ERR: Error in PreHandlerHook(): Can't call method "add_attr" on unblessed
reference at (eval 62) line 1.

$_[0] is a reference to an object handle, so you will have to deref $_[0] like
this:

${$_[0]}->add_attr(....

>
> But that wasn't where my real problems were.  I was trying to write a
> somewhat weird function like this:
>
>         PreHandlerHook sub { \
>                 my $r; \
>                 foreach $r (@{$_[0]->{Attributes}}) { \
>                         if ($r->[0] eq 'Port-Limit') { \
>                                 $r->[0] = 'Ascend-Maximum-Channels'; \
>                         } \
>                         if ($r->[0] eq 'Idle-Timeout') { \
>                                 $r->[0] = 'Ascend-Idle-Limit'; \
>                         } \
>                 } \
>         }
>
> ...at which point Perl started complaining about things not being hashes.

Same comment as above.

>
> There's gotta be a better way to rewrite attribute names (not values!)
> based on which client is making the request.  Anyone?

Interesting technique. You should be able to make it work.


I suppose the best thing would be to have a different dictionary for each
client. We have been wanting to do that for a while, but its still a long way
off yet.

Cheers.


-- 
Mike McCauley                               [EMAIL PROTECTED]
Open System Consultants Pty. Ltd            Unix, Perl, Motif, C++, WWW
24 Bateman St Hampton, VIC 3188 Australia   Consulting and development
Phone, Fax: +61 3 9598-0985                 http://www.open.com.au

Radiator: the most portable, flexible and configurable RADIUS server 
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, 
Platypus, Freeside, external, etc etc on Unix, Win95/8, NT, Rhapsody
===
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to