X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Ffastcgi.c;h=525e964a3c0c94fe10279a096a7705129d9e213f;hb=f153e203bc4215026abd0dcce8427d633b5a6398;hp=af92efdeae0cf67a468f2c91ec1166be4f4c09c4;hpb=2c380e71b15c2fc7fd5a4d3d5e1bbbfc46ba58f9;p=matches%2FMCTX3420.git diff --git a/server/fastcgi.c b/server/fastcgi.c index af92efd..525e964 100644 --- a/server/fastcgi.c +++ b/server/fastcgi.c @@ -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.