(RADIATOR) Chaining multiple Hooks?

Hugh Irvine hugh at open.com.au
Wed Jan 17 16:11:07 CST 2007


Hello Jan -

If you have common code that you want to share between hooks, the  
best solution is to write your own Perl module with your subroutines  
defined in it and then call those routines from your hook code. You  
can either add your module to Radiator's "Radius" directory or you  
can define your own.

hope that helps

regards

Hugh


On 18 Jan 2007, at 07:32, Jan Tomasek wrote:

> Hello,
>
> I've AuthBy like this:
>
> <AuthBy RADIUS>
>   Identifier		radius1.cesnet.cz
>
>   RetryTimeout		3
>   Retries		1
>   FailureBackoffTime	0
>
>   UseExtendedIds
>
>   <Host radius1.cesnet.cz>
>     AuthPort		1812
>     AcctPort		1813
>     Secret		xxx
>   </Host>
>
>   NoReplyHook		file:"/etc/radiator/dr_no-reply-hook.pl"
>   ReplyHook		file:"/etc/radiator/dr_reply-hook.pl"
> </AuthBy>
>
> But I need to use there three different pieces of code. When I use
> multiple lines like:
>
>   ReplyHook		file:"/etc/radiator/hook1.pl"
>   ReplyHook		file:"/etc/radiator/hook2.pl"
>   ReplyHook		file:"/etc/radiator/dr_reply-hook.pl"
>
> than only last one is used. When I try to put them one line, Radiator
> says that it cannot open file like
> file:"/etc/radiator/hook1.pl",file:"/etc/radiator/hook2.pl" ...
>
> Is there any way how to use multiple hooks of one type?
>
>
> I guess it might be possible to use code like this
>
> my $y_src = `cat /home/semik/tmp/y.pl`;
> my $z_src = `cat /home/semik/tmp/z.pl`;
>
> my $main::code_y = eval ($y_src);
> my $main::code_z = eval ($z_src);
>
> in startupHook and later define
>
> ReplyHook = sub { &$main::code_y(@_); &$main::code_z(@_); };
>
> it might work, but in my option it is quite ugly ;)
>
> The question is if there is better way, except of putting all hooks  
> code
> into one file, which I don't like.
>
>
> Thanks for any sugestions
> -- 
> -----------------------
> Jan Tomasek aka Semik
> http://www.tomasek.cz/
>



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