diff -ur squid_ntlm.orig/src/acl.c squid_ntlm/src/acl.c --- squid_ntlm.orig/src/acl.c Tue Jul 11 12:36:22 2000 +++ squid_ntlm/src/acl.c Fri Jul 14 14:50:03 2000 @@ -1159,6 +1159,7 @@ #if USE_NTLM case 2: /* Send an NTLM challenge */ checklist->auth_state = AUTHENTICATE_STATE_CHALLENGE; + checklist->auth_type=type; /* FALLTHROUGH */ #endif case 0: /* User denied access */ Only in squid_ntlm/src: acl.o Only in squid_ntlm/src: asn.o diff -ur squid_ntlm.orig/src/authenticate.c squid_ntlm/src/authenticate.c --- squid_ntlm.orig/src/authenticate.c Tue Jul 11 12:36:22 2000 +++ squid_ntlm/src/authenticate.c Fri Jul 14 14:56:46 2000 @@ -34,7 +34,7 @@ */ #include "squid.h" -#ifdef USE_NTLM +#if USE_NTLM #include "ntlm.h" #endif @@ -106,7 +106,7 @@ r->data = data; r->auth_user = auth_user; -#ifdef USE_NTLM +#if USE_NTLM if (Config.authenticate_ntlm_domain != NULL) { /* These fields can be NULL ... */ if (auth_user->user == NULL || auth_user->user[0] == '\0') @@ -165,47 +165,46 @@ void authenticateFixErrorHeader(HttpReply * rep, int type, int auth_type, int auth_state) { - char *fmt="UNKNOWN", *data=NULL; -#ifdef USE_NTLM - struct ntlm_challenge chal; - int len; + char *fmt="UNKNOWN", *data=NULL; +#if USE_NTLM + struct ntlm_challenge chal; + int len; #endif - - switch (auth_type) { - case AUTHENTICATE_TYPE_BASIC: - httpHeaderPutStrf(&rep->header, type, "Basic realm=\"%s\"", Config.proxyAuthRealm); - break; -#ifdef USE_NTLM - case AUTHENTICATE_TYPE_NTLM: -/* if (Config.authenticate_ntlm_domain == NULL) */ - - if (auth_state) { + + switch (auth_type) { + case AUTHENTICATE_TYPE_BASIC: + httpHeaderPutStrf(&rep->header, type, "Basic realm=\"%s\"", Config.proxyAuthRealm); + break; +#if USE_NTLM + case AUTHENTICATE_TYPE_NTLM: + /* if (Config.authenticate_ntlm_domain == NULL) */ + + if (auth_state) { ntlmMakeChallenge(&chal); - fmt = "NTLM %s"; - len = sizeof(chal) - sizeof(chal.pad) + SSWAP(chal.target.maxlen); - debug(29, 5) ("authenticateFixErrorHeader: len: %d\n", len); - data = (char *)base64_encode_bin((char *)&chal, len); - } else { - fmt = "NTLM"; - } - httpHeaderPutStrf(&rep->header, type, fmt, data); - break; + fmt = "NTLM %s"; + len = sizeof(chal) - sizeof(chal.pad) + SSWAP(chal.target.maxlen); + debug(29, 5) ("authenticateFixErrorHeader: len: %d\n", len); + data = (char *)base64_encode_bin((char *)&chal, len); + } else { + fmt = "NTLM"; + } + httpHeaderPutStrf(&rep->header, type, fmt, data); + break; #endif - case AUTHENTICATE_TYPE_NONE: - /* Not yet known. Send all supported methods to the client */ - httpHeaderPutStrf(&rep->header, type, "Basic realm=\"%s\"", Config.proxyAuthRealm); -#ifdef USE_NTLM - httpHeaderPutStrf(&rep->header, type, "NTLM"); + case AUTHENTICATE_TYPE_NONE: + /* Not yet known. Send all supported methods to the client */ +#if USE_NTLM + httpHeaderPutStrf(&rep->header, type, "NTLM"); #endif - break; - default: - fatal("Error: Unknown authentication type\n"); - break; - } - + httpHeaderPutStrf(&rep->header, type, "Basic realm=\"%s\"", Config.proxyAuthRealm); + break; + default: + fatal("Error: Unknown authentication type\n"); + break; + } } -#ifdef USE_NTLM +#if USE_NTLM /* NTLM authentication by ad@netbsd.org - 07/1999 */ /* XXX this is not done cleanly... */ diff -ur squid_ntlm.orig/src/carp.c squid_ntlm/src/carp.c --- squid_ntlm.orig/src/carp.c Tue Jul 11 12:36:22 2000 +++ squid_ntlm/src/carp.c Thu Jul 13 17:29:35 2000 @@ -85,7 +85,7 @@ peer * carpSelectParent(request_t * request) { -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> ((size(u_long)*8)-(n)))) +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> ((sizeof(u_long)*8)-(n)))) const char *c; peer *p = NULL; peer *tp; diff -ur squid_ntlm.orig/src/ftp.c squid_ntlm/src/ftp.c --- squid_ntlm.orig/src/ftp.c Tue Jul 11 12:36:22 2000 +++ squid_ntlm/src/ftp.c Thu Jul 13 17:32:33 2000 @@ -863,6 +863,7 @@ StoreEntry *entry = ftpState->entry; size_t read_sz; #if DELAY_POOLS + MemObject *mem = entry->mem_obj; delay_id delay_id = delayMostBytesAllowed(mem); #endif assert(fd == ftpState->data.fd); diff -ur squid_ntlm.orig/src/structs.h squid_ntlm/src/structs.h --- squid_ntlm.orig/src/structs.h Tue Jul 11 12:36:22 2000 +++ squid_ntlm/src/structs.h Thu Jul 13 17:28:42 2000 @@ -152,7 +152,7 @@ struct in_addr my_addr; unsigned short my_port; request_t *request; -#if USE_IDENT +#if USE_IDENT || USE_NTLM ConnStateData *conn; /* hack for ident */ char ident[USER_IDENT_SZ]; #endif