Some stupid NASes (Cisco CSPS and Ericsson GGSN to name a couple) do not send AcctSes...
authorpnixon <pnixon>
Thu, 29 Jul 2004 15:01:46 +0000 (15:01 +0000)
committerpnixon <pnixon>
Thu, 29 Jul 2004 15:01:46 +0000 (15:01 +0000)
raddb/postgresql.conf

index c5facb2..ff72815 100644 (file)
@@ -45,7 +45,7 @@ sql {
 
        #table to keep radius client info
        nas_table = "nas"
-       
+
        # Remove stale session if checkrad does not see a double login
        deletestalesessions = yes
 
@@ -209,7 +209,8 @@ sql {
                AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStopTime IS NULL"
 
        accounting_stop_query = "UPDATE ${acct_table2} \
-               SET AcctStopTime = (now() - '%{Acct-Delay-Time:-0}'::interval), AcctSessionTime = '%{Acct-Session-Time}', \
+               SET AcctStopTime = (now() - '%{Acct-Delay-Time:-0}'::interval), \
+               AcctSessionTime = NULLIF('%{Acct-Session-Time}', '')::bigint, \
                AcctInputOctets = (('%{Acct-Input-Gigawords:-0}'::bigint << 32) + '%{Acct-Input-Octets:-0}'::bigint), \
                AcctOutputOctets = (('%{Acct-Output-Gigawords:-0}'::bigint << 32) + '%{Acct-Output-Octets:-0}'::bigint), \
                AcctTerminateCause = '%{Acct-Terminate-Cause}', AcctStopDelay = '%{Acct-Delay-Time:-0}', \
@@ -223,7 +224,8 @@ sql {
                AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStopDelay) \
                values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', \
                '%{NAS-Port}', '%{NAS-Port-Type}', (now() -  '%{Acct-Delay-Time:-0}'::interval - '%{Acct-Session-Time:-0}'::interval), \
-               (now() - '%{Acct-Delay-Time:-0}'::interval), '%{Acct-Session-Time}', '%{Acct-Authentic}', '%{Connect-Info}', \
+               (now() - '%{Acct-Delay-Time:-0}'::interval), NULLIF('%{Acct-Session-Time}', '')::bigint, \
+               '%{Acct-Authentic}', '%{Connect-Info}', \
                (('%{Acct-Input-Gigawords:-0}'::bigint << 32) + '%{Acct-Input-Octets:-0}'::bigint), \
                (('%{Acct-Output-Gigawords:-0}'::bigint << 32) + '%{Acct-Output-Octets:-0}'::bigint), '%{Called-Station-Id}', \
                '%{Calling-Station-Id}', '%{Acct-Terminate-Cause}', '%{Service-Type}', '%{Framed-Protocol}', \