(RADIATOR) Retrieving a hook by filename from inside ClientListSQL
Mike McCauley
mikem at open.com.au
Mon Feb 3 04:54:36 CST 2003
Hello Claudio,
thanks for your contribution. Added to the goodies for the next release, also
in the 3.5 patches.
Thanks again to you and German.,
Cheers.
On Mon, 3 Feb 2003 02:47 pm, Claudio Lapidus wrote:
> Hello Toomas et al.
>
> Sorry for not answering your first post earlier, I unattended this mailbox
> a couple of days...
>
> About the issue you mention, we also needed to be able to select prehandler
> hook from an SQL value, but as Mike pointed out back then, that is not
> possible, at least directly. By further testing, we also realized that
> Radiator doesn't know how to update its client list during runtime, i.e.
> the client list is only read once, during initialization (or kill -USR1, I
> think, am I wrong Hugh?). Then our final solution was simply to use a
> clause like
>
> include /home/radiator/Radiator-3.3.1/rad_clients|
>
> and setup a perl file containing:
>
> -------------------<snip>-------------------
> #!/usr/bin/perl
> use DBI;
> $dbh = DBI->connect ( "dbi:Pg:dbname=xxxxxxx;host=xx.xx.xx.xx", "xxxxx",
> "xxxxx");
> if ( !defined $dbh ) {
> die "Cannot connect to database!\n";
> }
>
> $sth = $dbh->prepare( "SELECT nasidentifier, nastype, secret,
> prehandlerhook FROM radclientlist");
> if ( !defined $sth ) {
> die "Cannot prepare statement: $DBI::errstr\n";
> }
> $sth->execute;
> while ( ($nas_id, $nas_type, $nas_secret, $pre_handler) =
> $sth->fetchrow()){
>
> print "<Client $nas_id>\n Secret $nas_secret\n NasType $nas_type\n
> PreHandlerHook $pre_handler\n</Client>\n";
> }
> $sth->finish;
> $dbh->disconnect;
> -------------------</snip>-------------------
>
> This way, the client list is generated (from SQL data) at daemon startup
> and included inline with the rest of the configuration, so we can enjoy the
> best of both worlds, the client data stored efficiently in SQL and the
> compact 'file:"scriptname.pl"' notation as a pointer to further code.
> Perhaps it needs some refinement, especially in error handling, but it
> works fine. Anyway, I continue thinking that it would be better to have it
> handled directly by the main code, but I was unable to convince Mike and
> Hugh at that time :-)
>
> Mike, if you want to add the script to contrib, please credit German
> Gatica, as he was the person who wrote it.
>
> kind regards
> cl.
>
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus
--
Mike McCauley mikem at open.com.au
Open System Consultants Pty. Ltd Unix, Perl, Motif, C++, WWW
24 Bateman St Hampton, VIC 3188 Australia http://www.open.com.au
Phone +61 3 9598-0985 Fax +61 3 9598-0955
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 etc on Unix, Windows, MacOS etc.
===
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