X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=authserver%2Flib%2FauthClient.php;h=9b8480f38c1a6991a88c9d643332398864b724e6;hp=ba6c2ff83c0cf0bb4984ffaed6602bc8e5eb74e9;hb=c3c37cd9f486175adf0351de80c19efd02892ca6;hpb=684d7cc6c2ce6ba3f1ca5c48dda5c4efa9448455 diff --git a/authserver/lib/authClient.php b/authserver/lib/authClient.php index ba6c2ff..9b8480f 100644 --- a/authserver/lib/authClient.php +++ b/authserver/lib/authClient.php @@ -3,6 +3,34 @@ require_once("lib.php"); class GAAuthClient { + function addRadiusClient($clientname, $clientip, $clientsecret, $clientdesc) { + global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT; + + + if(!msg_queue_exists($MSG_QUEUE_KEY_ID_SERVER)) { + return false; + } + + if(!msg_queue_exists($MSG_QUEUE_KEY_ID_CLIENT)) { + return false; + } + // TODO we need to setup a client queue sem lock here + + $cl_queue = msg_get_queue($MSG_QUEUE_KEY_ID_CLIENT); + $sr_queue = msg_get_queue($MSG_QUEUE_KEY_ID_SERVER); + + + $message["clientname"] = $clientname; + $message["clientsecret"] = $clientsecret; + $message["clientip"] = $clientip; + $message["clientdescription"] = $clientdesc; + + msg_send($sr_queue, MSG_ADD_RADIUS_CLIENT, $message, true, true, $msg_err); + + msg_receive($cl_queue, 0, $msg_type, 16384, $msg); + return $msg; + } + function syncUserToken($username, $tokenone, $tokentwo) { global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT; @@ -26,8 +54,7 @@ class GAAuthClient { msg_send($sr_queue, MSG_SYNC_TOKEN, $message, true, true, $msg_err); msg_receive($cl_queue, 0, $msg_type, 16384, $msg); - return $msg; - + return $msg; } function getUserTokenType($username) {