--------------------- PatchSet 2560 Date: 2001/06/25 14:39:27 Author: rbcollins Branch: ntlm Tag: (none) Log: attempt to support cross-rotate persistent helpers Members: src/auth/ntlm/auth_ntlm.c:1.1.10.14.2.17->1.1.10.14.2.18 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.17 retrieving revision 1.1.10.14.2.18 diff -u -r1.1.10.14.2.17 -r1.1.10.14.2.18 --- squid/src/auth/ntlm/auth_ntlm.c 18 May 2001 01:09:28 -0000 1.1.10.14.2.17 +++ squid/src/auth/ntlm/auth_ntlm.c 25 Jun 2001 14:39:27 -0000 1.1.10.14.2.18 @@ -74,6 +74,7 @@ static HLPSONEQ authenticateNTLMHelperServerOnEmpty; static statefulhelper *ntlmauthenticators = NULL; +static wordlist *ntlmprevauthline = NULL; CBDATA_TYPE(authenticateStateData); @@ -92,17 +93,38 @@ * */ +static int +wordliststrcmp (wordlist *a, wordlist *b) +{ + int i; + while (a && b) { + if ((i = strcmp(a->key, b->key))) + return i; + a = a->next; + b = b->next; + } + if (a &! b) + return -1; + if (b &! a) + return 1; + return 0; +} + void authNTLMDone(void) { debug(29, 2) ("authNTLMDone: shutting down NTLM authentication.\n"); +#if 0 if (ntlmauthenticators) helperStatefulShutdown(ntlmauthenticators); +#endif authntlm_initialised = 0; if (!shutting_down) return; - if (ntlmauthenticators) + if (ntlmauthenticators) { + helperStatefulShutdown(ntlmauthenticators); helperStatefulFree(ntlmauthenticators); + } ntlmauthenticators = NULL; if (ntlm_helper_state_pool) { assert(memPoolInUseCount(ntlm_helper_state_pool) == 0); @@ -242,7 +264,14 @@ ntlmauthenticators->datapool = ntlm_helper_state_pool; ntlmauthenticators->IsAvailable = authenticateNTLMHelperServerAvailable; ntlmauthenticators->OnEmptyQueue = authenticateNTLMHelperServerOnEmpty; - helperStatefulOpenServers(ntlmauthenticators); + if (wordliststrcmp(ntlmprevauthline, ntlmConfig->authenticate)) { + helperStatefulShutdown(ntlmauthenticators); + helperStatefulOpenServers(ntlmauthenticators); + } else { + if (ntlmprevauthline) + wordlistDestroy (&ntlmprevauthline); + ntlmprevauthline = wordlistDup (ntlmConfig->authenticate); + } /* TODO: In here send the initial YR to preinitialise the challenge cache */ /* Think about this... currently we ask when the challenge is needed. Better? */ if (!ntlminit) {