From e2e22b45b14cae630587bc662a8bfcda98b04510 Mon Sep 17 00:00:00 2001 From: paulr Date: Mon, 6 Dec 2010 17:12:52 +1100 Subject: [PATCH] renamed files --- authserver/authd/authd.php | 19 +++++----- authserver/lib/authClient.php | 5 ++- authserver/www/actions.php | 68 ------------------------------------ authserver/www/admin.php | 6 ++-- authserver/www/admin_actions.php | 70 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 86 insertions(+), 82 deletions(-) delete mode 100644 authserver/www/actions.php create mode 100644 authserver/www/admin_actions.php diff --git a/authserver/authd/authd.php b/authserver/authd/authd.php index 3a52041..3f723e5 100644 --- a/authserver/authd/authd.php +++ b/authserver/authd/authd.php @@ -50,27 +50,28 @@ if($pid == -1) { break; case MSG_GET_OTK_PNG: - if(!isset($msg["username"])) { + if(!isset($msg["otk"])) { msg_send($cl_queue, MSG_GET_OTK_PNG, false); } else { - $username = $msg["username"]; - $sql = "select users_otk from users where users_username='$username'"; + $otk = $msg["otk"]; + $sql = "select users_username from users where users_otk='$otk'"; $dbo = getDatabase(); $res = $dbo->query($sql); - $otk = ""; + $username = ""; foreach($res as $row) { - $otk = $row["users_otk"]; + $username = $row["users_username"]; } - if($otk == "") { + if($username == "") { msg_send($cl_queue, MSG_GET_OTK_PNG, false); } else { $hand = fopen("otks/$otk.png", "rb"); $data = fread($hand, filesize("otks/$otk.png")); fclose($hand); - unlink("otks/$otk.png"); - $sql = "update users set users_otk='' where users_username='$username'"; - $dbo->query($sql); + //unlink("otks/$otk.png"); + //$sql = "update users set users_otk='' where users_username='$username'"; + //$dbo->query($sql); + error_log("senting otk, fsize: ".filesize("otks/$otk.png")." $otk "); msg_send($cl_queue, MSG_GET_OTK_PNG, $data); } } diff --git a/authserver/lib/authClient.php b/authserver/lib/authClient.php index 58de4ec..e1b941f 100644 --- a/authserver/lib/authClient.php +++ b/authserver/lib/authClient.php @@ -55,7 +55,7 @@ class GAAuthClient { return $msg; } - function getOtkPng($username) { + function getOtkPng($otk) { global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT; @@ -71,7 +71,8 @@ class GAAuthClient { $cl_queue = msg_get_queue($MSG_QUEUE_KEY_ID_CLIENT); $sr_queue = msg_get_queue($MSG_QUEUE_KEY_ID_SERVER); - $message["username"] = $username; + $message["otk"] = $otk; + error_log("sending message, $otk"); msg_send($sr_queue, MSG_GET_OTK_PNG, $message, true, true, $msg_err); msg_receive($cl_queue, 0, $msg_type, 16384, $msg); diff --git a/authserver/www/actions.php b/authserver/www/actions.php deleted file mode 100644 index 2d2ca9c..0000000 --- a/authserver/www/actions.php +++ /dev/null @@ -1,68 +0,0 @@ -authUserPass($username, $password)) { - $_SESSION["loggedin"] = true; - $_SESSION["username"] = $username; - header("Location: index.php"); - } else { - header("Location: index.php?message=loginfail"); - } - - exit(0); - break; - case "logout": - $_SESSION["loggedin"] = false; - $_SESSION["username"] = ""; - header("Location: index.php"); - exit(0); - break; - case "createuser": - $username = $_REQUEST["username"]; - $myAC->addUser($username); - header("Location: index.php"); - exit(0); - break; - case "update": - error_log("would update"); - $err = print_r($_REQUEST, true); - error_log("req: $err\n"); - $username = $_REQUEST["username"]; - if($_REQUEST["realname"]!="") { - $myAC->setUserRealName($username, $_REQUEST["realname"]); - } - if($_REQUEST["password"]!= "") { - $myAC->setUserPass($username, $_REQUEST["password"]); - } - break; - case "delete": - $username = $_REQUEST["username"]; - $myAC->deleteUser($username); - break; - case "deletepass": - $username = $_REQUEST["username"]; - $myAC->setUserPass($username, ""); - break; - case "getotk": - $username = $_REQUEST["username"]; - $otk = $myAC->getOtkPng($username); - header("Content-type: image/png"); - echo $otk; - exit(0); - break; - } -} -?> \ No newline at end of file diff --git a/authserver/www/admin.php b/authserver/www/admin.php index fa6f6df..b47978f 100644 --- a/authserver/www/admin.php +++ b/authserver/www/admin.php @@ -29,13 +29,13 @@ foreach($users as $user) { if($user["realname"] == "") $realname = ""; else $realname = $user["realname"]; - if($user["haspass"]) $haspass = "Yes Delete Password"; + if($user["haspass"]) $haspass = "Yes Delete Password"; else $haspass = "No "; if($user["hastoken"]) $hastoken = "Yes"; else $hastoken = "No"; - if($user["otk"]!="") $otk = "Get"; + if($user["otk"]!="") $otk = "Get"; else $otk = "Already Claimed"; $delete = "Delete"; @@ -45,7 +45,7 @@ foreach($users as $user) { } ?>
-
Create User:
+
Create User(s) - Enter a comma seperated list of names:

Radius Clients

Not yet implemented diff --git a/authserver/www/admin_actions.php b/authserver/www/admin_actions.php new file mode 100644 index 0000000..d6a224c --- /dev/null +++ b/authserver/www/admin_actions.php @@ -0,0 +1,70 @@ +authUserPass($username, $password)) { + $_SESSION["loggedin"] = true; + $_SESSION["username"] = $username; + header("Location: admin.php"); + } else { + header("Location: admin.php?message=loginfail"); + } + + exit(0); + break; + case "logout": + $_SESSION["loggedin"] = false; + $_SESSION["username"] = ""; + header("Location: admin.php"); + exit(0); + break; + case "createuser": + $username = $_REQUEST["username"]; + $myAC->addUser($username); + header("Location: admin.php"); + exit(0); + break; + case "update": + error_log("would update"); + $err = print_r($_REQUEST, true); + error_log("req: $err\n"); + $username = $_REQUEST["username"]; + if($_REQUEST["realname"]!="") { + $myAC->setUserRealName($username, $_REQUEST["realname"]); + } + if($_REQUEST["password"]!= "") { + $myAC->setUserPass($username, $_REQUEST["password"]); + } + break; + case "delete": + $username = $_REQUEST["username"]; + $myAC->deleteUser($username); + break; + case "deletepass": + $username = $_REQUEST["username"]; + $myAC->setUserPass($username, ""); + break; + case "getotkimg": + + $otk = $_REQUEST["otk"]; + error_log("requesting otk, $otk"); + $otk_img = $myAC->getOtkPng($otk); + header("Content-type: image/png"); + echo $otk_img; + exit(0); + break; + } +} +?> \ No newline at end of file -- 1.7.0.4