--------------------- PatchSet 2700 Date: 2001/08/01 15:00:44 Author: rbcollins Branch: ntlm Tag: (none) Log: different solution to current race Members: src/auth/ntlm/auth_ntlm.c:1.1.10.14.2.31->1.1.10.14.2.32 src/auth/ntlm/auth_ntlm.h:1.1.8.6->1.1.8.7 Index: squid/src/auth/ntlm/auth_ntlm.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/ntlm/auth_ntlm.c,v retrieving revision 1.1.10.14.2.31 retrieving revision 1.1.10.14.2.32 diff -u -r1.1.10.14.2.31 -r1.1.10.14.2.32 --- squid/src/auth/ntlm/auth_ntlm.c 1 Aug 2001 14:38:31 -0000 1.1.10.14.2.31 +++ squid/src/auth/ntlm/auth_ntlm.c 1 Aug 2001 15:00:44 -0000 1.1.10.14.2.32 @@ -487,6 +487,8 @@ ntlm_request = auth_user_request->scheme_data; assert(ntlm_request != NULL); result = S_HELPER_DEFER; + /* reserve the server for future authentication */ + ntlm_request->authserver_deferred = 1; debug(29, 9) ("authenticateNTLMHandleReply: helper '%d'\n", lastserver); assert(ntlm_request->auth_state == AUTHENTICATE_STATE_NEGOTIATE); ntlm_request->authserver = lastserver; @@ -778,6 +780,10 @@ helperstate->challengeuses++; /* assign the challenge */ ntlm_request->authchallenge = xstrndup(helperstate->challenge, NTLM_CHALLENGE_SZ + 5); + /* we're not actually submitting a request, so we need to release the helper should + * the connection close unexpectedly + */ + ntlm_request->authserver_deferred = 1; handler(data, NULL); } @@ -796,8 +802,8 @@ assert (r->auth_user_request->auth_user); assert (r->auth_user_request->auth_user->scheme_data); #endif - - + /* getting rid of deferred request status */ + ntlm_request->authserver_deferred = 0; helperStatefulSubmit(ntlmauthenticators, buf, authenticateNTLMHandleReply, r, ntlm_request->authserver); debug(29, 9) ("authenticateNTLMstart: finished\n"); break; @@ -864,7 +870,7 @@ if (conn->auth_user_request != NULL) { assert(conn->auth_user_request->scheme_data != NULL); ntlm_request = conn->auth_user_request->scheme_data; - if (ntlm_request->authserver != NULL && ntlm_request->auth_state != AUTHENTICATE_STATE_RESPONSE) + if (ntlm_request->authserver != NULL && ntlm_request->authserver_deferred) authenticateNTLMReleaseServer(conn->auth_user_request); /* unlock the connection based lock */ debug(29, 9) ("authenticateNTLMOnCloseConnection: Unlocking auth_user from the connection.\n"); @@ -910,6 +916,7 @@ auth_user_request->auth_user->auth_type = AUTH_NTLM; auth_user_request->auth_user->scheme_data = memPoolAlloc(ntlm_user_pool); auth_user_request->scheme_data = memPoolAlloc(ntlm_request_pool); + memset (auth_user_request->scheme_data, '\0', sizeof (ntlm_request_t)); /* lock for the auth_user_request link */ authenticateAuthUserLock(auth_user_request->auth_user); node = dlinkNodeNew(); Index: squid/src/auth/ntlm/auth_ntlm.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/ntlm/auth_ntlm.h,v retrieving revision 1.1.8.6 retrieving revision 1.1.8.7 diff -u -r1.1.8.6 -r1.1.8.7 --- squid/src/auth/ntlm/auth_ntlm.h 17 May 2001 23:28:34 -0000 1.1.8.6 +++ squid/src/auth/ntlm/auth_ntlm.h 1 Aug 2001 15:00:44 -0000 1.1.8.7 @@ -32,6 +32,8 @@ helper_stateful_server *authserver; /* how far through the authentication process are we? */ auth_state_t auth_state; + /* have we got the helper-server in a deferred state? */ + int authserver_deferred; }; struct _ntlm_helper_state_t {