(RADIATOR) retrieving $self in hooks

Hugh Irvine hugh at open.com.au
Mon Jul 24 22:12:11 CDT 2006


Salut Laurent -

Yes I use this technique often - you can use Identifiers in AuthBy  
clauses, Client clauses and Handler or Realm clauses for all sorts ot  
useful things.

There are numerous examples in the file "goodies/hooks.txt".

cordialement

Hughes


On 25 Jul 2006, at 02:12, PREVOSTO, Laurent wrote:

>
> I am replying to myself since i found a better way to achieve my  
> goal :
> I created a "dummy" <AuthBy LDAP2> clause which i use when i need  
> to request the directory (wherever in the code i am) :
>
> my $ldap =  RADIUS::AuthGeneric::find ('LDAP');
> $ldap->reconnect();
> etc.
>
> Since radiator is monothreaded, there is no big deal having just  
> one connection to the ldap (i suppose).
>
> Anyway, an answer to question 1. may be useful one day.
>
>
> Regards,
>
> Laurent
>
>> -----Message d'origine-----
>> De : owner-radiator at open.com.au
>> [mailto:owner-radiator at open.com.au] De la part de PREVOSTO, Laurent
>> Envoyé : lundi 24 juillet 2006 13:25
>> À : radiator at open.com.au
>> Objet : (RADIATOR) retrieving $self in hooks
>>
>> Bonjour,
>>
>> 1. The Question :
>> is there a generic way to retrieve $self (ie the Configurable
>> - well here, it happens to be a AuthBy but it could be
>> something else - that ran the hook) from inside of the hook itself ?
>> In a usual perl method $self is passed as the first argument
>> but not in radiator hooks...
>>
>> 2. The reason (for curious people) :
>> while processing radius packets, i need to do a few
>> treatments with a LDAP directory (which are not basic
>> authbyldap stuff).
>> So i overloaded AuthINTERNAL and AuthRADIUS so that they
>> inherit from both AuthINTERNAL/RADIUS and LDAP.pm.
>> Consequently, the resulting AuthXXXX classes contain a
>> reference to a LDAP instance.
>> And the very treatments are done in AuthHook and ReplyHook...
>> which both need to get a hand on $self so they can invoke the LDAP.
>> That's why i need to use $self in hooks.
>>
>> 3. The (ugly) way i do it today :
>> I can overload the code so that $self is passed as a
>> parameter in hooks... but that's quite ugly.
>> There are also tricks like using $fp->{ThisAuth} in ReplyHook
>> but it only works in ReplyHook and it's like using an
>> undocumented API that may change one day...
>>
>> 4. The conclusion :
>> If anybody has an idea, it would be greatly appreciated...
>>
>> Regards,
>>
>> Laurent
>>
>> --
>> 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.



NB:

Have you read the reference manual ("doc/ref.html")?
Have you searched the mailing list archive (www.open.com.au/archives/ 
radiator)?
Have you had a quick look on Google (www.google.com)?
Have you included a copy of your configuration file (no secrets),
together with a trace 4 debug showing what is happening?

-- 
Radiator: the most portable, flexible and configurable RADIUS server
anywhere. Available on *NIX, *BSD, Windows, MacOS X.
Includes support for reliable RADIUS transport (RadSec),
and DIAMETER translation agent.
-
Nets: internetwork inventory and management - graphical, extensible,
flexible with hardware, software, platform and database independence.
-
CATool: Private Certificate Authority for Unix and Unix-like systems.



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