--------------------- PatchSet 885 Date: 2000/12/04 08:36:30 Author: rbcollins Branch: auth_rewrite Tag: (none) Log: NTLM Helper Protocol V3 support Members: ntlm_auth_modules/fakeauth/fakeauth_auth.c:1.1.2.6.2.2->1.1.2.6.2.3 Index: squid/ntlm_auth_modules/fakeauth/fakeauth_auth.c =================================================================== RCS file: /cvsroot/squid-sf//squid/ntlm_auth_modules/fakeauth/Attic/fakeauth_auth.c,v retrieving revision 1.1.2.6.2.2 retrieving revision 1.1.2.6.2.3 diff -u -r1.1.2.6.2.2 -r1.1.2.6.2.3 --- squid/ntlm_auth_modules/fakeauth/fakeauth_auth.c 20 Nov 2000 05:56:22 -0000 1.1.2.6.2.2 +++ squid/ntlm_auth_modules/fakeauth/fakeauth_auth.c 4 Dec 2000 08:36:30 -0000 1.1.2.6.2.3 @@ -15,6 +15,7 @@ #include "config.h" #include "ntlm.h" +#include "util.h" #include #if HAVE_STDIO_H @@ -187,7 +188,7 @@ { if (*sc == '\0' || !isprint (*sc)) { - fprintf (stderr, "ntlmGetString: bad ascii: %04x\n", c); + fprintf (stderr, "ntlmGetString: bad ascii: %04x\n", *sc); return (NULL); } *d++ = *sc++; @@ -257,7 +258,7 @@ char user[256], *p, *cleartext; struct ntlm_challenge chal; int len; - char *fmt = "UNKNOWN", *data = NULL; + char *data = NULL; setbuf (stdout, NULL); while (fgets (buf, 256, stdin) != NULL) @@ -266,6 +267,36 @@ if ((p = strchr (buf, '\n')) != NULL) *p = '\0'; /* strip \n */ +#if defined(NTLMHELPPROTOCOLV3) || !defined(NTLMHELPPROTOCOLV2) + if (strncasecmp (buf, "YR" ,2) == 0) + { + ntlmMakeChallenge (&chal); + len = + sizeof (chal) - sizeof (chal.pad) + + SSWAP (chal.target.maxlen); + data = (char *) base64_encode_bin ((char *) &chal, len); + printf ("TT %s\n", data); + } else if (strncasecmp (buf, "KK ",3) == 0) + { + cleartext = (char *) uudecode (buf); + if (!ntlmCheckHeader ((struct ntlmhdr *) cleartext, NTLM_AUTHENTICATE)) + { + if (!ntlmDecodeAuth((struct ntlm_authenticate *) cleartext, user, 256)) + { + lc (user); + printf ("AF %s\n", user); + } else { + lc (user); + printf ("NA %s\n", user); + } + } else { + lc (user); + printf ("BH %s\n", user); + } + } +#endif +#ifdef NTLMHELPPROTOCOLV2 +/* V2 of the protocol */ if (strncasecmp (buf, "RESET", 5) == 0) { printf ("RESET OK\n"); @@ -276,7 +307,6 @@ if (!ntlmCheckHeader ((struct ntlmhdr *) cleartext, NTLM_NEGOTIATE)) { ntlmMakeChallenge (&chal); - fmt = "NTLM %s"; len = sizeof (chal) - sizeof (chal.pad) + SSWAP (chal.target.maxlen); @@ -304,6 +334,7 @@ printf ("ERR %s\n", user); } } +#endif /*v2*/ } exit (0); }