X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Ffastcgi.c;h=af92efdeae0cf67a468f2c91ec1166be4f4c09c4;hb=2c380e71b15c2fc7fd5a4d3d5e1bbbfc46ba58f9;hp=f68bc4fe2ba1f56713230f3e118e9f190b410350;hpb=8c5bba9863ed029b83766d8b4de1195aa38b1f5d;p=matches%2FMCTX3420.git diff --git a/server/fastcgi.c b/server/fastcgi.c index f68bc4f..af92efd 100644 --- a/server/fastcgi.c +++ b/server/fastcgi.c @@ -197,18 +197,17 @@ void FCGI_GetControlCookie(char buffer[CONTROL_KEY_BUFSIZ]) const char *cookies = getenv("COOKIE_STRING"); const char *start = strstr(cookies, "mctxkey="); + *buffer = 0; //Clear the buffer if (start != NULL) { - const char *end; - size_t limit = CONTROL_KEY_BUFSIZ; - start += 8; //Ah, magic numbers (the length of mctxkey= - 1) - end = strchr(start, ';'); - if (end != NULL && (end-start) < CONTROL_KEY_BUFSIZ) { - limit = (end-start) + 1; + int i; + start += 8; //length of mctxkey= + for (i = 0; i < CONTROL_KEY_BUFSIZ; i++) { + if (*start == 0 || *start == ';') { + break; + } + buffer[i] = *start++; } - snprintf(buffer, limit, "%s", start); - Log(LOGDEBUG, "buf: %s", buffer); - } else { - *buffer = 0; + buffer[i] = 0; } } @@ -592,7 +591,7 @@ void * FCGI_RequestLoop (void *data) if (module_handler) { - if (module_handler != Login_Handler && module_handler != IdentifyHandler && module_handler) + if (g_options.auth_method != AUTH_NONE && module_handler != Login_Handler && module_handler != IdentifyHandler && module_handler) //if (false) // Testing { if (!FCGI_HasControl(&context))