Store X-Ascend-Session-Svr-Key in the DB
authorpnixon <pnixon>
Fri, 13 Jul 2007 15:47:31 +0000 (15:47 +0000)
committerpnixon <pnixon>
Fri, 13 Jul 2007 15:47:31 +0000 (15:47 +0000)
raddb/mssql.conf
raddb/oraclesql.conf
raddb/sql.conf

index 0627627..a5baf0a 100644 (file)
@@ -114,11 +114,13 @@ sql {
 
        accounting_update_query = "UPDATE ${acct_table1} SET FramedIPAddress = '%{Framed-IP-Address}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress= '%{NAS-IP-Address}' AND AcctStopTime = 0"
 
-       accounting_update_query_alt = "INSERT into ${acct_table1} (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPort, NASPortType, AcctSessionTime, AcctAuthentic, ConnectInfo_start, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', '%{NAS-Port-Type}', '%{Acct-Session-Time}', '%{Acct-Authentic}', '', '%{Acct-Input-Octets}', '%{Acct-Output-Octets}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '0')"
+       accounting_update_query_alt = "INSERT into ${acct_table1} (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPort, NASPortType, AcctSessionTime, AcctAuthentic, ConnectInfo_start, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, XAscendSessionSvrKey) \
+ VALUES('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', '%{NAS-Port-Type}', '%{Acct-Session-Time}', '%{Acct-Authentic}', '', '%{Acct-Input-Octets}', '%{Acct-Output-Octets}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '0', '%{X-Ascend-Session-Svr-Key}')"
 
        # accounting_start_query: Inserting of RadAcctId and AcctStopTime was
        # removed. These fields are processing by a database
-       accounting_start_query = "INSERT into ${acct_table1} (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPort, NASPortType, AcctStartTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', '%{NAS-Port-Type}', '%S', '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0')"
+       accounting_start_query = "INSERT into ${acct_table1} (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPort, NASPortType, AcctStartTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay, XAscendSessionSvrKey) \
+ VALUES('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', '%{NAS-Port-Type}', '%S', '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0', '%{X-Ascend-Session-Svr-Key}')"
 
        accounting_start_query_alt  = "UPDATE ${acct_table1} SET AcctStartTime = '%S', AcctStartDelay = '%{Acct-Delay-Time}', ConnectInfo_start = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStopTime = 0"
 
index 48b6080..eda4cc5 100644 (file)
@@ -158,16 +158,17 @@ accounting_update_query = "UPDATE ${acct_table1} \
     NASIPAddress= '%{NAS-IP-Address}' AND \
     AcctStopTime IS NULL" 
 
-accounting_update_query_alt = "INSERT into ${acct_table1} (RadAcctId, AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay) \
+accounting_update_query_alt = "INSERT into ${acct_table1} (RadAcctId, AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, XAscendSessionSvrKey) \
     VALUES('', '%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', \
     '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', \
     '%{NAS-Port-Type}', NULL, '%{Acct-Session-Time}', '%{Acct-Authentic}', '', \
     '%{%{Acct-Input-Gigawords}:-0}' << 32 | '%{%{Acct-Input-Octets}:-0}', \
     '%{%{Acct-Output-Gigawords}:-0}' << 32 | '%{%{Acct-Output-Octets}:-0}', \
     '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', \
-    '%{Framed-Protocol}', '%{Framed-IP-Address}', '0')"
+    '%{Framed-Protocol}', '%{Framed-IP-Address}', '0', '%{X-Ascend-Session-Svr-Key}')"
 
-       accounting_start_query = "INSERT into ${acct_table1} (RadAcctId, AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay) values('', '%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', '%{NAS-Port-Type}', TO_DATE('%S','yyyy-mm-dd hh24:mi:ss'), NULL, '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0')"
+       accounting_start_query = "INSERT into ${acct_table1} (RadAcctId, AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay, XAscendSessionSvrKey) \
+ VALUES('', '%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', '%{NAS-Port-Type}', TO_DATE('%S','yyyy-mm-dd hh24:mi:ss'), NULL, '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0', '%{X-Ascend-Session-Svr-Key}')"
 
 accounting_start_query_alt  = "UPDATE ${acct_table1} SET AcctStartTime = TO_DATE('%S','yyyy-mm-dd hh24:mi:ss'), AcctStartDelay = '%{Acct-Delay-Time}', ConnectInfo_start = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStopTime IS NULL"
 
index 99f0194..7fb611a 100644 (file)
@@ -185,21 +185,55 @@ sql {
           AND NASIPAddress    = '%{NAS-IP-Address}'"
 
 
-        accounting_update_query = " \
-          UPDATE ${acct_table1} \
-          SET \
-             FramedIPAddress = '%{Framed-IP-Address}', \
-             AcctSessionTime     = '%{Acct-Session-Time}', \
-             AcctInputOctets     = '%{%{Acct-Input-Gigawords}:-0}'  << 32 | \
-                                   '%{%{Acct-Input-Octets}:-0}', \
-             AcctOutputOctets    = '%{%{Acct-Output-Gigawords}:-0}' << 32 | \
-                                   '%{%{Acct-Output-Octets}:-0}' \
-          WHERE AcctSessionId = '%{Acct-Session-Id}' \
-          AND UserName        = '%{SQL-User-Name}' \
-          AND NASIPAddress    = '%{NAS-IP-Address}'"
-
-
-       accounting_start_query = "INSERT into ${acct_table1} (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', '%S', '0', '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0')"
+        accounting_update_query_alt = " \
+          INSERT INTO ${acct_table1} \
+            (AcctSessionId,    AcctUniqueId,      UserName, \
+             Realm,            NASIPAddress,      NASPortId, \
+             NASPortType,      AcctStartTime,     AcctSessionTime, \
+             AcctAuthentic,    ConnectInfo_start, AcctInputOctets, \
+             AcctOutputOctets, CalledStationId,   CallingStationId, \
+             ServiceType,      FramedProtocol,    FramedIPAddress, \
+             AcctStartDelay,   XAscendSessionSvrKey) \
+          VALUES \
+            ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', \
+             '%{SQL-User-Name}', \
+             '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', \
+             '%{NAS-Port-Type}', \
+             DATE_SUB('%S', \
+                      INTERVAL (%{%{Acct-Session-Time}:-0} + \
+                                %{%{Acct-Delay-Time}:-0}) SECOND), \
+                      '%{Acct-Session-Time}', \
+             '%{Acct-Authentic}', '', \
+             '%{%{Acct-Input-Gigawords}:-0}' << 32 | \
+             '%{%{Acct-Input-Octets}:-0}', \
+             '%{%{Acct-Output-Gigawords}:-0}' << 32 | \
+             '%{%{Acct-Output-Octets}:-0}', \
+             '%{Called-Station-Id}', '%{Calling-Station-Id}', \
+             '%{Service-Type}', '%{Framed-Protocol}', \
+             '%{Framed-IP-Address}', \
+             '0', '%{X-Ascend-Session-Svr-Key}')"
+
+
+        accounting_start_query = " \
+          INSERT INTO ${acct_table1} \
+            (AcctSessionId,    AcctUniqueId,     UserName, \
+             Realm,            NASIPAddress,     NASPortId, \
+             NASPortType,      AcctStartTime,    AcctStopTime, \
+             AcctSessionTime,  AcctAuthentic,    ConnectInfo_start, \
+             ConnectInfo_stop, AcctInputOctets,  AcctOutputOctets, \
+             CalledStationId,  CallingStationId, AcctTerminateCause, \
+             ServiceType,      FramedProtocol,   FramedIPAddress, \
+             AcctStartDelay,   AcctStopDelay,    XAscendSessionSvrKey) \
+          VALUES \
+            ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', \
+             '%{SQL-User-Name}', \
+             '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', \
+             '%{NAS-Port-Type}', '%S', '0', \
+             '0', '%{Acct-Authentic}', '%{Connect-Info}', \
+             '', '0', '0', \
+             '%{Called-Station-Id}', '%{Calling-Station-Id}', '', \
+             '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', \
+             '%{%{Acct-Delay-Time}:-0}', '0', '%{X-Ascend-Session-Svr-Key}')"
 
        accounting_start_query_alt  = "UPDATE ${acct_table1} SET AcctStartTime = '%S', AcctStartDelay = '%{Acct-Delay-Time}', ConnectInfo_start = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}'"
 
@@ -261,9 +295,18 @@ sql {
        #                       - Note that the returned field order should not be changed.
        #######################################################################
 
-       # Uncomment simul_count_query to enable simultaneous use checking
-       # simul_count_query = "SELECT COUNT(*) FROM ${acct_table1} WHERE UserName='%{SQL-User-Name}' AND AcctStopTime = 0"
-       simul_verify_query = "SELECT RadAcctId, AcctSessionId, UserName, NASIPAddress, NASPortId, FramedIPAddress, CallingStationId, FramedProtocol FROM ${acct_table1} WHERE UserName='%{SQL-User-Name}' AND AcctStopTime = 0"
+        # Uncomment simul_count_query to enable simultaneous use checking
+        #simul_count_query = "SELECT COUNT(*) \
+                             #FROM ${acct_table1} \
+                             #WHERE UserName='%{SQL-User-Name}' \
+                             #AND AcctStopTime = 0"
+
+        simul_verify_query  = "SELECT RadAcctId, AcctSessionId, UserName, \
+                               NASIPAddress, NASPortId, FramedIPAddress, \
+                               CallingStationId, FramedProtocol \
+                               FROM ${acct_table1} \
+                               WHERE UserName='%{SQL-User-Name}' \
+                               AND AcctStopTime = 0"
 
        #######################################################################
        # Group Membership Queries