it actually works, fuck me
[ga4php.git] / authserver / lib / lib.php
index 0d6ab36..d0856b0 100644 (file)
@@ -1,8 +1,7 @@
 <?php
 
-if(!isset($MSG_QUEUE_KEY_ID_SERVER)) $MSG_QUEUE_KEY_ID_SERVER = "189751072"; // i would use ftok, but its crap
-if(!isset($MSG_QUEUE_KEY_ID_CLIENT)) $MSG_QUEUE_KEY_ID_CLIENT = "189751073"; // ftok is not ok!
-global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT;
+if(!isset($TCP_PORT_NUMBER)) $TCP_PORT_NUMBER = 21446;
+global $TCP_PORT_NUMBER;
 
 define("MSG_AUTH_USER_TOKEN", 1);
 define("MSG_ADD_USER_TOKEN", 2);
@@ -23,6 +22,7 @@ define("MSG_REMOVE_RADIUS_CLIENT", 16);
 define("MSG_ADD_RADIUS_CLIENT", 17);
 
 // BASE_DIR = 
+// messy
 $BASE_DIR = realpath(dirname(__FILE__)."/../../");
 global $BASE_DIR;
 
@@ -44,7 +44,9 @@ function generateRandomString()
 function updateRadius()
 {
        // this is hardcoded for now.
+       //$clientfile = "/etc/freeradius/clients.conf";
        $clientfile = "/tmp/clients.conf";
+       $reloadinit = "/etc/init.d/freeradius restart";
        
        $db = getDatabase();
        
@@ -56,10 +58,12 @@ function updateRadius()
                $cname = $row["rad_name"];
                $cip = $row["rad_ip"];
                $csec = $row["rad_secret"];
-               $lines = "client $cname {\nipaddr = $cip\nsecret = $csec\nrequire_message_authenticator = no\n}";
+               $lines = "client $cname {\nipaddr = $cip\nsecret = $csec\nrequire_message_authenticator = no\n}\n\n";
                fwrite($hand, $lines);
        }
        fclose($hand);
+       // not yet
+       //system($reloadinit);
 }