From d286526b902cde5c7313e43252e39ed11f04b545 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 6 Aug 2009 20:00:16 +0000 Subject: [PATCH] * Moved the call to GetAuthBasic() --- webcit/context_loop.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 78e4a6cbd..17c549174 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -141,6 +141,10 @@ wcsession *FindSession(wcsession **wclist, ParsedHttpHdrs *Hdr, pthread_mutex_t wcsession *sptr = NULL; wcsession *TheSession = NULL; + if (Hdr->HR.got_auth == AUTH_BASIC) { + GetAuthBasic(Hdr); + } + pthread_mutex_lock(ListMutex); for (sptr = *wclist; ((sptr != NULL) && (TheSession == NULL)); sptr = sptr->next) { @@ -150,7 +154,6 @@ wcsession *FindSession(wcsession **wclist, ParsedHttpHdrs *Hdr, pthread_mutex_t case AUTH_BASIC: if ( (Hdr->HR.SessionKey != sptr->SessionKey)) continue; - GetAuthBasic(Hdr); if ((!strcasecmp(ChrPtr(Hdr->c_username), ChrPtr(sptr->wc_username))) && (!strcasecmp(ChrPtr(Hdr->c_password), ChrPtr(sptr->wc_password))) ) { TheSession = sptr; @@ -175,8 +178,7 @@ wcsession *CreateSession(int Lockable, wcsession **wclist, ParsedHttpHdrs *Hdr, { wcsession *TheSession; lprintf(3, "Creating a new session\n"); - TheSession = (wcsession *) - malloc(sizeof(wcsession)); + TheSession = (wcsession *) malloc(sizeof(wcsession)); memset(TheSession, 0, sizeof(wcsession)); TheSession->Hdr = Hdr; TheSession->SessionKey = Hdr->HR.SessionKey; @@ -536,11 +538,6 @@ void context_loop(ParsedHttpHdrs *Hdr) if (TheSession == NULL) { TheSession = CreateSession(1, &SessionList, Hdr, &SessionListMutex); - /* Yes, theoretically we did this already, but for some reason c_username and c_password - * are already gone by now, so we fetch them again. - */ - GetAuthBasic(Hdr); - if ((StrLength(Hdr->c_username) == 0) && (!Hdr->HR.DontNeedAuth)) { if ((Hdr->HR.Handler != NULL) && -- 2.30.2