(RADIATOR) AuthSQLStatement
talist at vif.com
talist at vif.com
Mon Jun 11 14:51:28 CDT 2001
There is an existing function calld AcctSQLStatement which does an $sth->do
on the DBI interface.
This is very useful because you can "emulate" stored procedure behaviour on
databases that lack this feature (i.e. mysql)
I know that hook processing can do all that and more, but the simplicity and
lack of forking of AcctSQLStatement/AuthSQLStatement make them very
attractive.
I would like to submit a small code addition in order to implement
AuthSQLStatement which I am using in order to communicate with mysql before
authenticating the user. In my case this is very usefull because I can
emulate stored procedure features as in: "insert into DebugTable select case
when {condition} then {do something} end"
One think that I would like to see with those functions is the possibility
to use multiple occurences and having them sent to the database, we could
then use the "user variables" feature on mysql in order to get closer to a
stored procedure emulation.
diff -u AuthSQL.original.pm AuthSQL.pm
--- AuthSQL.original.pm Sat Jun 9 08:53:30 2001
+++ AuthSQL.pm Sat Jun 9 08:53:46 2001
@@ -71,6 +71,7 @@
'AccountingStopsOnly' => 'flag',
'AccountingAlivesOnly' => 'flag',
'AcctSQLStatement' => 'stringarray',
+ 'AuthSQLStatement' => 'stringarray',
# REVISIT: move AcctFailedLogFileName to AuthGeneric
'AcctFailedLogFileName' => 'string',
'AcctLogFileFormat' => 'string') && return 1;
@@ -141,6 +142,13 @@
# Short circuit for no authentication
return ($main::REJECT, 'Authentication disabled')
if $self->{AuthSelect} eq '';
+
+ # If AuthSQLStatement is set, parse the strings and execute them
+ if (defined $self->{AuthSQLStatement})
+ {
+ map {$self->do(&Radius::Util::format_special($_, $p, $rp))}
+ @{$self->{AuthSQLStatement}};
+ }
# The default behaviour in AuthGeneric is fine for this
return $self->SUPER::handle_request($p, $rp, $extra_checks);
talist at vif.com
===
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