]> git.gsnw.org Git - m0n0chwall.git/commitdiff
Activate the radius accounting code to allow more then 1 radius server for accounting...
authorjdegraeve <jdegraeve@e36fee2c-cc09-0410-a7cc-ebac5c6737de>
Fri, 31 Mar 2006 09:02:21 +0000 (09:02 +0000)
committerjdegraeve <jdegraeve@e36fee2c-cc09-0410-a7cc-ebac5c6737de>
Fri, 31 Mar 2006 09:02:21 +0000 (09:02 +0000)
git-svn-id: https://svn.m0n0.ch/wall/trunk@120 e36fee2c-cc09-0410-a7cc-ebac5c6737de

captiveportal/index.php
captiveportal/radius_accounting.inc
phpconf/inc/captiveportal.inc
webgui/services_captiveportal.php

index 100d3324c7d9a85401808718bb9e09e310204102..b493cba7a3175e82be569b0ea3aacf52bd6c1862 100755 (executable)
@@ -281,9 +281,7 @@ function portal_allow($clientip,$clientmac,$clientuser,$password = null, $attrib
                                        $cpdb[$i][4], // username
                                        $cpdb[$i][5], // sessionid
                                        $cpdb[$i][0], // start time
-                                       $radiusservers[0]['ipaddr'],
-                                       $radiusservers[0]['acctport'],
-                                       $radiusservers[0]['key'],
+                                       $radiusservers,
                                        $cpdb[$i][2], // clientip
                                        $cpdb[$i][3], // clientmac
                                        13); // Port Preempted
@@ -406,9 +404,7 @@ function disconnect_client($sessionid, $logoutReason = "LOGOUT", $term_cause = 1
                                        $cpdb[$i][4], // username
                                        $cpdb[$i][5], // sessionid
                                        $cpdb[$i][0], // start time
-                                       $radiusservers[0]['ipaddr'],
-                                       $radiusservers[0]['acctport'],
-                                       $radiusservers[0]['key'],
+                                       $radiusservers,
                                        $cpdb[$i][2], // clientip
                                        $cpdb[$i][3], // clientmac
                                        $term_cause);
index 9f9064d532e0b55d79f0d65c806d95f18b364666..ad2d0aad64691209272bc51e34899ecb61c752f9 100644 (file)
@@ -43,7 +43,7 @@ RADIUS ACCOUNTING START
 -----------------------
 */
 
-function RADIUS_ACCOUNTING_START($ruleno,$username,$sessionid,$radiusip,$radiusport,$radiuskey,$clientip,$clientmac) {
+function RADIUS_ACCOUNTING_START($ruleno,$username,$sessionid,$radiusservers,$clientip,$clientmac) {
 
     global $config;
 
@@ -67,6 +67,14 @@ function RADIUS_ACCOUNTING_START($ruleno,$username,$sessionid,$radiusip,$radiusp
     // Create our instance
     $racct = new Auth_RADIUS_Acct_Start;
 
+    // Initialise our server
+    foreach ($radiusservers as $radsrv) {
+
+        // Add a new server to our instance
+        $racct->addServer($radsrv['ipaddr'], $radsrv['port'], $radsrv['key']);
+
+    }
+
     /* Different Authentication options
      *
      * Its possible todo other authentication methods but still do radius accounting
@@ -80,7 +88,6 @@ function RADIUS_ACCOUNTING_START($ruleno,$username,$sessionid,$radiusip,$radiusp
 
     // Construct data package
     $racct->username = $username;
-    $racct->addServer($radiusip, $radiusport, $radiuskey);
 
     if (PEAR::isError($racct->start())) {
         $retvalue['acct_val'] = 1;
@@ -91,14 +98,6 @@ function RADIUS_ACCOUNTING_START($ruleno,$username,$sessionid,$radiusip,$radiusp
         $racct->close();
         return $retvalue;
 
-        /* Old code:
-         * $status = $racct->start();
-         * if(PEAR::isError($status)) {
-         *    if ($debug)
-         *        printf("Radius start: %s<br>\n", $status->getMessage());
-         *        exit;
-         * }
-         */
     }
 
     /*
@@ -149,7 +148,7 @@ RADIUS ACCOUNTING STOP/UPDATE
 -----------------------------
 */
 
-function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusip,$radiusport,$radiuskey,$clientip,$clientmac, $term_cause = 1, $interimupdate=false,$stop_time = null) {
+function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radiusservers,$clientip,$clientmac, $term_cause = 1, $interimupdate=false,$stop_time = null) {
 
     global $config;
 
@@ -183,26 +182,19 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
     else
         $racct = new Auth_RADIUS_Acct_Stop;
 
-    /*
-     * Currently disabled
-    Add support for more then one radiusserver. 
-    At most 10 servers may be specified. 
-    When multiple servers are given, they are tried in round-robin fashion until a valid response is received 
-
+    // Initialise our server
     foreach ($radiusservers as $radsrv) {
 
         // Add a new server to our instance
         $racct->addServer($radsrv['ipaddr'], $radsrv['port'], $radsrv['key']);
 
     }
-    */
 
     // See RADIUS_ACCOUNTING_START for info
     $racct->authentic = RADIUS_AUTH_RADIUS;
 
     // Construct data package
     $racct->username = $username;
-    $racct->addServer($radiusip, $radiusport, $radiuskey);
     // Set session_time
     $racct->session_time = $session_time;
 
index 824948d322fc32ab08f18818d1712f5fe2c74d20..a2f8f456e77fde489af7c83120b62323db9653e7 100644 (file)
@@ -451,9 +451,7 @@ function captiveportal_prune_old() {
                                            $cpdb[$i][4], // username
                                            $cpdb[$i][5], // sessionid
                                            $cpdb[$i][0], // start time
-                                           $radiusservers[0]['ipaddr'],
-                                           $radiusservers[0]['acctport'],
-                                           $radiusservers[0]['key'],
+                                           $radiusservers,
                                            $cpdb[$i][2], // clientip
                                            $cpdb[$i][3], // clientmac
                                            10); // NAS Request
@@ -461,9 +459,7 @@ function captiveportal_prune_old() {
                     RADIUS_ACCOUNTING_START($cpdb[$i][1], // ruleno
                                             $cpdb[$i][4], // username
                                             $cpdb[$i][5], // sessionid
-                                            $radiusservers[0]['ipaddr'],
-                                            $radiusservers[0]['acctport'],
-                                            $radiusservers[0]['key'],
+                                            $radiusservers,
                                             $cpdb[$i][2], // clientip
                                             $cpdb[$i][3]); // clientmac
                 } else if ($config['captiveportal']['reauthenticateacct'] == "interimupdate") {
@@ -471,9 +467,7 @@ function captiveportal_prune_old() {
                                            $cpdb[$i][4], // username
                                            $cpdb[$i][5], // sessionid
                                            $cpdb[$i][0], // start time
-                                           $radiusservers[0]['ipaddr'],
-                                           $radiusservers[0]['acctport'],
-                                           $radiusservers[0]['key'],
+                                           $radiusservers,
                                            $cpdb[$i][2], // clientip
                                            $cpdb[$i][3], // clientmac
                                            10, // NAS Request
@@ -516,9 +510,7 @@ function captiveportal_disconnect($dbent, $radiusservers,$term_cause = 1,$stop_t
                                $dbent[4], // username
                                $dbent[5], // sessionid
                                $dbent[0], // start time
-                               $radiusservers[0]['ipaddr'],
-                               $radiusservers[0]['acctport'],
-                               $radiusservers[0]['key'],
+                               $radiusservers,
                                $dbent[2], // clientip
                                $dbent[3], // clientmac
                                $term_cause, // Acct-Terminate-Cause
@@ -582,9 +574,7 @@ function captiveportal_radius_stop_all() {
                                    $cpdb[$i][4], // username
                                    $cpdb[$i][5], // sessionid
                                    $cpdb[$i][0], // start time
-                                   $radiusservers[0]['ipaddr'],
-                                   $radiusservers[0]['acctport'],
-                                   $radiusservers[0]['key'],
+                                   $radiusservers,
                                    $cpdb[$i][2], // clientip
                                    $cpdb[$i][3], // clientmac
                                    7); // Admin Reboot
@@ -807,9 +797,7 @@ function radius($username,$password,$clientip,$clientmac,$type) {
             $auth_list['acct_val'] = RADIUS_ACCOUNTING_START($ruleno,
                                     $username,
                                     $sessionid,
-                                    $radiusservers[0]['ipaddr'],
-                                    $radiusservers[0]['acctport'],
-                                    $radiusservers[0]['key'],
+                                    $radiusservers,
                                     $clientip,
                                     $clientmac);
             if ($auth_list['acct_val'] == 1) 
index 99200e81453f8663b482a37f3d9829e35ba9dca6..c6752122afec1a84ba7aaa77d3bdff631321925c 100755 (executable)
@@ -409,7 +409,7 @@ to access after they've authenticated.</td>
                                <td class="vncell">&nbsp;</td>
                                <td class="vtable"><input name="radacct_enable" type="checkbox" id="radacct_enable" value="yes" onClick="enable_change(false)" <?php if($pconfig['radacct_enable']) echo "checked"; ?>>
                                <strong>send RADIUS accounting packets</strong><br>
-                               If this is enabled, RADIUS accounting packets will be sent to the primary RADIUS server.</td>
+                               If this is enabled, RADIUS accounting packets will be sent to the RADIUS server(s).</td>
                        </tr>
                        <tr>
                          <td class="vncell" valign="top">Accounting port</td>