--------------------- PatchSet 872 Date: 2000/11/27 16:52:48 Author: kinkie Branch: ntlm Tag: (none) Log: Added code to retry the authentication in case of certain errors Members: ntlm_auth_modules/NTLMSSP/libntlmssp.c:1.1.2.12->1.1.2.13 ntlm_auth_modules/NTLMSSP/ntlm.h:1.1.2.12->1.1.2.13 Index: squid/ntlm_auth_modules/NTLMSSP/libntlmssp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/ntlm_auth_modules/NTLMSSP/Attic/libntlmssp.c,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -u -r1.1.2.12 -r1.1.2.13 --- squid/ntlm_auth_modules/NTLMSSP/libntlmssp.c 10 Oct 2000 16:49:46 -0000 1.1.2.12 +++ squid/ntlm_auth_modules/NTLMSSP/libntlmssp.c 27 Nov 2000 16:52:48 -0000 1.1.2.13 @@ -24,6 +24,9 @@ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ +#ifdef HAVE_UNISTD_H +#include +#endif #include "smblib-priv.h" /* for SMB_Handle_Type */ @@ -212,7 +215,7 @@ int ntlm_errno; static char credentials[1024]; /* we can afford to waste */ char * ntlm_check_auth(struct ntlm_authenticate * auth, int auth_length) { - int rv; + int rv, retries=0; char pass[25]; char *domain=credentials; char *user; @@ -259,6 +262,13 @@ rv=SMB_Logon_Server(handle,user,pass,domain,1); + while ( (rv == NTLM_BAD_PROTOCOL || rv==NTLM_SERVER_ERROR) + && retries < BAD_DC_RETRIES_NUMBER) { + retries++; + usleep ((unsigned long)100000); + rv=SMB_Logon_Server(handle,user,pass,domain,1); + } + debug("\tresult is %d\n",rv); if (rv!=NTV_NO_ERROR){ /* failed */ Index: squid/ntlm_auth_modules/NTLMSSP/ntlm.h =================================================================== RCS file: /cvsroot/squid-sf//squid/ntlm_auth_modules/NTLMSSP/Attic/ntlm.h,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -u -r1.1.2.12 -r1.1.2.13 --- squid/ntlm_auth_modules/NTLMSSP/ntlm.h 10 Oct 2000 16:53:56 -0000 1.1.2.12 +++ squid/ntlm_auth_modules/NTLMSSP/ntlm.h 27 Nov 2000 16:52:48 -0000 1.1.2.13 @@ -66,6 +66,13 @@ extern time_t inactivity_timeout; +/* + * Number of retries when some kinds of errors occur with the Domain + * Controller. Keep it reasonable... + */ +#define BAD_DC_RETRIES_NUMBER 3 + + /************* END CONFIGURATION ***************/ #include