[RADIATOR] Same code for ReplyHook & PostAuthHook hooks

2013-09-04 Thread Jim Tyrrell
Hi,

I am writing a hook to add attributes to a reply after the user has been 
authenticated either by local LDAP or RADIUS proxy, so I need to use 
PostAuthHook for LDAP and ReplyHook for the proxied requests.  I'd like 
to have the same script handle both, but the attributes are slightly 
different, ie the original request is ${$_[0]} in PostAuthHook , but 
${$_[2]} for ReplyHook,  so not sure which to check to confirm info such 
as original username.

Also the check for an Accept seems different:

PostAuthHook:  if ($result == $main::ACCEPT) {}
ReplyHook:  if (${$_[1]} eq 'Access-Accept') { }

Is there a way I can see in my code which type of Hook it has been 
called as so I can use the correct arguments and checks?

Thanks.

Jim.

___
radiator mailing list
radiator@open.com.au
http://www.open.com.au/mailman/listinfo/radiator


Re: [RADIATOR] Same code for ReplyHook & PostAuthHook hooks

2013-09-04 Thread Heikki Vatiainen
On 09/04/2013 03:49 PM, Jim Tyrrell wrote:

> Is there a way I can see in my code which type of Hook it has been 
> called as so I can use the correct arguments and checks?

Hello Jim,

you could consider this method:
http://www.open.com.au/pipermail/radiator/2013-January/018865.html

In addition to make it easier to pass your own arguments to Hooks, you
have more possibilities to structure your code within the module. For
example, you could create functions etc.

Another option might be to see $p->{Handler}->{Identifier}. When you
define unique Identifier parameters for your Handlers, you could use
those to see which Handler was selected for the current request.

Thanks,
Heikki

-- 
Heikki Vatiainen 

Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS,
TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS,
NetWare etc.
___
radiator mailing list
radiator@open.com.au
http://www.open.com.au/mailman/listinfo/radiator