hi

I'm running radiator-2.15 on a NT server and need to do a SQL authentication and accounting from a MS-SQL server database. And also I need to run a Stored Procedure for each login which calculate session timeout value for every user for a prepaid Dollar amount.

Here all authentication and accounting is working properly but this procedure is not working. When I run this procedure from SQL Query analyzer it works properly.
Can you guys help me to put these few line to execute in proper place in the AuthSQL.pm module. I had included this in AuthSQL.pm module as follows.

Would you please advice me any wrong why this is not working as it is??? OR is there any way to do this kind of things....

thanks

Lakmin



########################C#############################################
# Handle a request
# This function is called for each packet. $p points to a Radius::
# packet
# REVISIT:should we fork before handling. There might be long timeouts?
sub handle_request
{
    my ($self, $p, $rp, $extra_checks) = @_;

    my $type = ref($self);
    $self->log($main::LOG_DEBUG, "Handling with $type");

    # (Re)-connect to the database if necessary,
    # No reply will be sent to the original requester if we
    # fail to connect
    return ($main::IGNORE, 'Database failure') unless $self->reconnect;


#######################################################################
#######################################################################

    my $user_name = $p->getUserName;
        #  This line is added by [EMAIL PROTECTED] for SQL calculation
          my $qqq = "execute proc_tmp_calsess $user_name";
     $self->do($qqq);
          $self->log($main::LOG_DEBUG, "LISL-NOC Custom Query is: $qqq\n");


# my $sel = $self->prepare( 'execute proc_tmp_calsess $user_name' );
#my $sel = $self->prepare( $qqq );
#$sel->execute();
#$sel->finish();

######################################################################
######################################################################     

#    my $user_name = $p->getUserName;
    if ($p->code eq 'Access-Request')
    {
# Short circuit for no authentication
return ($main::REJECT, 'Authentication disabled')
    if $self->{AuthSelect} eq '';




###########################################################
###########################################################

C:\Radiator-2.15>perl radpwtst -user lakmin@cheapnet -password XXXXX
sending Access-Request...
OK
sending Accounting-Request Start...
OK
sending Accounting-Request Stop...
OK

C:\Radiator-2.15>

####################################################
####################################################
>From log file

Authentic:  1234567890123456
Attributes:
        Session-Timeout = 75

Thu Apr 20 14:59:11 2000: DEBUG: Packet dump:
*** Received from 127.0.0.1 port 4687 ....
Code:       Accounting-Request
Identifier: 221
Authentic:  6<140>K<210>4g<215>U<240><245><250>;t9<133>C
Attributes:
        User-Name = "lakmin@cheapnet"
        Service-Type = Framed-User
        NAS-IP-Address = 203.63.154.1
        NAS-Port = 1234
        NAS-Port-Type = Async
        Acct-Session-Id = "00001234"
        Acct-Status-Type = Start

Thu Apr 20 14:59:11 2000: DEBUG: Check if Handler Realm=lan should be used to ha
ndle this request
Thu Apr 20 14:59:11 2000: DEBUG: Check if Handler Realm=cheapnet should be used
to handle this request
Thu Apr 20 14:59:11 2000: DEBUG: Handling request with Handler 'Realm=cheapnet'
Thu Apr 20 14:59:11 2000: DEBUG: Rewrote user name to lakmin
Thu Apr 20 14:59:11 2000: DEBUG:  Adding session for lakmin@cheapnet, 203.63.154
.1, 1234
Thu Apr 20 14:59:11 2000: DEBUG: Handling with Radius::AuthSQL
Thu Apr 20 14:59:11 2000: DEBUG: Handling accounting with Radius::AuthSQL
Thu Apr 20 14:59:11 2000: DEBUG: do query is: insert into ACCOUNTING
                (USERNAME, TIME_STAMP, ACCTSTATUSTYPE, ACCTSESSIONID, NASPORT)
                values
                ('lakmin', 956221151, 'Start', '00001234', 1234)

Thu Apr 20 14:59:11 2000: DEBUG: Accounting accepted
Thu Apr 20 14:59:11 2000: DEBUG: Packet dump:
*** Sending to 127.0.0.1 port 4687 ....
Code:       Accounting-Response
Identifier: 221
Authentic:  6<140>K<210>4g<215>U<240><245><250>;t9<133>C
Attributes:

Thu Apr 20 14:59:11 2000: DEBUG: Packet dump:
*** Received from 127.0.0.1 port 4687 ....
Code:       Accounting-Request
Identifier: 222
Authentic:  p]#7<10>An=<242><155>U(U<223><222>Q
Attributes:
        User-Name = "lakmin@cheapnet"
        Service-Type = Framed-User
        NAS-IP-Address = 203.63.154.1
        NAS-Port = 1234
        NAS-Port-Type = Async
        Acct-Session-Id = "00001234"
        Acct-Status-Type = Stop
        Acct-Delay-Time = 0
        Acct-Session-Time = 1000
        Acct-Input-Octets = 20000
        Acct-Output-Octets = 30000

Thu Apr 20 14:59:11 2000: DEBUG: Check if Handler Realm=lan should be used to ha
ndle this request
Thu Apr 20 14:59:11 2000: DEBUG: Check if Handler Realm=cheapnet should be used
to handle this request
Thu Apr 20 14:59:11 2000: DEBUG: Handling request with Handler 'Realm=cheapnet'
Thu Apr 20 14:59:11 2000: DEBUG: Rewrote user name to lakmin
Thu Apr 20 14:59:11 2000: DEBUG:  Deleting session for lakmin@cheapnet, 203.63.1
54.1, 1234
Thu Apr 20 14:59:11 2000: DEBUG: Handling with Radius::AuthSQL
Thu Apr 20 14:59:11 2000: DEBUG: Handling accounting with Radius::AuthSQL
Thu Apr 20 14:59:11 2000: DEBUG: do query is: insert into ACCOUNTING
                (USERNAME, TIME_STAMP, ACCTSTATUSTYPE, ACCTDELAYTIME, ACCTINPUTO
CTETS, ACCTOUTPUTOCTETS, ACCTSESSIONID, ACCTSESSIONTIME, NASPORT)
                values
                ('lakmin', 956221151, 'Stop', 0, 20000, 30000, '00001234', 1000,
1234)

Thu Apr 20 14:59:11 2000: DEBUG: Accounting accepted
Thu Apr 20 14:59:11 2000: DEBUG: Packet dump:
*** Sending to 127.0.0.1 port 4687 ....
Code:       Accounting-Response
Identifier: 222
Authentic:  p]#7<10>An=<242><155>U(U<223><222>Q
Attributes:



hi

I'm running radiator-2.15 on a NT server and need to do a SQL authentication and 
accounting from a MS-SQL server database. And also I need to run a Stored Procedure 
for each login which calculate session timeout value for every user for a prepaid 
Dollar amount.

Here all authentication and accounting is working properly but this procedure is not 
working. When I run this procedure from SQL Query analyzer it works properly.
Can you guys help me to put these few line to execute in proper place in the 
AuthSQL.pm module. I had included this in AuthSQL.pm module as follows.

Would you please advice me any wrong why this is not working as it is??? OR is there 
any way to do this kind of things....

thanks 

Lakmin



########################C#############################################
# Handle a request
# This function is called for each packet. $p points to a Radius
# packet
# REVISITshould we fork before handling. There might be long timeouts?
sub handle_request
{
    my ($self, $p, $rp, $extra_checks) = @_;

    my $type = ref($self);
    $self->log($mainLOG_DEBUG, "Handling with $type");

    # (Re)-connect to the database if necessary,
    # No reply will be sent to the original requester if we 
    # fail to connect
    return ($mainIGNORE, 'Database failure') unless $self->reconnect;


#######################################################################
#######################################################################

    my $user_name = $p->getUserName;
        #  This line is added by [EMAIL PROTECTED] for SQL calculation
          my $qqq = "execute proc_tmp_calsess $user_name";
                     $self->do($qqq);
          $self->log($mainLOG_DEBUG, "LISL-NOC Custom Query is $qqq\n");


# my $sel = $self->prepare( 'execute proc_tmp_calsess $user_name' ); 
#my $sel = $self->prepare( $qqq ); 
#$sel->execute(); 
#$sel->finish();

######################################################################
######################################################################      

#    my $user_name = $p->getUserName;
    if ($p->code eq 'Access-Request')
    {
        # Short circuit for no authentication
        return ($mainREJECT, 'Authentication disabled')
            if $self->{AuthSelect} eq '';




###########################################################
###########################################################

C\Radiator-2.15>perl radpwtst -user lakmin@cheapnet -password XXXXX
sending Access-Request...
OK
sending Accounting-Request Start...
OK
sending Accounting-Request Stop...
OK

C\Radiator-2.15>

####################################################
####################################################
>From log file

Authentic  1234567890123456
Attributes
        Session-Timeout = 75

Thu Apr 20 145911 2000 DEBUG Packet dump
*** Received from 127.0.0.1 port 4687 ....
Code       Accounting-Request
Identifier 221
Authentic  6<140>K<210>4g<215>U<240><245><250>;t9<133>C
Attributes
        User-Name = "lakmin@cheapnet"
        Service-Type = Framed-User
        NAS-IP-Address = 203.63.154.1
        NAS-Port = 1234
        NAS-Port-Type = Async
        Acct-Session-Id = "00001234"
        Acct-Status-Type = Start

Thu Apr 20 145911 2000 DEBUG Check if Handler Realm=lan should be used to ha
ndle this request
Thu Apr 20 145911 2000 DEBUG Check if Handler Realm=cheapnet should be used
to handle this request
Thu Apr 20 145911 2000 DEBUG Handling request with Handler 'Realm=cheapnet'
Thu Apr 20 145911 2000 DEBUG Rewrote user name to lakmin
Thu Apr 20 145911 2000 DEBUG  Adding session for lakmin@cheapnet, 203.63.154
.1, 1234
Thu Apr 20 145911 2000 DEBUG Handling with RadiusAuthSQL
Thu Apr 20 145911 2000 DEBUG Handling accounting with RadiusAuthSQL
Thu Apr 20 145911 2000 DEBUG do query is insert into ACCOUNTING
                (USERNAME, TIME_STAMP, ACCTSTATUSTYPE, ACCTSESSIONID, NASPORT)
                values
                ('lakmin', 956221151, 'Start', '00001234', 1234)

Thu Apr 20 145911 2000 DEBUG Accounting accepted
Thu Apr 20 145911 2000 DEBUG Packet dump
*** Sending to 127.0.0.1 port 4687 ....
Code       Accounting-Response
Identifier 221
Authentic  6<140>K<210>4g<215>U<240><245><250>;t9<133>C
Attributes

Thu Apr 20 145911 2000 DEBUG Packet dump
*** Received from 127.0.0.1 port 4687 ....
Code       Accounting-Request
Identifier 222
Authentic  p]#7<10>An=<242><155>U(U<223><222>Q
Attributes
        User-Name = "lakmin@cheapnet"
        Service-Type = Framed-User
        NAS-IP-Address = 203.63.154.1
        NAS-Port = 1234
        NAS-Port-Type = Async
        Acct-Session-Id = "00001234"
        Acct-Status-Type = Stop
        Acct-Delay-Time = 0
        Acct-Session-Time = 1000
        Acct-Input-Octets = 20000
        Acct-Output-Octets = 30000

Thu Apr 20 145911 2000 DEBUG Check if Handler Realm=lan should be used to ha
ndle this request
Thu Apr 20 145911 2000 DEBUG Check if Handler Realm=cheapnet should be used
to handle this request
Thu Apr 20 145911 2000 DEBUG Handling request with Handler 'Realm=cheapnet'
Thu Apr 20 145911 2000 DEBUG Rewrote user name to lakmin
Thu Apr 20 145911 2000 DEBUG  Deleting session for lakmin@cheapnet, 203.63.1
54.1, 1234
Thu Apr 20 145911 2000 DEBUG Handling with RadiusAuthSQL
Thu Apr 20 145911 2000 DEBUG Handling accounting with RadiusAuthSQL
Thu Apr 20 145911 2000 DEBUG do query is insert into ACCOUNTING
                (USERNAME, TIME_STAMP, ACCTSTATUSTYPE, ACCTDELAYTIME, ACCTINPUTO
CTETS, ACCTOUTPUTOCTETS, ACCTSESSIONID, ACCTSESSIONTIME, NASPORT)
                values
                ('lakmin', 956221151, 'Stop', 0, 20000, 30000, '00001234', 1000,
 1234)

Thu Apr 20 145911 2000 DEBUG Accounting accepted
Thu Apr 20 145911 2000 DEBUG Packet dump
*** Sending to 127.0.0.1 port 4687 ....
Code       Accounting-Response
Identifier 222
Authentic  p]#7<10>An=<242><155>U(U<223><222>Q
Attributes




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