X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Ffastcgi.c;h=cdaef79083b0c599231ed26910b896d3ad914601;hb=725ecf0f529c604ce67da5d281a95ba9e8b68e36;hp=3218a589e494c9c4513a58e67647de72ea746ba5;hpb=8dfd2def9f3c84c4d85c073d07912a22e107713f;p=matches%2FMCTX3420.git diff --git a/server/fastcgi.c b/server/fastcgi.c index 3218a58..cdaef79 100644 --- a/server/fastcgi.c +++ b/server/fastcgi.c @@ -52,22 +52,22 @@ static void IdentifyHandler(FCGIContext *context, char *params) { if (ident_sensors) { FCGI_JSONKey("sensors"); FCGI_JSONValue("{\n\t\t"); - for (i = 0; i < NUMSENSORS; i++) { + for (i = 0; i < g_num_sensors; i++) { if (i > 0) { FCGI_JSONValue(",\n\t\t"); } - FCGI_JSONValue("\"%d\" : \"%s\"", i, g_sensor_names[i]); + FCGI_JSONValue("\"%d\" : \"%s\"", i, Sensor_GetName(i)); } FCGI_JSONValue("\n\t}"); } if (ident_actuators) { FCGI_JSONKey("actuators"); FCGI_JSONValue("{\n\t\t"); - for (i = 0; i < NUMACTUATORS; i++) { + for (i = 0; i < g_num_actuators; i++) { if (i > 0) { FCGI_JSONValue(",\n\t\t"); } - FCGI_JSONValue("\"%d\" : \"%s\"", i, g_actuator_names[i]); + FCGI_JSONValue("\"%d\" : \"%s\"", i, Actuator_GetName(i)); } FCGI_JSONValue("\n\t}"); } @@ -507,17 +507,12 @@ void * FCGI_RequestLoop (void *data) if (module_handler) { - if (module_handler != Login_Handler && module_handler != IdentifyHandler) + //if (module_handler != Login_Handler && module_handler != IdentifyHandler) + if (false) // Testing { - if (cookie[0] == '\0') - { - FCGI_RejectJSONEx(&context, STATUS_UNAUTHORIZED, "Please login."); - continue; - } - if (!FCGI_HasControl(&context, cookie)) { - FCGI_RejectJSON(&context, "Invalid control key."); + FCGI_RejectJSON(&context, "Please login. Invalid control key."); continue; } @@ -532,9 +527,6 @@ void * FCGI_RequestLoop (void *data) { FCGI_RejectJSON(&context, "Unhandled module"); } - - - } Log(LOGDEBUG, "Thread exiting.");