--------------------- PatchSet 2627 Date: 2001/07/15 16:58:37 Author: serassio Branch: nt-2_3 Tag: (none) Log: Added posix mkdir full WIN32 emulation and fixed some MS VC++ compile warning Members: doc/WIN32-ChangeLog.txt:1.1.2.1->1.1.2.2 doc/readme.txt:1.1.2.1->1.1.2.2 include/config.h:1.1.2.5->1.1.2.6 include/config.h.in:1.1.1.3.4.1.2.4->1.1.1.3.4.1.2.5 lib/win32lib.c:1.1.2.2->1.1.2.3 src/access_log.c:1.1.1.3.4.1.2.2->1.1.1.3.4.1.2.3 src/protos.h:1.1.1.3.4.1.2.4->1.1.1.3.4.1.2.5 src/stat.c:1.1.1.3.4.1.2.3->1.1.1.3.4.1.2.4 src/store_dir_ufs.c:1.1.1.1.4.1.2.5->1.1.1.1.4.1.2.6 src/useragent.c:1.1.1.3.4.1.2.9->1.1.1.3.4.1.2.10 Index: squid/doc/WIN32-ChangeLog.txt =================================================================== RCS file: /cvsroot/squid-sf//squid/doc/Attic/WIN32-ChangeLog.txt,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/doc/WIN32-ChangeLog.txt 9 Jul 2001 20:25:11 -0000 1.1.2.1 +++ squid/doc/WIN32-ChangeLog.txt 15 Jul 2001 16:58:37 -0000 1.1.2.2 @@ -39,4 +39,4 @@ 02 Jul 2001 - Partially fixed FD problems and 100% CPU load problems - (Guido Serassio) 07 Jul 2001 - Fixed a "non caching" bug - (Guido Serassio) 09 Jul 2001 - Enabled full "Process Filedescriptor Allocation" cachemgr features - (Guido Serassio) - +15 Jul 2001 - Enabled SNMP functionality - (Guido Serassio) Index: squid/doc/readme.txt =================================================================== RCS file: /cvsroot/squid-sf//squid/doc/Attic/readme.txt,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/doc/readme.txt 9 Jul 2001 20:25:11 -0000 1.1.2.1 +++ squid/doc/readme.txt 15 Jul 2001 16:58:37 -0000 1.1.2.2 @@ -1,64 +1,87 @@ -Free Squid NT 2.3 STABLE 4 for Windows NT 4 +Squid 2.3 STABLE 5 for Windows NT 4.0 & WINDOWS 2000 -(native port of Squid 2.3 STABLE 4, plus 09/01/2001 tarball update and many NT service enhancement, derived from the Harvest project) -Current features: - -Run as a native Windows NT Service (No CygWin Unix emulation, compiled with MS VC 6.0) -Use PSAPI.LIB for rusage emulation -Internal DNS looks in registry for configured DNS, resolv.conf no more needed -External DNS helper run as a DLL plug-in and use internal NT DNS resolver, so hosts file if used. -All squid -k switches (check, debug, interrupt, kill, parse, reconfigure, rotate, shutdown) works -Native Windows NT Authenticator working as DLL plug-in, is possible to authenticante against a single NT Server, a single or a trusted NT Domain. User access allowed by NT User Group membership -NCSA Authenticator working as DLL plug-in -Working htpasswd and chhpasswd.cgi for NCSA password support -LDAP Authenticator working as DLL plug-in (NOT YET TESTED !!!) -Working Cachemgr CGI interface -Code Merged with main Head 09/01/2001 tarball -Buffered Disk I/O -Current ChangeLog - -Install: -Read the CompileOptions.txt file -Edit the squid.conf (use path with '/' char, NOT '\') -Manually create ALL the directories specified in squid.conf, except the contents of the cache directory -squid -z (creates the cache directories) -squid -i (installs the SquidNT2.3Stable4 beta service) - - -Authenticators configuration: -Edit the squid.conf -Specify the FULL DLL path (with .dll suffix) in the authenticate_program directive plus the correct parameter - See the original authenticator documentation - - -External DNS Helper Plug-in configuration: -Edit the squid.conf -Specify the FULL DLL path (with .dll suffix) in the cache_dns_program directive +Native port of Squid 2.3 STABLE 5, plus many NT service enhancement, derived from the Harvest project. +Current features: -Uninstall: -squid -r (removes the SquidNT2.3Stable4 beta service) - - -Usage: -Start: Control Panel/Services: choose "Start" for the "SquidNT2.3Stable4 beta" service. -Stop: Control Panel/Services: choose "Stop" for the "SquidNT2.3Stable4 beta" service. -squid -f file Set Windows NT Registry to use given config-file instead of default config-file -squid -h Print help message. -squid -k reconfigure | rotate | shutdown | interrupt | kill | debug | check -Send signal to running copy and exit. -squid -v Print version. - -The results of the rest of the (original) cmdline switches is undeterminate (for the moment). - + Run as a native Windows NT Service (No CygWin Unix emulation, compiled with MS VC++ 6.0) + Multiple Squid service instances are allowed + Use PSAPI.LIB for full getrusage emulation + Internal DNS looks in registry for configured DNS, resolv.conf no more needed + External DNS helper run as a DLL plug-in and use internal NT DNS resolver, so hosts file if used. + All squid -k switches (check, debug, interrupt, kill, parse, reconfigure, rotate, shutdown) works + Native Windows NT Authenticator working as DLL plug-in, is possible to authenticante against a single NT + Server, a single or a trusted NT Domain. User access allowed by NT User Group membership + NCSA Authenticator working as DLL plug-in + Working htpasswd and chhpasswd.cgi for NCSA password support + LDAP Authenticator working as DLL plug-in (NOT YET TESTED !!!) + Working Cachemgr CGI interface + Buffered Disk I/O + Working SNMP -Compiling: -Compile environment needed: +Current ChangeLog -MS Visual Studio C++ 6.0 -Native Perl for NT -Native sed for NT -PSAPI files from MS SDK + Install: + Extract the binary archive in the desired directory (default c:\squid) + Read the CompileOptions.txt file + Edit the squid.conf and change if needed the c:/squid path (use path with '/' char, NOT '\') + Manually create ALL the directories specified in squid.conf, except the contents of the cache directory + squid -i [-f configfile] [-n servicename] (installs the servicename Squid service using the configfile + configuration file, default configfile is "c:/squid/etc/squid.conf", default servicename is "SquidNT2.3") + squid -z [-f configfile] (creates the cache directories) + + Authenticators configuration: + Edit the squid.conf + Specify the FULL DLL path (with .dll suffix) in the authenticate_program directive plus the correct + parameter - See the original authenticator documentation + + External DNS Helper Plug-in configuration (Only if compiled with internal DNS disabled): + Edit the squid.conf + Specify the FULL DLL path (with .dll suffix) in the cache_dns_program directive + + Uninstall: + squid -r [-n servicename] (removes the servicename Squid service) + + Usage: + Service mode: + Start: Control Panel/Services: choose "Start" for the "SquidNT2.3" service. + Stop: Control Panel/Services: choose "Stop" for the "SquidNT2.3" service. + squid -h Print help message. + squid -n servicename [-f configfile] -k reconfigure | rotate | shutdown | interrupt | kill | debug | check + Send signal to running copy and exit. + squid -v Print version. + + The results of the rest of the (original) cmdline switches when running as a Service is undeterminate (for the + moment). + + This Squid build can support multiple Squid service instances running from the same executable. + Every instance must have a different service name, use different TCP ports and use a different configuration + file. + So, when installing the service, if don't using the default settings (c:/squid, SquidNT2.3 Service Name), the + service name and the associated config file MUST be specified. + The same when removing or running squid -k commands. + + Command Line mode: + All Squid cmdline switches are available, except the -N (no daemon mode) + + Compiling: + Compile environment needed: + MS Visual Studio C++ 6.0 + Native perl, sed and patch for NT + PSAPI files from MS SDK + Download the latest Squid 2.3 STABLE 5 tarball, the squid-2.3.STABLE5-NT patch from + squid.sourceforge.net + Apply squid-2.3.STABLE5-NT patch + Verify the Squid options defined in autoconf.h + Check default parameters on cf.data.mak file + Check Post-build step parameters on squidnt project + + Known Limitations: + External helpers or redirectors are unavailable (except the included helper compiled as Windows DLL) + Squid features not operationals: WCCP, Transparent Proxy and Async I/O. + Some code sections can make blocking calls. No warranties of any kind. No time for support, sorry. Use at your own risk. Original Port and some enhancements by Romeo Anghelache (see the ChangeLog) + Index: squid/include/config.h =================================================================== RCS file: /cvsroot/squid-sf//squid/include/config.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/include/config.h 15 Jul 2001 08:49:37 -0000 1.1.2.5 +++ squid/include/config.h 15 Jul 2001 16:58:37 -0000 1.1.2.6 @@ -108,7 +108,6 @@ #define chdir _chdir #define getcwd _getcwd #define getpid _getpid -#define mkdir _mkdir #define setmode _setmode #define snprintf _snprintf #define strcasecmp _stricmp Index: squid/include/config.h.in =================================================================== RCS file: /cvsroot/squid-sf//squid/include/Attic/config.h.in,v retrieving revision 1.1.1.3.4.1.2.4 retrieving revision 1.1.1.3.4.1.2.5 diff -u -r1.1.1.3.4.1.2.4 -r1.1.1.3.4.1.2.5 --- squid/include/config.h.in 3 Jul 2001 22:00:12 -0000 1.1.1.3.4.1.2.4 +++ squid/include/config.h.in 15 Jul 2001 16:58:37 -0000 1.1.1.3.4.1.2.5 @@ -1,5 +1,5 @@ /* - * $Id: config.h.in,v 1.1.1.3.4.1.2.4 2001/07/03 22:00:12 serassio Exp $ + * $Id: config.h.in,v 1.1.1.3.4.1.2.5 2001/07/15 16:58:37 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -108,7 +108,6 @@ #define chdir _chdir #define getcwd _getcwd #define getpid _getpid -#define mkdir _mkdir #define setmode _setmode #define snprintf _snprintf #define strcasecmp _stricmp Index: squid/lib/win32lib.c =================================================================== RCS file: /cvsroot/squid-sf//squid/lib/win32lib.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/lib/win32lib.c 8 Jul 2001 10:31:59 -0000 1.1.2.2 +++ squid/lib/win32lib.c 15 Jul 2001 16:58:38 -0000 1.1.2.3 @@ -1,5 +1,5 @@ /* - * $Id: win32lib.c,v 1.1.2.2 2001/07/08 10:31:59 serassio Exp $ + * $Id: win32lib.c,v 1.1.2.3 2001/07/15 16:58:38 serassio Exp $ * * * * * * * * * Legal stuff * * * * * * * * @@ -111,6 +111,16 @@ return 0; } +int mkdir(const char * path, mode_t mode) + +{ + if (CreateDirectory(path, NULL) != 0) + return 0; + else + return -1; +} + + static int optiserr(int argc, char * const *argv, int oint, const char *optstr, Index: squid/src/access_log.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/access_log.c,v retrieving revision 1.1.1.3.4.1.2.2 retrieving revision 1.1.1.3.4.1.2.3 diff -u -r1.1.1.3.4.1.2.2 -r1.1.1.3.4.1.2.3 --- squid/src/access_log.c 14 Jun 2001 20:36:15 -0000 1.1.1.3.4.1.2.2 +++ squid/src/access_log.c 15 Jul 2001 16:58:38 -0000 1.1.1.3.4.1.2.3 @@ -1,7 +1,7 @@ /* - * $Id: access_log.c,v 1.1.1.3.4.1.2.2 2001/06/14 20:36:15 serassio Exp $ + * $Id: access_log.c,v 1.1.1.3.4.1.2.3 2001/07/15 16:58:38 serassio Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -335,7 +335,9 @@ LOCAL_ARRAY(char, from, MAXPATHLEN); LOCAL_ARRAY(char, to, MAXPATHLEN); char *fname = NULL; +#ifdef S_ISREG struct stat sb; +#endif #if FORW_VIA_DB fvdbClear(); #endif Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.1.1.3.4.1.2.4 retrieving revision 1.1.1.3.4.1.2.5 diff -u -r1.1.1.3.4.1.2.4 -r1.1.1.3.4.1.2.5 --- squid/src/protos.h 14 Jun 2001 20:36:16 -0000 1.1.1.3.4.1.2.4 +++ squid/src/protos.h 15 Jul 2001 16:58:38 -0000 1.1.1.3.4.1.2.5 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.1.1.3.4.1.2.4 2001/06/14 20:36:16 serassio Exp $ + * $Id: protos.h,v 1.1.1.3.4.1.2.5 2001/07/15 16:58:38 serassio Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -746,7 +746,7 @@ extern void statHistCopy(StatHist * Dest, const StatHist * Orig); extern void statHistSafeCopy(StatHist * Dest, const StatHist * Orig); extern double statHistDeltaMedian(const StatHist * A, const StatHist * B); -extern void statHistDump(const StatHist * H, StoreEntry * sentry, StatHistBinDumper bd); +extern void statHistDump(const StatHist * H, StoreEntry * sentry, StatHistBinDumper * bd); extern void statHistLogInit(StatHist * H, int capacity, double min, double max); extern void statHistEnumInit(StatHist * H, int last_enum); extern void statHistIntInit(StatHist * H, int n); @@ -1241,6 +1241,7 @@ extern int kill(pid_t, int); extern void gettimeofday(struct timeval * ,void *); int statfs(const char *, struct statfs *); +int mkdir(const char *, mode_t); #endif #endif Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.1.1.3.4.1.2.3 retrieving revision 1.1.1.3.4.1.2.4 diff -u -r1.1.1.3.4.1.2.3 -r1.1.1.3.4.1.2.4 --- squid/src/stat.c 9 Jul 2001 20:25:11 -0000 1.1.1.3.4.1.2.3 +++ squid/src/stat.c 15 Jul 2001 16:58:38 -0000 1.1.1.3.4.1.2.4 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.1.1.3.4.1.2.3 2001/07/09 20:25:11 serassio Exp $ + * $Id: stat.c,v 1.1.1.3.4.1.2.4 2001/07/15 16:58:38 serassio Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -391,8 +391,8 @@ } #endif -static const char * #ifdef _SQUID_MSWIN_ +static const char * sdRemoteAddr(const sde * f) { LOCAL_ARRAY(char, buf, 32); @@ -402,6 +402,8 @@ return buf; } #endif + +static const char * fdRemoteAddr(const fde * f) { LOCAL_ARRAY(char, buf, 32); Index: squid/src/store_dir_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/store_dir_ufs.c,v retrieving revision 1.1.1.1.4.1.2.5 retrieving revision 1.1.1.1.4.1.2.6 diff -u -r1.1.1.1.4.1.2.5 -r1.1.1.1.4.1.2.6 --- squid/src/store_dir_ufs.c 8 Jul 2001 10:32:00 -0000 1.1.1.1.4.1.2.5 +++ squid/src/store_dir_ufs.c 15 Jul 2001 16:58:38 -0000 1.1.1.1.4.1.2.6 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.c,v 1.1.1.1.4.1.2.5 2001/07/08 10:32:00 serassio Exp $ + * $Id: store_dir_ufs.c,v 1.1.1.1.4.1.2.6 2001/07/15 16:58:38 serassio Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -127,11 +127,7 @@ } else { fatalf("Swap directory %s is not a directory.", path); } -#ifdef _SQUID_MSWIN_ - } else if (0 != CreateDirectory(path,NULL)) { -#else } else if (0 == mkdir(path, 0755)) { -#endif debug(20, should_exist ? 1 : 3) ("%s created\n", path); created = 1; } else { @@ -791,11 +787,11 @@ } sd->u.ufs.swaplog_fd = fd; /* open a read-only stream of the old log */ -#ifdef _SQUID_MSWIN_ - fp = fopen(swaplog_path, "rb"); -#else +//#ifdef _SQUID_MSWIN_ +// fp = fopen(swaplog_path, "rb"); +//#else fp = fopen(swaplog_path, "r"); -#endif +//#endif if (fp == NULL) { debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror()); fatal("Failed to open swap log for reading"); @@ -837,7 +833,9 @@ storeUfsDirWriteCleanOpen(SwapDir * sd) { struct _clean_state *state = xcalloc(1, sizeof(*state)); +#if HAVE_FCHMOD struct stat sb; +#endif sd->log.clean.write = NULL; sd->log.clean.state = NULL; state->cur = xstrdup(storeUfsDirSwapLogFile(sd, NULL)); @@ -908,7 +906,7 @@ storeUfsDirWriteCleanClose(SwapDir * sd) { #ifdef _SQUID_MSWIN_ - FILE *fbuf; + FILE *fbuf; #endif struct _clean_state *state = sd->log.clean.state; if (state->fd < 0) @@ -916,7 +914,7 @@ #ifdef _SQUID_MSWIN_ fbuf=fd_table[state->fd].fbuf; fwrite(state->outbuf, 1, state->outbuf_offset, fbuf); - if (ferror(fbuf) || feof(fbuf)){ + if (ferror(fbuf) || feof(fbuf)){ #else if (write(state->fd, state->outbuf, state->outbuf_offset) < 0) { #endif @@ -1033,11 +1031,7 @@ if (dp == NULL) { if (errno == ENOENT) { debug(36, 0) ("storeDirClean: WARNING: Creating %s\n", p1); -#ifdef _SQUID_MSWIN_ - if (CreateDirectory(p1, NULL) == 0) -#else if (mkdir(p1, 0777) == 0) -#endif return 0; } debug(50, 0) ("storeDirClean: %s: %s\n", p1, xstrerror()); Index: squid/src/useragent.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/useragent.c,v retrieving revision 1.1.1.3.4.1.2.9 retrieving revision 1.1.1.3.4.1.2.10 diff -u -r1.1.1.3.4.1.2.9 -r1.1.1.3.4.1.2.10 --- squid/src/useragent.c 15 Jul 2001 08:49:37 -0000 1.1.1.3.4.1.2.9 +++ squid/src/useragent.c 15 Jul 2001 16:58:38 -0000 1.1.1.3.4.1.2.10 @@ -1,6 +1,6 @@ /* - * $Id: useragent.c,v 1.1.1.3.4.1.2.9 2001/07/15 08:49:37 serassio Exp $ + * $Id: useragent.c,v 1.1.1.3.4.1.2.10 2001/07/15 16:58:38 serassio Exp $ * * DEBUG: section 40 User-Agent logging * AUTHOR: Joe Ramey @@ -75,7 +75,9 @@ int i; LOCAL_ARRAY(char, from, MAXPATHLEN); LOCAL_ARRAY(char, to, MAXPATHLEN); +#ifdef S_ISREG struct stat sb; +#endif if ((fname = Config.Log.useragent) == NULL) return; if (strcmp(fname, "none") == 0)