--------------------- PatchSet 3611 Date: 2002/01/23 23:36:40 Author: kinkie Branch: ntlm Tag: (none) Log: Minor style cleanups. Members: src/auth/ntlm/helpers/winbind/wb_ntlm_auth.c:1.1.2.12->1.1.2.13 src/auth/ntlm/helpers/winbind/wbntlm.h:1.1.2.5->1.1.2.6 Index: squid/src/auth/ntlm/helpers/winbind/wb_ntlm_auth.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/ntlm/helpers/winbind/Attic/wb_ntlm_auth.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/src/auth/ntlm/helpers/winbind/wb_ntlm_auth.c 20 Jan 2002 23:30:05 -0000 1.1.2.12 +++ squid/src/auth/ntlm/helpers/winbind/wb_ntlm_auth.c 23 Jan 2002 23:36:40 -0000 1.1.2.13 @@ -179,29 +179,32 @@ /* now the LM hash */ lmhash = ntlm_fetch_string((char *) auth, auth_length, &auth->lmresponse); - if (lmhash.l != 0 && lmhash.l != 24) { - authfail(domain,user,"Broken LM hash response"); - return; - } - if (lmhash.l==24) { - memcpy(request.data.auth_crap.lm_resp,lmhash.str,24); - request.data.auth_crap.lm_resp_len=24; - } else { + switch (lmhash.l) { + case 0: warn("No lm hash provided by user %s\\%s\n",domain,user); request.data.auth_crap.lm_resp_len=0; + break; + case 24: + memcpy(request.data.auth_crap.lm_resp,lmhash.str,24); + request.data.auth_crap.lm_resp_len=24; + break; + default: + authfail(domain,user,"Broken LM hash response"); + return; } nthash = ntlm_fetch_string((char *) auth, auth_length, &auth->ntresponse); - if (nthash.l != 0 && nthash.l != 24) { - authfail(domain,user,"Broken NT hash response"); - return; - } - if (nthash.l==0) { + switch (nthash.l) { + case 0: debug("no nthash\n"); request.data.auth_crap.nt_resp_len=0; - } else { /* now I'm sure it's 24 chars long */ + break; + case 24: memcpy(request.data.auth_crap.nt_resp,nthash.str,24); request.data.auth_crap.nt_resp_len=24; + default: + authfail(domain,user,"Broken NT hash response"); + return; } debug("Checking user '%s\\%s' lmhash='%24s', have_nthash=%d, " @@ -254,7 +257,7 @@ } if (strncmp(buf,"KK ",3) != 0 ) { /* not an auth-request */ helperfail("illegal request received"); - warn("Illegal request received\n"); + warn("Illegal request received: '%s'\n",buf); return; } /* At this point I'm sure it's a KK */ @@ -273,7 +276,7 @@ /* Understand what we got */ switch (fast_header->type) { case NTLM_NEGOTIATE: - authfail("-","-","Received negotiate request, was expecting authenticate"); + authfail("-","-","Received neg-request while expecting auth packet"); return; case NTLM_CHALLENGE: authfail("-","-","Received challenge. Refusing to abide"); Index: squid/src/auth/ntlm/helpers/winbind/wbntlm.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/ntlm/helpers/winbind/Attic/wbntlm.h,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- squid/src/auth/ntlm/helpers/winbind/wbntlm.h 4 Dec 2001 17:45:16 -0000 1.1.2.5 +++ squid/src/auth/ntlm/helpers/winbind/wbntlm.h 23 Jan 2002 23:37:12 -0000 1.1.2.6 @@ -33,8 +33,6 @@ /* the attempted entropy source. If it doesn't exist, random() is uesed */ #define ENTROPY_SOURCE "/dev/urandom" -#define DOMAIN "GCSINT" /* TODO: fix ntlm_make_challenge */ - /************* END CONFIGURATION *************/ /* Debugging stuff */