Fwd: (RADIATOR) Bind Variables and Oracle

Paul paul at level9.net
Wed Nov 28 03:11:20 CST 2001


Hi Mike,

Have come up with a work around by adding the following to Handler.pm:

        elsif ($status_type eq 'Stop')
        {
            $sessdb->delete($original_username, $nas_id, $nas_port, $p,
                            $session_id, $framed_ip_address);

            if (defined $self->{AcctStopGenie}){


                 eval{ &{$self->{AcctStopGenie}}(\$p, \$rp); };
                 &main::log($main::LOG_ERR, "Error in AcctStopGenie(): $@")
                        if $@;
                }
        }

Using AuthInternal seemed to cause the script for Access Requests and not
just AcctStops.

I know next to nothing about perl tho... so there might be something major
wrong with this, but it seems to do the job :-)


Thanks,


Paul



________






-----Original Message-----
From: Mike McCauley [mailto:mikem at open.com.au]
Sent: 28 November 2001 04:59
To: Paul
Cc:
Subject: Re: Fwd: (RADIATOR) Bind Variables and Oracle


Hi Paul,

The problem is that your AcctStopHook line does not actually specifiy a
hook.
A hook needs to be a perl subroutine definition. Such a hook could run an
external progmam. It looks like thats what you want to do?.

You can find examples of how to set up a perl hook in the internalhook.cfg
file I sent to you with the new AutINTERNAL.pm.

Hope that helps.

Cheers.

On Wed, 28 Nov 2001 12:49, Paul wrote:
> Hi Mike,
>
> Been trying to use the new accthook but been having some problems.
> The error message I get is:
>
> Tue Nov 27 23:29:03 2001: ERR: Error in AcctStopHook(): Can't use string
> ("/opt/radiator/acctstop") as a subroutine ref while "strict refs" in use
> at /usr/local/lib/perl5/site_perl/5.6.1/Radius/AuthINTERNAL.pm line 132.
>
> I have specified the hook as per below in the config file:
>
> #--------------------
> # ALL WAP Users
> #--------------------
>
> <Handler>
>
>         PreProcessingHook file:"/opt/radiator/config/msisdnFIX"
>         RewriteUsername s/[^A-Za-z0-9]//g
>         RewriteUsername tr/[A-Z]/[a-z]/
>
>         AuthByPolicy ContinueWhileAccept
>         AuthBy Check-wapusers
>         AuthBy AllocateIPAddressForWAP
>
>         <AuthBy INTERNAL>
>                 AcctStopHook "/opt/radiator/acctstop"
>         </AuthBy>
>
>         AcctLogFileName %L/%N-wap-%{GlobalVar:HostId}-detail%Y%m%d.log
>         PostAuthHook file:"/opt/radiator/config/postauthhook"
>
> </Handler>
>
> Have also attached a copy of the hook I am trying to use.
>
> Any help would be much appreciated!
>
> Thanks!
>
> Paul
>
> ----- Original Message -----
> From: "Mike McCauley" <mikem at open.com.au>
> To: "Paul" <paul at level9.net>
> Cc: <hugh at open.com.au>; <radiator at open.com.au>
> Sent: Thursday, November 22, 2001 11:00 PM
> Subject: Re: Fwd: (RADIATOR) Bind Variables and Oracle
>
> > On Thu, 22 Nov 2001 22:45, Paul wrote:
> > > Thanks for this Mike,
> > >
> > > Would it be possible (in the next release!) to have a hook that runs
>
> when a
>
> > > 'stop' record is received?
> >
> > Attached is a new version of AuthINTERNAL.pm that supports the use of
> > optional hooks
> > to figure out how to reply to various types of request.
> > You can now define the following hooks:
> >   RequestHook
> >   AuthHook
> >   AcctHook
> >   AcctStartHook
> >   AcctStopHook
> >   AcctAliveHook
> >   AcctOtherHook
> >   OtherHook
> > There is also an example config file attached.
> >
> > Perhaps you would like to test it and let me know how it goes?
> >
> > Cheers.
> >
> > > Thanks,
> > >
> > > Paul
> > >
> > > ----- Original Message -----
> > > From: "Mike McCauley" <mikem at open.com.au>
> > > To: "Paul" <paul at level9.net>
> > > Cc: <hugh at open.com.au>; <radiator at open.com.au>
> > > Sent: Wednesday, November 21, 2001 11:09 PM
> > > Subject: Re: Fwd: (RADIATOR) Bind Variables and Oracle
> > >
> > > > Hi Paul,
> > > >
> > > > Radiator has low level support in the API for using bound variables
>
> (see
>
> > > the
> > >
> > > > trailing arguments to Radius::SqlDb::do and prepareAndExecute), so
> > > > you can use bound variables in hooks etc.
> > > >
> > > > However, AuthBy SQL and SessionDatabase SQL do not support bound
> > > > variables with their various queries. That means that there is
>
> presently
>
> > > > no way to
> > >
> > > use
> > >
> > > > bound variables just by tweaking the AuthBy SQL or SessionDatabase
> > > > SQL parameters. It could only be done through a hook.
> > > >
> > > > Hope that helps.
> > > >
> > > > Cheers.
> > > >
> > > > On Thu, 22 Nov 2001 09:47, Hugh Irvine wrote:
> > > > > Mikey -
> > > > >
> > > > >
> > > > >
> > > > > ----------  Forwarded Message  ----------
> > > > > Subject: (RADIATOR) Bind Variables and Oracle
> > > > > Date: Wed, 21 Nov 2001 17:20:59 -0000
> > > > > From: "Paul" <paul at level9.net>
> > > > > To: <radiator at open.com.au>
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > Wondering if anyone has had any experience with using bind
> > > > > variables
> > >
> > > with
> > >
> > > > > Radiator / Oracle.
> > > > >
> > > > > I am running Radiator 2.18.2 and Oracle 8.0.5 (both on Solaris)
>
> using
>
> > > DBD
> > >
> > > > > 1.12 and DBI 1.20.
> > > > >
> > > > > We use a SessionDatabase SQL clause to perform IP vs. CLI writes
to
>
> an
>
> > > > > external Oracle database. We have found that the query we are
>
> currently
>
> > > > > using is very inefficient as Oracle has to parse the whole query
>
> every
>
> > > time
> > >
> > > > > and would like to modify the query to use bind variables as per
>
> below:
> > > > > ### WITHOUT BIND VARIABLE
> > > > > $query  = "delete from radius_clid_tbl where " .
> > > > >       "IP_ADDR= '$framedipaddress' or " .
> > > > >       "MSISDN= '$callingstation'";
> > > > > my $sth = $sess_handle->prepareAndExecute($query);
> > > > >
> > > > > ### USING BIND VARIABLE
> > > > > $query  = "delete from radius_clid_tbl where " .
> > > > >       "IP_ADDR= ? or " .
> > > > >       "MSISDN= ? ";
> > > > > my $sth = $sess_handle->prepareAndExecute($query,
$framedipaddress,
> > > > > $callingstation);
> > > > >
> > > > > The SessionDb SQL clause currently looks like this:
> > > > >
> > > > > <SessionDatabase SQL>
> > > > >         DBSource dbi:Oracle:
> > > > >         DBUsername user/password at sid
> > > > >         AddQuery
> > > > >         DeleteQuery delete from radius_clid_tbl \
> > > > >                 where (IP_ADDR='%{Framed-IP-Address}' \
> > > > >                 or IP_ADDR='%{Framed-Address}' \
> > > > >                 or MSISDN='%{Calling-Station-Id}')
> > > > >         ClearNasQuery
> > > > >         CountQuery
> > > > > </SessionDatabase SQL>
> > > > >
> > > > > The delete needs to be performed when an access-request is recvd
> > > > > and
> > >
> > > when a
> > >
> > > > > stop record is recvd, so I don't think I can use a hook. Also the
>
> DBA's
>
> > > > > involved won't let me use a stored procedure :-(
> > > > >
> > > > > If anyone has any experience with this, some help would be much
> > >
> > > appreciated
> > >
> > > > > :-)
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Paul
> > > > >
> > > > >
> > > > > ___________________
> > > > >
> > > > > Paul O'Shea
> > > > > Level9 Networks
> > > > > ___________________
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ===
> > > > > 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.
> > > > >
> > > > > -------------------------------------------------------
> > > >
> > > > --
> > > > 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 etc etc
> > > > on Unix, Win95/8, 2000, NT, MacOS 9, MacOS X
> > > > ===
> > > > 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.
> >
> > --
> > 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 etc etc
> > on Unix, Win95/8, 2000, NT, MacOS 9, MacOS X

--
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 etc etc
on Unix, Win95/8, 2000, NT, MacOS 9, MacOS X

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