(RADIATOR) retrieving $self in hooks

PREVOSTO, Laurent Laurent.PREVOSTO at neufcegetel.fr
Mon Jul 24 11:12:38 CDT 2006


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.


More information about the radiator mailing list