hi hugh

I am connecting MSSQL through BSDI for authentication and accounting.
Earlier I have a problem on run a stred procedure and do normal authselect.
I have come up with a solution using  PreAuthHook
file:"/usr/local/etc/dbcon %n"  but this script works properly at unix
command line. But it gave error on mylog  when I include it on cfg file.
Pls help me to overcome this problem.
Authentication and Accounting is okay. but script is not running duto this
error.
( Tue Feb  1 11:50:05 2000: ERR: Error in PreAuthHook(): Can't use string
("1") as
 a subroutine ref while "strict refs" in use at
/usr/local/lib/perl5/site_perl/5
.005/Radius/Handler.pm line 493.)

pls see the attachment more script,logs...etc

Thankx for your kind corporation on previous advices, quick customer care
and BIG support

thankx 
lakmin

ps. all user names and passwords are arbitary




At 01:00 PM 1/29/00 +1100, you wrote:
>
>Hello Lakmin -
>
>On Sat, 29 Jan 2000, S.K.D. Lakmin Premnath wrote:
>> <html><div>hi </div>
>> <br>
>> <div>I need help from you all to run a stored procedure on MSSQL server
>> my ultimate goal is to add peak / ecnomical / offpeak rate(rates are
>> defined on a table and a particular pre paid amout) for login users
>> depends on username and login time. In here user's session-timeout is
>> calculated on time he logged in depend on time and rate. </div>
>> <br>
>> <div>I have written a SQL stored procedure to do this calculation but I
>> can't intigrate it into single sql statement.</div>
>> <div>my sql statements are &quot; execute proc_calsess %n &quot; and
>> &quot; select PASSWORD,CHKATTR,REPLYATTR from SUBSCRIBERS where
>> USERNAME='%n' &quot;</div>
>> <div>here proc_calsess procedure calculate the Session-Timeout amout from
>> Dollar amout he has when login time.</div>
>> <br>
>
>What you want to do is have your stored procedure do your calculations first,
>and then do the normal things that an AuthSelect would do (return the
password
>and any other check and reply attributes). Then the AuthSelect in the
Radiator
>configuration file would simply call the stored procedure and proceed
normally
>with the AuthColumnDef's.
>
>hth
>
>Hugh
>
>-- 
>Radiator: the most portable, flexible and configurable RADIUS server
>anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
>Platypus, Freeside, TACACS+, PAM, external, etc etc on Unix, Win95/8,
>NT, Rhapsody
> 
hi hugh

I am connecting MSSQL through BSDI for authentication and accounting. Earlier I have a 
problem on run a stred procedure and do normal authselect. I have come up with a 
solution using  PreAuthHook file:"/usr/local/etc/dbcon %n"  but this script works 
properly at unix command line. But it gave error on mylog  when I include it on cfg 
file. Pls help me to overcome this problem.
Authentication and Accounting is okay. but script is not running duto this error.
( Tue Feb  1 11:50:05 2000: ERR: Error in PreAuthHook(): Can't use string ("1") as
 a subroutine ref while "strict refs" in use at /usr/local/lib/perl5/site_perl/5
.005/Radius/Handler.pm line 493.)

pls see the attachment more script,logs...etc

Thankx for your kind corporation on previous advices, quick customer care  and BIG 
support

thankx 
lakmin

ps. all user names and passwords are arbitary



My script file "dbcon"

#!/usr/local/bin/perl
use strict;
require DBI;

my $DBSource = "dbi:FreeTDS:database=icaxxx;host=xxxx.xxx.xxx";
my $DBUsername = "xxxx";
my $DBAuth = "xxxx";
my $dbh = DBI->connect($DBSource, $DBUsername, $DBAuth);
my $uname = @ARGV[0];
my $qry = "execute proc_tmp_calsess \'$uname\'";

&prepareAndExecute($dbh, $qry);
$dbh->disconnect;

#####################################################################
# Convenience function to prepare and execute a query.
# If it fails to execute, return undef, else a statement handle
sub prepareAndExecute
{
    my ($dbh, $q) = @_;

        my $sth = $dbh->prepare($q);
    if (!$sth)
        {
                &fatalError("Prepare failed for '$q': $DBI::errstr");
                return undef;
        }
        my $rc = $sth->execute;
    if (!$rc)
        {
        &fatalError("Execute failed for '$q': $DBI::errstr");
        return undef;
        }
        return $sth;
}
                       




Abstract from cfg file

<Handler Realm=chksql>
        RewriteUsername s/^([^@]+).*/$1/
        AuthByPolicy ContinueWhileAccept

        # Following line runa external script and update remote DataBase
        PreAuthHook file:"/usr/local/etc/dbcon %n"

        <AuthBy SQL>
        DefaultReply Service-Type = Framed,\
        Framed-Protocol = PPP,\
        Framed-IP-Address = 255.255.255.254,\
        Framed-IP-Netmask = 255.255.255.255,\
        Framed-Routing = None,\
        Framed-MTU = 1500,\
        Framed-Compression = Van-Jacobson-TCP-IP          

        # Adjust DBSource, DBUsername, DBAuth to suit your DB
        DBSource        dbi:FreeTDS:database=icaxxxx;host=xxx.xx.xxx.xxx;port=1433
        DBUsername      xxxx
        DBAuth          xxxx

         AuthSelect select PASSWORD, CHECKATTR, REPLYATTR \
                from SUBSCRIBERS \
                        where USERNAME = '%n'

        AuthColumnDef 0, User-Password, check
        AuthColumnDef 1, GENERIC, check
        AuthColumnDef 2, GENERIC, reply

        # You may want to tailor these for your ACCOUNTING table
        AccountingTable ACCOUNTING
        AcctColumnDef   USERNAME,User-Name
        AcctColumnDef   TIME_STAMP,Timestamp,integer
        AcctColumnDef   ACCTSTATUSTYPE,Acct-Status-Type        
        AcctColumnDef   ACCTDELAYTIME,Acct-Delay-Time,integer
        AcctColumnDef   ACCTINPUTOCTETS,Acct-Input-Octets,integer
        AcctColumnDef   ACCTOUTPUTOCTETS,Acct-Output-Octets,integer
        AcctColumnDef   ACCTSESSIONID,Acct-Session-Id
        AcctColumnDef   ACCTSESSIONTIME,Acct-Session-Time,integer
        AcctColumnDef   ACCTTERMINATECAUSE,Acct-Terminate-Cause
        AcctColumnDef   NASIDENTIFIER,NAS-Identifier
        AcctColumnDef   NASPORT,NAS-Port,integer
        AcctColumnDef   FRAMEDIPADDRESS,Framed-IP-Address
   </AuthBy>
        AcctLogFileName %L/menik/detail-%m-%Y-proxy-chksql
</Handler>                                         


radiator2: {5} % radpwtst -user xxxxx@chksql -password xxxxx
sending Access-Request...
OK
sending Accounting-Request Start...
OK
sending Accounting-Request Stop...
OK
radiator2: {6} %                        


Abstract from mylog file

Tue Feb  1 11:50:05 2000: DEBUG: Check if Handler Realm=lan should be used to ha
ndle this request
Tue Feb  1 11:50:05 2000: DEBUG: Check if Handler Realm=chksql should be used to
 handle this request
Tue Feb  1 11:50:05 2000: DEBUG: Handling request with Handler 'Realm=chksql'
Tue Feb  1 11:50:05 2000: DEBUG: Rewrote user name to xxxxx
Tue Feb  1 11:50:05 2000: DEBUG: Deleting session for xxxxx@chksql, 203.63.15
4.1, 1234
Tue Feb  1 11:50:05 2000: ERR: Error in PreAuthHook(): Can't use string ("1") as
 a subroutine ref while "strict refs" in use at /usr/local/lib/perl5/site_perl/5
.005/Radius/Handler.pm line 493.

Tue Feb  1 11:50:05 2000: DEBUG: Handling with Radius::AuthSQL
Tue Feb  1 11:50:05 2000: DEBUG: Handling accounting with Radius::AuthSQL
Tue Feb  1 11:50:05 2000: DEBUG: do query is: insert into ACCOUNTING
                (USERNAME, TIME_STAMP, ACCTSTATUSTYPE, ACCTDELAYTIME, ACCTINPUTO
CTETS, ACCTOUTPUTOCTETS, ACCTSESSIONID, ACCTSESSIONTIME, NASPORT)
                values
                ('xxxxx', 949384205, 'Stop', 0, 20000, 30000, '00001234', 100
0, 1234)

Tue Feb  1 11:50:05 2000: DEBUG: Accounting accepted    

================================================
S.K.D. Lakmin Premnath.
(Systems Engineer)
Lanka Internet Services Limited.
( http://www.lanka.net )
Network Operating Center
No, 156 1/1 Walukarama Road,
Colombo 3,
Sri Lanka.
Tel : +94 1 565071
Fax : +94 75 335637
Email : [EMAIL PROTECTED]

=================================================

Reply via email to