X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=authserver%2Fusercmd.php;h=3525cbee1dba3f903cf010dfaed99c61edb05b46;hp=3adf83512c7a343f9c1fa7dcfe6222eee3ac9537;hb=da4ac26dcfd94c9f8b7e8e43f50f671bdd94dfd0;hpb=c3c37cd9f486175adf0351de80c19efd02892ca6 diff --git a/authserver/usercmd.php b/authserver/usercmd.php index 3adf835..3525cbe 100644 --- a/authserver/usercmd.php +++ b/authserver/usercmd.php @@ -39,17 +39,35 @@ if(!isset($argv[1])) { echo "\tradauth: radauth - for radius, only returns a code\n"; echo "\tsynctoken: synctoken - resync's a hotp token based on two token codes\n"; echo "\ttokentype: tokentype - gets the token type for a user\n"; - echo "\taddradclient: addradclient \n"; + echo "\taddradclient: addradclient \"\"- adds a radius client\n"; + echo "\trmradclient: rmradclient - removes a radius client with the name \n"; + echo "\tgetradclients: getradclients - returns a list of radius clients\n"; return 0; } switch($argv[1]) { - case "addradclient": - $msg = $myAC->addRadiusClient($argv[2], $argv[3], $argv[4], ""); + case "rmradclient": + $msg = $myAC->deleteRadiusClient($argv[2]); if($msg) { + echo "Successfully deleted\n"; + } + break; + case "getradclients": + $msg = $myAC->getRadiusClients(); + foreach($msg as $client) { + if($client["desc"]=="") $desc = "no description set"; + else $desc = $client["desc"]; + echo $client["name"]." is ".$client["ip"].", $desc\n"; + } + break; + case "addradclient": + $msg = $myAC->addRadiusClient($argv[2], $argv[3], $argv[4], $argv[5]); + if($msg === true) { echo "Added successfully\n"; - } else { - echo "Not added\n"; + } else if ($msg == "name") { + echo "Client with same name exists already\n"; + } else if ($msg == "ip") { + echo "Client with same IP already exists\n"; } break; case "tokentype":