Hello Hakim -

On Tue, 17 Oct 2000, Hakim Tass wrote:
> hi Hugh!!!
> I am sorry about the wrong email address, and I apologize for the
> inconvience that might have caused to you.
> 
> well this is what exactly i want to do.
> We are planning to have two different type of subscription scheme. In the
> first scheme the  subscription is charged on hourly basis while the other
> one it is based on number of days/months.
> I want to keep the accounting information for this two types in two
> different accounting tables.
> 

You would do something like this:

# configure SQLAuthentication1
<AuthBy SQL>
                Identifier SQLAuthentication1
                DBSource        dbi:mysql:mydatabase
                DBUsername      xxxx
                DBAuth          xxxx
                AuthSelect select PASSWORD,BALANCETIME from \
                AUTHENTICATIONTABLE where \
                (USERNAME='%n' and BALANCETIME > 0 and \
                (EXPIRY_DATE > now() or EXPIRY_DATE IS NULL))
                AuthColumnDef   0,Password,check
                AuthColumnDef   1,Session-Timeout,reply
                AccountingTable
</AuthBy>

#configure SQLAccounting1
<AuthBy SQL>
                Identifier SQLAccounting1
                DBSource        dbi:mysql:mydatabase
                DBUsername      xxxx
                DBAuth          xxxx
                AuthSelect 
                AccountingStopsOnly
                AccountingTable ACCOUNTINGTABLE1
                AcctColumnDef   USERNAME,User-Name
                AcctColumnDef   CALLDATE,Timestamp,integer-date
                AcctColumnDef   ACCTSTATUSTYPE,Acct-Status-Type,integer
                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   NASIDENTIFIER,NAS-IP-Address
                AcctColumnDef   NASPORT,NAS-Port,integer
                AcctColumnDef   CLIENTIPADDRESS,Framed-IP-Address
                # You can use this to force Radiator to limit
                # maximum session times to how many minutes
                # are left in subaccounts.timeleft
                AcctSQLStatement update AUTHENTICATIONTABLE set \
                BALANCETIME = BALANCETIME-%{Acct-Session-Time} \
                where USERNAME = '%n'
</AuthBy>

# configure SQLAuthentication2
<AuthBy SQL>
               Identifier SQLAuthentication2
                DBSource dbi:mysql:mydatabase
                DBUsername     xxxx
                DBAuth         xxxx
                AuthSelect select password,balancetime from \
                AUTHENTICATIONTABLE2 where (username='%n' and  status = 1)
                AuthColumnDef    0,Password,check
                AuthColumnDef    1,Session-Timeout,Reply
                AccountingTable
</AuthBy>

# configure SQLAccounting2
<AuthBy SQL>
                Identifier SQLAccounting2
                DBSource dbi:mysql:mydatabase
                DBUsername     xxxx
                DBAuth         xxxx
                AuthSelect 
                AccountingStopsOnly
                AccountingTable accountingtable2
                AcctColumnDef   username,User-Name
                AcctColumnDef   calldate,Timestamp,formatted-date,to_date\
                 ('%e %m %Y %H %M %S','DD MM YYYY HH24:MI:SS')
                AcctColumnDef   acctstatustype,Acct-Status-Type,integer
                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   clientipaddress,Framed-IP-Address
                AcctSQLStatement update authenticationtable2 set \
                 balancetime = balancetime-%{Acct-Session-Time}\
                 where USERNAME = '%n'
</AuthBy SQL>

# configure SQLAuthentication
<AuthBy GROUP>
        Identifier SQLAuthentication
        AuthByPolicy ContinueUntilAccept
        AuthBy SQLAuthentication1
        AuthBy SQLAuthentication2
        AddToReply \
            Service-Type = Framed-User, \
            Framed-Protocol = PPP
</AuthBy>


<Realm>
        MaxSessions 1
        AuthByPolicy ContinueAlways
        AuthBy SQLAccounting1
        AuthBy SQLAccounting2 
        AuthBy SQLAuthentication
</Realm>

Hopefully the above makes sense.

regards

Hugh



-- 
Radiator: the most portable, flexible and configurable RADIUS server 
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, 
Platypus, Freeside, Interbiller, TACACS+, PAM, external, etc, etc.
Available on Unix, Linux, FreeBSD, Windows 95/98/2000, NT, MacOS X.



===
Archive at http://www.starport.net/~radiator/
Announcements on [EMAIL PROTECTED]
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to