(RADIATOR) How to pass arguments to hook?

Frank Danielson fdanielson at csky.com
Fri Aug 4 07:29:46 CDT 2006


Hi Jan-

The example in hooks.txt shows a scheme of creating an array of variables
with names based on the Identfier of the Client clause. In your case you
could do the same thing using the Identifier in the Handler. I believe that
a GlobalVar is a scalar and not a list so you may have to use split() to get
a list of server names. Here's a short example.

radius.cfg-

DefineFormattedGlobalVar	orgAdr_server_list r1,r2
DefineFormattedGlobalVar	orgCdr_server_list r1

<Handler Realm=/^orgA\.etest\.cesnet\.cz$/>
	Identifier orgA
	NoReplyHook file:"/etc/radiator/chose-server.pl"
	....
</Handler>

<Handler Realm=/^orgC\.etest\.cesnet\.cz$/>
	Identifier orgC
	NoReplyHook file:"/etc/radiator/chose-server.pl"
	....
</Handler>

chose-server.pl-

my $varname = $p->{Handler}->{Identifier} . "dr_server_list";
my $deadserverlist = &main::getVariable($varname);
.....

Frank Danielson
Infrastructure Architect

ClearSky Mobile Media
56 E. Pine St.
Orlando, FL 32801
USA

fdanielson at csky.com

-----Original Message-----
From: Jan Tomasek [mailto:jan at tomasek.cz]
Sent: Friday, August 04, 2006 4:36 AM
To: radiator at open.com.au
Subject: Re: (RADIATOR) How to pass arguments to hook?


Hello Frank,

> You may want to look at DefineFormattedGlobalVar. This allows you to
defince
> varaibles in the confgi file which can be accessed inside a hook using
> &main::getVariable(). There is an example of this in the goodies/hooks.txt
> file.

that is global variable, you canot put DefineFormattedGlobalVar into 
<Handler> </Handler>

I need customize arguments for that NoReplyHook in multiple diferent 
handlers. For example:

<Handler Realm=/^orgA\.etest\.cesnet\.cz$/>
	DefineFormattedGlobalVar	dr_server_list r1,r2
.
.
.
.
</Handler>

<Handler Realm=/^orgC\.etest\.cesnet\.cz$/>
	DefineFormattedGlobalVar	dr_server_list r1
.
.
.
.
</Handler>

That does not work. Radiator says:

Fri Aug  4 10:34:32 2006: ERR: Unknown keyword 
'DefineFormattedGlobalVar' in /etc/radiator/radius.cfg line 58

Thanks for idea, but this is not my way :) Any other sugestions?

-- 
-----------------------
Jan Tomasek aka Semik
http://www.tomasek.cz/

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