--------------------- PatchSet 1124 Date: 2001/01/06 17:36:36 Author: hno Branch: nt-2_4 Tag: (none) Log: Ported changes from nt-2_3 Members: src/access_log.c:1.4.4.1->1.4.4.1.2.1 src/authenticate.c:1.4->1.4.22.1 src/cache_cf.c:1.3.4.4->1.3.4.4.2.1 Index: squid/src/access_log.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/access_log.c,v retrieving revision 1.4.4.1 retrieving revision 1.4.4.1.2.1 diff -u -r1.4.4.1 -r1.4.4.1.2.1 --- squid/src/access_log.c 14 Nov 2000 13:33:28 -0000 1.4.4.1 +++ squid/src/access_log.c 6 Jan 2001 17:36:36 -0000 1.4.4.1.2.1 @@ -1,6 +1,6 @@ /* - * $Id: access_log.c,v 1.4.4.1 2000/11/14 13:33:28 adri Exp $ + * $Id: access_log.c,v 1.4.4.1.2.1 2001/01/06 17:36:36 hno Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -344,7 +344,11 @@ mcast_miss_to.sin_port = htons(Config.mcast_miss.port); mcast_miss_to.sin_addr.s_addr = Config.mcast_miss.addr.s_addr; mcast_miss_fd = comm_open(SOCK_DGRAM, +#ifdef _SQUID_MSWIN_ + IPPROTO_UDP, +#else 0, +#endif Config.Addrs.udp_incoming, Config.mcast_miss.port, COMM_NONBLOCKING, Index: squid/src/authenticate.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/authenticate.c,v retrieving revision 1.4 retrieving revision 1.4.22.1 diff -u -r1.4 -r1.4.22.1 --- squid/src/authenticate.c 3 Nov 2000 08:39:20 -0000 1.4 +++ squid/src/authenticate.c 6 Jan 2001 17:36:36 -0000 1.4.22.1 @@ -1,6 +1,6 @@ /* - * $Id: authenticate.c,v 1.4 2000/11/03 08:39:20 hno Exp $ + * $Id: authenticate.c,v 1.4.22.1 2001/01/06 17:36:36 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -43,7 +43,26 @@ static HLPCB authenticateHandleReply; static void authenticateStateFree(authenticateStateData * r); +#ifdef _SQUID_MSWIN_ +typedef int (*PFAuthenticate) (char *, char *, authenticateStateData *, HLPCB); +typedef int (*PFInit) (char *); + +typedef struct { + HINSTANCE hnd; + PFAuthenticate Authenticate; + PFInit Init; + struct { + int requests; + int replies; + int queue_size; + int avg_svc_time; + } stats; +} AuthPlugin; + +static AuthPlugin *authenticators = NULL; +#else static helper *authenticators = NULL; +#endif static void authenticateHandleReply(void *data, char *reply) @@ -75,7 +94,14 @@ authenticateStats(StoreEntry * sentry) { storeAppendPrintf(sentry, "Authenticator Statistics:\n"); +#ifdef _SQUID_MSWIN_ + storeAppendPrintf(sentry, "requests sent: %d\n", + authenticators->stats.requests); + storeAppendPrintf(sentry, "replies received: %d\n", + authenticators->stats.replies); +#else helperStats(sentry, authenticators); +#endif } /**** PUBLIC FUNCTIONS ****/ @@ -85,7 +111,9 @@ authenticateStart(acl_proxy_auth_user * auth_user, RH * handler, void *data) { authenticateStateData *r = NULL; +#ifndef _SQUID_MSWIN_ char buf[8192]; +#endif assert(auth_user); assert(handler); debug(29, 5) ("authenticateStart: '%s:%s'\n", hashKeyStr(&auth_user->hash), @@ -100,9 +128,15 @@ cbdataLock(data); r->data = data; r->auth_user = auth_user; +#ifdef _SQUID_MSWIN_ + authenticators->stats.requests++; + authenticators->Authenticate(hashKeyStr(r->auth_user->hash), r->auth_user->passwd, r, authenticateHandleReply); + authenticators->stats.replies++; +#else snprintf(buf, 8192, "%s %s\n", hashKeyStr(&r->auth_user->hash), r->auth_user->passwd); helperSubmit(authenticators, buf, authenticateHandleReply, r); +#endif } void @@ -111,12 +145,53 @@ static int init = 0; if (!Config.Program.authenticate) return; +#ifdef _SQUID_MSWIN_ + if (authenticators == NULL) + authenticators = xmalloc(sizeof(AuthPlugin)); + debug(29, 0) ("authenticateInit: Loading %s\n", Config.Program.authenticate->key); + authenticators->hnd = LoadLibrary(Config.Program.authenticate->key); + if (authenticators->hnd == NULL) { + debug(29, 0) ("authenticateInit: Unable to load %s\n", Config.Program.authenticate->key); + xfree(authenticators); + Config.Program.authenticate = NULL; + return; + } + authenticators->Authenticate = (PFAuthenticate) GetProcAddress(authenticators->hnd, "Authenticate"); + if (authenticators->Authenticate == NULL) { + debug(29, 0) ("authenticateInit: Invalid auth plugin %s\n", Config.Program.authenticate->key); + FreeLibrary(authenticators->hnd); + xfree(authenticators); + Config.Program.authenticate = NULL; + return; + } + authenticators->Init = (PFInit) GetProcAddress(authenticators->hnd, "Init"); + if (authenticators->Init == NULL) { + debug(29, 0) ("authenticateInit: Invalid auth plugin %s\n", Config.Program.authenticate->key); + FreeLibrary(authenticators->hnd); + xfree(authenticators); + Config.Program.authenticate = NULL; + return; + } + if (Config.Program.authenticate->next) { + debug(29, 0) ("authenticateInit: Initializing with group %s\n", Config.Program.authenticate->next->key); + authenticators->Init(Config.Program.authenticate->next->key); + } else { + debug(29, 0) ("authenticateInit: Missing auth plugin %s Parameter\n", Config.Program.authenticate->key); + FreeLibrary(authenticators->hnd); + xfree(authenticators); + Config.Program.authenticate = NULL; + return; + } + authenticators->stats.requests = 0; + authenticators->stats.replies = 0; +#else if (authenticators == NULL) authenticators = helperCreate("authenticator"); authenticators->cmdline = Config.Program.authenticate; authenticators->n_to_start = Config.authenticateChildren; authenticators->ipc_type = IPC_TCP_SOCKET; helperOpenServers(authenticators); +#endif if (!init) { cachemgrRegister("authenticator", "User Authenticator Stats", @@ -130,9 +205,14 @@ { if (!authenticators) return; +#ifdef _SQUID_MSWIN_ + FreeLibrary(authenticators->hnd); + xfree(authenticators); +#else helperShutdown(authenticators); if (!shutting_down) return; helperFree(authenticators); +#endif authenticators = NULL; } Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.3.4.4 retrieving revision 1.3.4.4.2.1 diff -u -r1.3.4.4 -r1.3.4.4.2.1 --- squid/src/cache_cf.c 6 Jan 2001 13:32:44 -0000 1.3.4.4 +++ squid/src/cache_cf.c 6 Jan 2001 17:38:48 -0000 1.3.4.4.2.1 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.3.4.4 2001/01/06 13:32:44 hno Exp $ + * $Id: cache_cf.c,v 1.3.4.4.2.1 2001/01/06 17:38:48 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -397,6 +397,7 @@ } if (aclPurgeMethodInUse(Config.accessList.http)) Config2.onoff.enable_purge = 1; +#ifndef _SQUID_MSWIN_ if (NULL != Config.effectiveUser) { struct passwd *pwd = getpwnam(Config.effectiveUser); if (NULL == pwd) @@ -422,6 +423,7 @@ xstrerror()); Config2.effectiveGroupID = grp->gr_gid; } +#endif urlExtMethodConfigure(); }