X-Git-Url: http://git.pjr.cc/?a=blobdiff_plain;f=authserver%2Fusercmd.php;h=1d4db80da87403f0c8f6c5e97097da3708f6f9d7;hb=684d7cc6c2ce6ba3f1ca5c48dda5c4efa9448455;hp=aad5e3a14da552e76cc146c4ab98cdb20c3681ca;hpb=34cbcba6d0f7c0a92c849545712cc5ce7ec03f97;p=ga4php.git diff --git a/authserver/usercmd.php b/authserver/usercmd.php index aad5e3a..1d4db80 100644 --- a/authserver/usercmd.php +++ b/authserver/usercmd.php @@ -35,20 +35,40 @@ if(!isset($argv[1])) { echo "\tsettoken: settoken - sets the key (hex) for a token\n"; echo "\tsettype: settype - sets a token type for a user\n"; echo "\tgetusers: getusers - gets a list of users\n"; - echo "\tgetotk: getotk - gets the OTK png for a key\n"; + echo "\tgetotk: getotk - gets the OTKID for a key\n"; + 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"; return 0; } switch($argv[1]) { + case "tokentype": + $msg = $myAC->getUserTokenType($argv[2]); + echo "token type: $msg\n"; + break; + case "synctoken": + if($myAC->syncUserToken($argv[2], $argv[3], $argv[4])) { + echo "Token synced\n"; + } else { + echo "Token not synced\n"; + } + break; + case "radauth": + if($myAC->authUserToken($argv[2], $argv[3])==1) { + syslog(LOG_WARNING, "Got good request for user, ".$argv[2]); + exit(0); + } else { + syslog(LOG_WARNING, "Got bad request for user, ".$argv[2]); + exit(255); + } + break; case "getotk": - $val = $myAC->getOtkPng($argv[2]); + $val = $myAC->getOtkID($argv[2]); if($val === false) { echo "Failure\n"; } else { - $hand = fopen("val.png", "w"); - fwrite($hand, $val); - fclose($hand); - echo "In val.png\n"; + echo "$val\n"; } break; case "auth":