fixes
[matches/MCTX3420.git] / server / fastcgi.c
index af92efd..525e964 100644 (file)
@@ -46,8 +46,7 @@ static void IdentifyHandler(FCGIContext *context, char *params)
        FCGI_BeginJSON(context, STATUS_OK);
        FCGI_JSONPair("description", "MCTX3420 Server API (2013)");
        FCGI_JSONPair("build_date", __DATE__ " " __TIME__);
-       struct timespec t;
-       t.tv_sec = 0; t.tv_nsec = 0;
+       struct timespec t = {0};
        clock_getres(CLOCK_MONOTONIC, &t);
        FCGI_JSONDouble("clock_getres", TIMEVAL_TO_DOUBLE(t));
        FCGI_JSONLong("api_version", API_VERSION);
@@ -591,13 +590,21 @@ void * FCGI_RequestLoop (void *data)
                
                if (module_handler) 
                {
-                       if (g_options.auth_method != AUTH_NONE && module_handler != Login_Handler && module_handler != IdentifyHandler && module_handler)
+                       if (module_handler != Login_Handler && module_handler != IdentifyHandler && module_handler)
                        //if (false) // Testing
                        {
                                if (!FCGI_HasControl(&context))
                                {
-                                       FCGI_RejectJSON(&context, "Please login. Invalid control key.");
-                                       continue;       
+                                       if (g_options.auth_method == AUTH_NONE)
+                                       {       //:(
+                                               Log(LOGWARN, "Locking control (no auth!)");
+                                               FCGI_LockControl(&context, NOAUTH_USERNAME, USER_ADMIN);
+                                       }
+                                       else
+                                       {
+                                               FCGI_RejectJSON(&context, "Please login. Invalid control key.");
+                                               continue;
+                                       }
                                }
 
                                //Escape all special characters.

UCC git Repository :: git.ucc.asn.au