diff -ruN squid-2.6.STABLE3/CONTRIBUTORS squid-2.6.STABLE4/CONTRIBUTORS --- squid-2.6.STABLE3/CONTRIBUTORS Wed Jun 7 18:00:48 2006 +++ squid-2.6.STABLE4/CONTRIBUTORS Sat Sep 9 09:41:45 2006 @@ -82,7 +82,8 @@ Sergio Rabellino Ian Turner Moez Mahfoudh - Guido Serassio + Guido Serassio + Andrey Shorin Miquel van Smoorenburg Brian Ian Castle diff -ruN squid-2.6.STABLE3/ChangeLog squid-2.6.STABLE4/ChangeLog --- squid-2.6.STABLE3/ChangeLog Fri Aug 18 15:31:01 2006 +++ squid-2.6.STABLE4/ChangeLog Fri Sep 22 05:10:14 2006 @@ -1,4 +1,43 @@ -Changes to squid-2.5.STABLE3 (Aug 18 2006) +Changes to squid-2.6.STABLE4 (Sep 22 2006) + + - Bug #1736: Missing Italian translation of ERR_TOO_BIG error page + - Windows port enhancement: added native exception handler with signal emulation + - Fix the %un log_format tag again. Got broken in 2.6.STABLE2 + - Fix Squid crash when using %a in ERR_INVALID_REQ and ERR_INVALID_URL error messages. + - Bug #212: variable %i always 0.0.0.0 in many error pages + - Bug #1708: Ports in ACL accepts characters and out of range + - Bug #1706: Squid time acl accepts invalid time range. + - Fix another harmless fake_auth compiler warning on gcc 4.1.1 x86 + - Fix an harmless snmp_core.c compiler warning on gcc 4.1.1 x86 + - Bug #1744: squid-2.6.STABLE3 - fakeauth_auth crashing on certain requests + - Bug #1746: Harmless off by one overrun in ncsa_auth md5 password validation + - Bug #1598: start_announce cannot be disabled + - Periodically flush cache.log to disk when "buffered_logs on" is set + - Numerous COSS improvements and fixes + - Windows port: merge of MinGW support + - Windows port: Merged Windows threads support into aufs + - Bug #1759: Windows port cachemgr.cgi attempts to write to file system root directory + - Numerous portability fixes + - Various minor statistics cleanup on 64-bit hosts with more than 4GB of memory + - Bug #1758: HEAD on ftp:// URLs always returned 200 OK. + - Bug #1760: FTP related memory leak + - Bug #1770: WCCP2 weighted assignment + - Bug #1768: Redundant DNS PTR lookups + - Bug #1696: Add support for wccpv2 mask assignment + - Bug #1774: ncsa_auth support for cramfs timestamps + - Bug #1769: near-hit and filedescriptor usage missing in SNMP MIB + - Bug #1725: cache_peer login=PASS documentation somewhat confusing + - Bug #1590: Silence those ETag loop warnings + - Bug #1740: Squid crashes on certain malformed HTTP responses + - Bug #1699: assertion failed: authenticate.c:836: "auth_user_request != NULL" + - Improve error reporting on unexpected CONNECT requests in accelerator mode + - Cosmetic change to increase cache.log detail level on invalid requests + - Bug #1229: http_port and other directives accept invalid ports + - Reject http_port specifications using both transparent and accelerator options + - Cosmetic cleanup to not dump stacktraces on configuration errors + + +Changes to squid-2.6.STABLE3 (Aug 18 2006) - Bug #1577: assertion failed "fm->max_n_files <= (1 << 24)" on very large cache_dir. Limit number of objects stored to slightly diff -ruN squid-2.6.STABLE3/Makefile.in squid-2.6.STABLE4/Makefile.in --- squid-2.6.STABLE3/Makefile.in Mon Jun 12 00:09:41 2006 +++ squid-2.6.STABLE4/Makefile.in Fri Sep 22 03:09:34 2006 @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $Id: Makefile.in,v 1.45 2006/06/12 06:09:41 hno Exp $ +# $Id: Makefile.in,v 1.48 2006/09/22 09:09:34 hno Exp $ # srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -110,6 +110,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -150,6 +152,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -187,6 +191,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -204,6 +210,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/RELEASENOTES.html squid-2.6.STABLE4/RELEASENOTES.html --- squid-2.6.STABLE3/RELEASENOTES.html Fri Aug 18 15:33:10 2006 +++ squid-2.6.STABLE4/RELEASENOTES.html Sat Sep 23 11:50:05 2006 @@ -7,7 +7,7 @@

Squid 2.6 release notes

-

Squid Developers

$Id: release-2.6.html,v 1.28 2006/08/18 21:30:10 hno Exp $ +

Squid Developers

$Id: release-2.6.html,v 1.35 2006/09/22 11:10:14 hno Exp $
This document contains the release notes for version 2.6 of Squid. Squid is a WWW Cache application developed by the Web Caching community. @@ -36,6 +36,9 @@

8. Key changes squid-2.6.STABLE2 to 2.6.STABLE3

+

+

9. Key changes squid-2.6.STABLE3 to 2.6.STABLE4

+

1. Key changes from squid 2.5

@@ -152,6 +155,7 @@
wccp2_*

WCCP2 protocol support

minimum_expiry_time

tune the magic 60 seconds limit of what is considered cachable when the object doesn't have any cache validators. (2.6.STABLE2)

wccp2_rebuild_wait

make Squid delay registering with a WCCP router until store rebuild have finished. Default on. (2.6.STABLE2)

+
wccp2_weight

Cache server load weigth in the cluster. (2.6.STABLE4)

@@ -216,9 +220,9 @@

6. Windows support

-

This Squid version can run on Windows as a system service using the Cygwin environment.
-Windows NT 4 and later are supported.
-On Windows 2000/XP/2003 the service is configured to use the Windows Service Recovery option +

This Squid version can run on Windows as a system service using the Cygwin emulation environment, +or can be compiled in Windows native mode using the MinGW + MSYS development environment. Windows NT 4 SP4 and later are supported.
+On Windows 2000 and later the service is configured to use the Windows Service Recovery option restarting automatically after 60 seconds.

@@ -262,6 +266,24 @@

+
PSAPI.DLL (Process Status Helper) Considerations

The process status helper functions make it easier for you to obtain information about +processes and device drivers running on Microsoft® Windows NT®/Windows® 2000. These +functions are available in PSAPI.DLL, which is distributed in the Microsoft® Platform +Software Development Kit (SDK). The same information is generally available through the +performance data in the registry, but it is more difficult to get to it. PSAPI.DLL is +freely redistributable.

+

PSAPI.DLL is available only on Windows NT, 2000, XP and 2003. The implementation in Squid is +aware of this, and try to use it only on the right platform.

+

On Windows NT PSAPI.DLL can be found as component of many applications, if you need it, +you can find it on Windows NT Resource KIT. If you have problem, it can be +downloaded from here: +http://download.microsoft.com/download/platformsdk/Redist/4.0.1371.1/NT4/EN-US/psinst.EXE

+

On Windows 2000 and later it is available installing the Windows Support Tools, located on the +Support\Tools folder of the installation Windows CD-ROM.

+
+

+

+

Registry DNS lookup

On Windows platforms, if no value is specified in the dns_nameservers option on squid.conf or in the /etc/resolv.conf file, the list of DNS name servers are taken from the Windows registry, both static and dynamic DHCP configurations @@ -293,6 +315,7 @@

  • When Squid runs in command line mode, the launching user account must have administrative privilege on the system
  • "Start parameters" in the Windows 2000/XP/2003 Service applet cannot be used
  • +
  • Building with MinGW, when the configure option --enable-truncate is used, Squid cannot run on Windows NT, only Windows 2000 and later are supported
  • @@ -310,11 +333,77 @@
  • Some code sections can make blocking calls.
  • Some external helpers may not work.
  • +
  • File Descriptors number hard-limited to 2048 when building with MinGW.
  • + +

    +
    +

    +

    +

    +
    Building Squid on Windows:

    A reasonably recent release of Cygwin or MinGW is needed. Like other Unix/Linux environments, -devel version of libraries must be installed.
    +When running configure, --disable-wccp and --disable-wccpv2 options should always specified to avoid compile errors.
    +

      +
    • New configure options:
      +
        +
      • --enable-win32-service
      • +
      +
    • +
    • Updated configure options:
      +
        +
      • --enable-arp-acl
      • +
      • --enable-default-hostsfile
      • +
      +
    • +
    • Unsupported configure options:
      +
        +
      • --enable-coss-aio-ops: On Cygwin Posix AIO is not available
      • +
      +
    • +
    +

    +
    +

    +

    +

    +
    Using cache manager on Windows:

    On Windows, cache manager (cachemgr.cgi) can be used with Microsoft IIS or Apache.
    +Some specific configuration could be needed:
    +

      +
    • IIS 6 (Windows 2003):
      +
        +
      • On IIS 6.0 all CGI extensions are denied by default for security reason, so the following configuration is needed:
        +
          +
        • Create a cgi-bin Directory
        • +
        • Define the cgi-bin IIS Virtual Directory with read and CGI execute IIS +permissions, ASP scripts are not needed. This automatically defines a +cgi-bin IIS web application
        • +
        • Copy cachemgr.cgi into cgi-bin directory and look to file permissions: +the IIS system account and SYSTEM must be able to read and execute the file
        • +
        • In IIS manager go to Web Service extensions and add a new Web Service +Extension called "Squid Cachemgr", add the cachemgr.cgi file and set the +extension status to Allowed
        • +
        +
      • +
      +
    • +
    • Apache:
      +
        +
      • On Windows, cachemgr.cgi needs to create a temporary file, so Apache must be instructed +to pass the TMP and TEMP Windows environment variables to CGI applications:
        +
        +ScriptAlias /squid/cgi-bin/ "c:/squid/libexec/"
        +<Location /squid/cgi-bin/cachemgr.cgi>
        +    PassEnv TMP TEMP
        +    Order allow,deny
        +    Allow from workstation.example.com
        +</Location>
        +
        +
      • +
      +

    -

    7. Key changes squid-2.6.STABLE1 to 2.6.STABLE2

    @@ -339,7 +428,7 @@
  • Bug #1703: Wrong default path to the diskd helper causing hangs at 100% CPU
  • Bug #1685: Crashes or other odd results after storeSwapMetaUnpack: errors
  • a number of other minor and cosmetic bugfixes. See the list of -squid-2.6 changes and the +squid-2.6.STABLE2 changes and the ChangeLog file for details.
  • @@ -364,12 +453,31 @@
  • Fixed some assertion failures and segmentation faults
  • Some small optimizations to reduce CPU usage
  • a number of other minor and cosmetic bugfixes. See the list of -squid-2.6 changes and the +squid-2.6.STABLE3 changes and the ChangeLog file for details.
  • +

    9. Key changes squid-2.6.STABLE3 to 2.6.STABLE4

    + +

    +

      +
    • New wccp2_weight directive
    • +
    • Numeros COSS fixes and improvements
    • +
    • Support for WCCP2 hash based assignment and weighted assignments
    • +
    • Windows port update
    • +
    • Many small fixes to better detect invalid configurations
    • +
    • Bug #1760: FTP related memory leak
    • +
    • SNMP mib updates for some minor missing details
    • +
    • Bug #1590: Silence those harmless ETag loop warnings
    • +
    • Bug #1740: Squid crashes on certain malformed HTTP responses
    • +
    • Bug #1699: assertion failed: authenticate.c:836: "auth_user_request != NULL"
    • +
    • a number of other minor and cosmetic bugfixes. See the list of +squid-2.6.STABLE4 changes and the +ChangeLog file for details.
    • +
    +

    diff -ruN squid-2.6.STABLE3/SPONSORS squid-2.6.STABLE4/SPONSORS --- squid-2.6.STABLE3/SPONSORS Fri Apr 28 04:17:14 2006 +++ squid-2.6.STABLE4/SPONSORS Sun Sep 3 19:53:48 2006 @@ -41,3 +41,12 @@ webwasher AG paid for improvements to Squid's iCAP client implementation. You can find the results of this work at http://devel.squid-cache.org/icap/ + +iiNet Ltd - http://www.iinet.net.au/ + + iiNet Ltd contributed significant development resources to + Squid during its early stages and was instrumental in its + early adoption in the local internet community. iiNet has also + recently supplied equipment to help develop and test the WCCPv2 + implementation in Squid-2.6 and Squid-3. + diff -ruN squid-2.6.STABLE3/configure squid-2.6.STABLE4/configure --- squid-2.6.STABLE3/configure Fri Aug 18 15:32:54 2006 +++ squid-2.6.STABLE4/configure Sat Sep 23 11:49:33 2006 @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Revision: 1.392 . +# From configure.in Revision: 1.402 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for Squid Web Proxy 2.6.STABLE3. +# Generated by GNU Autoconf 2.59 for Squid Web Proxy 2.6.STABLE4. # # Report bugs to . # @@ -270,8 +270,8 @@ # Identity of this package. PACKAGE_NAME='Squid Web Proxy' PACKAGE_TARNAME='squid' -PACKAGE_VERSION='2.6.STABLE3' -PACKAGE_STRING='Squid Web Proxy 2.6.STABLE3' +PACKAGE_VERSION='2.6.STABLE4' +PACKAGE_STRING='Squid Web Proxy 2.6.STABLE4' PACKAGE_BUGREPORT='http://www.squid-cache.org/bugs/' ac_default_prefix=/usr/local/squid @@ -312,7 +312,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os PKGCONFIG CGIEXT ENABLE_WIN32SPECIFIC_TRUE ENABLE_WIN32SPECIFIC_FALSE CACHE_HTTP_PORT CACHE_ICP_PORT LIBDLMALLOC LIB_MALLOC STORE_OBJS STORE_LIBS STORE_MODULES NEED_DISKD_TRUE NEED_DISKD_FALSE REPL_POLICIES REPL_OBJS REPL_LIBS ENABLE_PINGER_TRUE ENABLE_PINGER_FALSE USE_DELAY_POOLS_TRUE USE_DELAY_POOLS_FALSE USE_SNMP_TRUE USE_SNMP_FALSE SNMPLIB makesnmplib ENABLE_HTCP_TRUE ENABLE_HTCP_FALSE ENABLE_SSL_TRUE ENABLE_SSL_FALSE NEED_OWN_MD5_TRUE NEED_OWN_MD5_FALSE SSLLIB ERR_DEFAULT_LANGUAGE ERR_LANGUAGES MAKE_LEAKFINDER_TRUE MAKE_LEAKFINDER_FALSE USE_DNSSERVER_TRUE USE_DNSSERVER_FALSE OPT_DEFAULT_HOSTS AUTH_MODULES AUTH_OBJS AUTH_LIBS BASIC_AUTH_HELPERS NTLM_AUTH_HELPERS DIGEST_AUTH_HELPERS NEGOTIATE_AUTH_HELPERS EXTERNAL_ACL_HELPERS CPP EGREP LIBSASL ENABLE_UNLINKD_TRUE ENABLE_UNLINKD_FALSE RANLIB ac_ct_RANLIB LN_S SH FALSE TRUE RM MV MKDIR LN PERL AR AR_R ALLOCA CRYPTLIB LIB_EPOLL LIB_LDAP LIB_LBER LIB_DB EPOLL_LIBS USE_POLL_TRUE USE_POLL_FALSE USE_EPOLL_TRUE USE_EPOLL_FALSE USE_SELECT_TRUE USE_SELECT_FALSE USE_SELECT_WIN32_TRUE USE_SELECT_WIN32_FALSE USE_KQUEUE_TRUE USE_KQUEUE_FALSE NEED_OWN_SNPRINTF_TRUE NEED_OWN_SNPRINTF_FALSE NEED_OWN_STRSEP_TRUE NEED_OWN_STRSEP_FALSE REGEXLIB LIBREGEX LIBOBJS XTRA_OBJS XTRA_LIBS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os PKGCONFIG CGIEXT ENABLE_WIN32SPECIFIC_TRUE ENABLE_WIN32SPECIFIC_FALSE ENABLE_MINGW32SPECIFIC_TRUE ENABLE_MINGW32SPECIFIC_FALSE WIN32_PSAPI CACHE_HTTP_PORT CACHE_ICP_PORT LIBDLMALLOC LIB_MALLOC STORE_OBJS STORE_LIBS STORE_MODULES NEED_DISKD_TRUE NEED_DISKD_FALSE USE_AIOPS_WIN32_TRUE USE_AIOPS_WIN32_FALSE NEED_COSSDUMP_TRUE NEED_COSSDUMP_FALSE REPL_POLICIES REPL_OBJS REPL_LIBS ENABLE_PINGER_TRUE ENABLE_PINGER_FALSE USE_DELAY_POOLS_TRUE USE_DELAY_POOLS_FALSE USE_SNMP_TRUE USE_SNMP_FALSE SNMPLIB makesnmplib ENABLE_HTCP_TRUE ENABLE_HTCP_FALSE ENABLE_SSL_TRUE ENABLE_SSL_FALSE NEED_OWN_MD5_TRUE NEED_OWN_MD5_FALSE SSLLIB ERR_DEFAULT_LANGUAGE ERR_LANGUAGES MAKE_LEAKFINDER_TRUE MAKE_LEAKFINDER_FALSE USE_DNSSERVER_TRUE USE_DNSSERVER_FALSE OPT_DEFAULT_HOSTS AUTH_MODULES AUTH_OBJS AUTH_LIBS BASIC_AUTH_HELPERS NTLM_AUTH_HELPERS DIGEST_AUTH_HELPERS NEGOTIATE_AUTH_HELPERS EXTERNAL_ACL_HELPERS CPP EGREP LIBSASL ENABLE_UNLINKD_TRUE ENABLE_UNLINKD_FALSE RANLIB ac_ct_RANLIB LN_S SH FALSE TRUE RM MV MKDIR LN PERL AR AR_R ALLOCA CRYPTLIB LIB_EPOLL LIB_LDAP LIB_LBER LIB_DB EPOLL_LIBS USE_POLL_TRUE USE_POLL_FALSE USE_EPOLL_TRUE USE_EPOLL_FALSE USE_SELECT_TRUE USE_SELECT_FALSE USE_SELECT_WIN32_TRUE USE_SELECT_WIN32_FALSE USE_KQUEUE_TRUE USE_KQUEUE_FALSE NEED_OWN_SNPRINTF_TRUE NEED_OWN_SNPRINTF_FALSE NEED_OWN_STRSEP_TRUE NEED_OWN_STRSEP_FALSE REGEXLIB LIBREGEX LIBOBJS XTRA_OBJS XTRA_LIBS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -781,7 +781,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Squid Web Proxy 2.6.STABLE3 to adapt to many kinds of systems. +\`configure' configures Squid Web Proxy 2.6.STABLE4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -847,7 +847,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE3:";; + short | recursive ) echo "Configuration of Squid Web Proxy 2.6.STABLE4:";; esac cat <<\_ACEOF @@ -1155,7 +1155,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Squid Web Proxy configure 2.6.STABLE3 +Squid Web Proxy configure 2.6.STABLE4 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1169,7 +1169,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Squid Web Proxy $as_me 2.6.STABLE3, which was +It was created by Squid Web Proxy $as_me 2.6.STABLE4, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1815,7 +1815,7 @@ # Define the identity of the package. PACKAGE='squid' - VERSION='2.6.STABLE3' + VERSION='2.6.STABLE4' cat >>confdefs.h <<_ACEOF @@ -3324,6 +3324,85 @@ ;; esac +case "$host_os" in +mingw|mingw32) + + +if true; then + ENABLE_MINGW32SPECIFIC_TRUE= + ENABLE_MINGW32SPECIFIC_FALSE='#' +else + ENABLE_MINGW32SPECIFIC_TRUE='#' + ENABLE_MINGW32SPECIFIC_FALSE= +fi + + # Extract the first word of "psapi.dll", so it can be a program name with args. +set dummy psapi.dll; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_WIN32_PSAPI+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $WIN32_PSAPI in + [\\/]* | ?:[\\/]*) + ac_cv_path_WIN32_PSAPI="$WIN32_PSAPI" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_WIN32_PSAPI="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_WIN32_PSAPI" && ac_cv_path_WIN32_PSAPI="none" + ;; +esac +fi +WIN32_PSAPI=$ac_cv_path_WIN32_PSAPI + +if test -n "$WIN32_PSAPI"; then + echo "$as_me:$LINENO: result: $WIN32_PSAPI" >&5 +echo "${ECHO_T}$WIN32_PSAPI" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CFLAGS="$CFLAGS -mthreads" + if test "$ac_cv_path_WIN32_PSAPI" = "none"; then + echo "PSAPI.DLL is recommended to run Squid on Windows Platform" + echo "Please see PSAPI.DLL section on doc/release-notes/release-2.6.html." + else + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WIN32_PSAPI 1 +_ACEOF + + LIBS="$LIBS -lpsapi" + fi + ;; +*) + + +if false; then + ENABLE_MINGW32SPECIFIC_TRUE= + ENABLE_MINGW32SPECIFIC_FALSE='#' +else + ENABLE_MINGW32SPECIFIC_TRUE='#' + ENABLE_MINGW32SPECIFIC_FALSE= +fi + + ;; +esac + if test -z "$CACHE_HTTP_PORT"; then CACHE_HTTP_PORT="3128" fi @@ -3509,7 +3588,6 @@ -valgrind= # Check whether --with-valgrind-debug or --without-valgrind-debug was given. if test "${with_valgrind_debug+set}" = set; then @@ -3537,7 +3615,6 @@ fi; -valgrind= # Check whether --enable-mempool-debug or --disable-mempool-debug was given. if test "${enable_mempool_debug+set}" = set; then enableval="$enable_mempool_debug" @@ -3689,6 +3766,8 @@ fi; echo "Store modules built: $STORE_MODULES" NEED_DISKD=0 +USE_AIOPS_WIN32=0 +NEED_COSSDUMP=0 STORE_OBJS="fs/lib`echo $STORE_MODULES|sed -e 's% %.a fs/lib%g'`.a" STORE_LIBS="`echo $STORE_OBJS|sed -e 's%fs/%%g'`" @@ -3701,11 +3780,20 @@ ;; aufs) if test -z "$with_pthreads"; then - echo "aufs store used, pthreads support automatically enabled" - with_pthreads=yes + case "$host_os" in + mingw|mingw32) + USE_AIOPS_WIN32=1 + echo "aufs store used, Windows threads support automatically enabled" + ;; + *) + echo "aufs store used, pthreads support automatically enabled" + with_pthreads=yes + ;; + esac fi ;; coss) + NEED_COSSDUMP=1 if test -z "$with_aio"; then echo "coss store used, aio support automatically enabled" with_aio=yes @@ -3725,6 +3813,26 @@ fi + +if test "$USE_AIOPS_WIN32" = 1; then + USE_AIOPS_WIN32_TRUE= + USE_AIOPS_WIN32_FALSE='#' +else + USE_AIOPS_WIN32_TRUE='#' + USE_AIOPS_WIN32_FALSE= +fi + + + +if test "$NEED_COSSDUMP" = 1; then + NEED_COSSDUMP_TRUE= + NEED_COSSDUMP_FALSE='#' +else + NEED_COSSDUMP_TRUE='#' + NEED_COSSDUMP_FALSE= +fi + + # Check whether --enable-heap-replacement or --disable-heap-replacement was given. if test "${enable_heap_replacement+set}" = set; then enableval="$enable_heap_replacement" @@ -7161,6 +7269,8 @@ + + for ac_header in sys/types.h \ stddef.h \ limits.h \ @@ -7198,6 +7308,7 @@ openssl/md5.h \ openssl/ssl.h \ openssl/engine.h \ + paths.h \ poll.h \ pwd.h \ regex.h \ @@ -7239,6 +7350,7 @@ nss.h \ db.h \ db_185.h \ + aio.h \ do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -8130,13 +8242,23 @@ fi -echo "$as_me:$LINENO: checking for struct rusage" >&5 +case "$host_os" in + mingw|mingw32) + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_RUSAGE 1 +_ACEOF + + ac_cv_func_getrusage='yes' + echo "Using own rusage on Windows." + ;; + *) + echo "$as_me:$LINENO: checking for struct rusage" >&5 echo $ECHO_N "checking for struct rusage... $ECHO_C" >&6 if test "${ac_cv_have_struct_rusage+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8191,13 +8313,15 @@ fi echo "$as_me:$LINENO: result: $ac_cv_have_struct_rusage" >&5 echo "${ECHO_T}$ac_cv_have_struct_rusage" >&6 -if test $ac_cv_have_struct_rusage = "yes" ; then + if test $ac_cv_have_struct_rusage = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_RUSAGE 1 _ACEOF -fi + fi + ;; +esac echo "$as_me:$LINENO: checking for ip->ip_hl" >&5 echo $ECHO_N "checking for ip->ip_hl... $ECHO_C" >&6 @@ -15713,6 +15837,12 @@ esac fi +case "$host_os" in +mingw|mingw32) + ac_cv_func_statfs='yes' + ;; +esac + @@ -17040,6 +17170,11 @@ fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi +case "$host_os" in +mingw|mingw32) + SQUID_MAXFD="2048" + ;; +esac echo "$as_me:$LINENO: result: $SQUID_MAXFD" >&5 echo "${ECHO_T}$SQUID_MAXFD" >&6 fi # --with-maxfd SQUID_MAXFD @@ -17824,6 +17959,20 @@ Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${ENABLE_MINGW32SPECIFIC_TRUE}" && test -z "${ENABLE_MINGW32SPECIFIC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MINGW32SPECIFIC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ENABLE_MINGW32SPECIFIC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${ENABLE_MINGW32SPECIFIC_TRUE}" && test -z "${ENABLE_MINGW32SPECIFIC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MINGW32SPECIFIC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ENABLE_MINGW32SPECIFIC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${NEED_DISKD_TRUE}" && test -z "${NEED_DISKD_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"NEED_DISKD\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -17831,6 +17980,20 @@ Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${USE_AIOPS_WIN32_TRUE}" && test -z "${USE_AIOPS_WIN32_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"USE_AIOPS_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"USE_AIOPS_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${NEED_COSSDUMP_TRUE}" && test -z "${NEED_COSSDUMP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"NEED_COSSDUMP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"NEED_COSSDUMP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${ENABLE_PINGER_TRUE}" && test -z "${ENABLE_PINGER_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_PINGER\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -18291,7 +18454,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by Squid Web Proxy $as_me 2.6.STABLE3, which was +This file was extended by Squid Web Proxy $as_me 2.6.STABLE4, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18354,7 +18517,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -Squid Web Proxy config.status 2.6.STABLE3 +Squid Web Proxy config.status 2.6.STABLE4 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -18648,6 +18811,9 @@ s,@CGIEXT@,$CGIEXT,;t t s,@ENABLE_WIN32SPECIFIC_TRUE@,$ENABLE_WIN32SPECIFIC_TRUE,;t t s,@ENABLE_WIN32SPECIFIC_FALSE@,$ENABLE_WIN32SPECIFIC_FALSE,;t t +s,@ENABLE_MINGW32SPECIFIC_TRUE@,$ENABLE_MINGW32SPECIFIC_TRUE,;t t +s,@ENABLE_MINGW32SPECIFIC_FALSE@,$ENABLE_MINGW32SPECIFIC_FALSE,;t t +s,@WIN32_PSAPI@,$WIN32_PSAPI,;t t s,@CACHE_HTTP_PORT@,$CACHE_HTTP_PORT,;t t s,@CACHE_ICP_PORT@,$CACHE_ICP_PORT,;t t s,@LIBDLMALLOC@,$LIBDLMALLOC,;t t @@ -18657,6 +18823,10 @@ s,@STORE_MODULES@,$STORE_MODULES,;t t s,@NEED_DISKD_TRUE@,$NEED_DISKD_TRUE,;t t s,@NEED_DISKD_FALSE@,$NEED_DISKD_FALSE,;t t +s,@USE_AIOPS_WIN32_TRUE@,$USE_AIOPS_WIN32_TRUE,;t t +s,@USE_AIOPS_WIN32_FALSE@,$USE_AIOPS_WIN32_FALSE,;t t +s,@NEED_COSSDUMP_TRUE@,$NEED_COSSDUMP_TRUE,;t t +s,@NEED_COSSDUMP_FALSE@,$NEED_COSSDUMP_FALSE,;t t s,@REPL_POLICIES@,$REPL_POLICIES,;t t s,@REPL_OBJS@,$REPL_OBJS,;t t s,@REPL_LIBS@,$REPL_LIBS,;t t diff -ruN squid-2.6.STABLE3/configure.in squid-2.6.STABLE4/configure.in --- squid-2.6.STABLE3/configure.in Fri Aug 18 15:32:54 2006 +++ squid-2.6.STABLE4/configure.in Sat Sep 23 11:49:33 2006 @@ -1,16 +1,16 @@ dnl dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.392 2006/08/18 21:31:01 hno Exp $ +dnl $Id: configure.in,v 1.402 2006/09/22 11:10:14 hno Exp $ dnl dnl dnl -AC_INIT(Squid Web Proxy, 2.6.STABLE3, http://www.squid-cache.org/bugs/, squid) +AC_INIT(Squid Web Proxy, 2.6.STABLE4, http://www.squid-cache.org/bugs/, squid) AC_PREREQ(2.52) AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE -AC_REVISION($Revision: 1.392 $)dnl +AC_REVISION($Revision: 1.402 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -58,6 +58,24 @@ ;; esac +case "$host_os" in +mingw|mingw32) + AM_CONDITIONAL(ENABLE_MINGW32SPECIFIC, true) + AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none) + CFLAGS="$CFLAGS -mthreads" + if test "$ac_cv_path_WIN32_PSAPI" = "none"; then + echo "PSAPI.DLL is recommended to run Squid on Windows Platform" + echo "Please see PSAPI.DLL section on doc/release-notes/release-2.6.html." + else + AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems]) + LIBS="$LIBS -lpsapi" + fi + ;; +*) + AM_CONDITIONAL(ENABLE_MINGW32SPECIFIC, false) + ;; +esac + if test -z "$CACHE_HTTP_PORT"; then CACHE_HTTP_PORT="3128" fi @@ -252,7 +270,6 @@ dnl fi dnl ]) -valgrind= AC_ARG_WITH(valgrind-debug, [ --with-valgrind-debug Include debug instrumentation for use with valgrind], [ case $withval in @@ -273,7 +290,6 @@ fi ]) -valgrind= AC_ARG_ENABLE(mempool-debug, [ --enable-mempool-debug Include MemPool debug verifications]) if test "$enable_mempool_debug" = yes; then @@ -394,6 +410,8 @@ ]) echo "Store modules built: $STORE_MODULES" NEED_DISKD=0 +USE_AIOPS_WIN32=0 +NEED_COSSDUMP=0 STORE_OBJS="fs/lib`echo $STORE_MODULES|sed -e 's% %.a fs/lib%g'`.a" AC_SUBST(STORE_OBJS) STORE_LIBS="`echo $STORE_OBJS|sed -e 's%fs/%%g'`" @@ -407,11 +425,20 @@ ;; aufs) if test -z "$with_pthreads"; then - echo "aufs store used, pthreads support automatically enabled" - with_pthreads=yes + case "$host_os" in + mingw|mingw32) + USE_AIOPS_WIN32=1 + echo "aufs store used, Windows threads support automatically enabled" + ;; + *) + echo "aufs store used, pthreads support automatically enabled" + with_pthreads=yes + ;; + esac fi ;; coss) + NEED_COSSDUMP=1 if test -z "$with_aio"; then echo "coss store used, aio support automatically enabled" with_aio=yes @@ -421,6 +448,8 @@ done AC_SUBST(STORE_MODULES) AM_CONDITIONAL([NEED_DISKD], [test "$NEED_DISKD" = 1]) +AM_CONDITIONAL([USE_AIOPS_WIN32], [test "$USE_AIOPS_WIN32" = 1]) +AM_CONDITIONAL([NEED_COSSDUMP], [test "$NEED_COSSDUMP" = 1]) dnl --enable-heap-replacement compatibility option AC_ARG_ENABLE(heap-replacement, @@ -1551,6 +1580,7 @@ openssl/md5.h \ openssl/ssl.h \ openssl/engine.h \ + paths.h \ poll.h \ pwd.h \ regex.h \ @@ -1592,6 +1622,7 @@ nss.h \ db.h \ db_185.h \ + aio.h \ ,,,[ #if HAVE_SYS_TYPES_H #include @@ -1739,21 +1770,30 @@ AC_DEFINE(HAVE_EXT_MALLINFO, 1, [Define if struct mallinfo has mxfast member]) fi -AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [ - AC_TRY_COMPILE([ +case "$host_os" in + mingw|mingw32) + AC_DEFINE(HAVE_STRUCT_RUSAGE) + ac_cv_func_getrusage='yes' + echo "Using own rusage on Windows." + ;; + *) + AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [ + AC_TRY_COMPILE([ #if HAVE_SYS_TIME_H #include #endif #if HAVE_SYS_RESOURCE_H #include #endif], - [struct rusage R;], - ac_cv_have_struct_rusage="yes", - ac_cv_have_struct_rusage="no") + [struct rusage R;], + ac_cv_have_struct_rusage="yes", + ac_cv_have_struct_rusage="no") ]) -if test $ac_cv_have_struct_rusage = "yes" ; then - AC_DEFINE(HAVE_STRUCT_RUSAGE, 1, [Define if you have struct rusage]) -fi + if test $ac_cv_have_struct_rusage = "yes" ; then + AC_DEFINE(HAVE_STRUCT_RUSAGE, 1, [Define if you have struct rusage]) + fi + ;; +esac AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [ AC_TRY_COMPILE([#include @@ -2227,6 +2267,13 @@ esac fi +dnl Override statfs detect on MinGW because is emulated in source code +case "$host_os" in +mingw|mingw32) + ac_cv_func_statfs='yes' + ;; +esac + dnl Check for library functions AC_CHECK_FUNCS(\ bcopy \ @@ -2711,6 +2758,12 @@ SQUID_MAXFD=`cat conftestval`, SQUID_MAXFD=256, SQUID_MAXFD=256) +dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs +case "$host_os" in +mingw|mingw32) + SQUID_MAXFD="2048" + ;; +esac AC_MSG_RESULT($SQUID_MAXFD) fi # --with-maxfd SQUID_MAXFD AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD, [Maximum number of open filedescriptors]) diff -ruN squid-2.6.STABLE3/contrib/Makefile.in squid-2.6.STABLE4/contrib/Makefile.in --- squid-2.6.STABLE3/contrib/Makefile.in Mon Jun 12 00:09:42 2006 +++ squid-2.6.STABLE4/contrib/Makefile.in Fri Sep 22 03:09:34 2006 @@ -87,6 +87,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -127,6 +129,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -164,6 +168,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -181,6 +187,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/doc/Makefile.in squid-2.6.STABLE4/doc/Makefile.in --- squid-2.6.STABLE3/doc/Makefile.in Mon Jun 12 00:09:42 2006 +++ squid-2.6.STABLE4/doc/Makefile.in Fri Sep 22 03:09:36 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.26 2006/06/12 06:09:42 hno Exp $ +# $Id: Makefile.in,v 1.29 2006/09/22 09:09:36 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -94,6 +94,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -134,6 +136,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -171,6 +175,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -188,6 +194,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/errors/Italian/ERR_TOO_BIG squid-2.6.STABLE4/errors/Italian/ERR_TOO_BIG --- squid-2.6.STABLE3/errors/Italian/ERR_TOO_BIG Tue May 17 10:56:15 2005 +++ squid-2.6.STABLE4/errors/Italian/ERR_TOO_BIG Sat Aug 19 02:54:44 2006 @@ -1,28 +1,28 @@ -ERROR: The requested URL could not be retrieved +ERRORE: La URL richiesta non può essere recuperata -

    ERROR

    -

    The requested URL could not be retrieved

    +

    ERRORE

    +

    La URL richiesta non può essere recuperata


    -While trying to retrieve the URL: +Mentre si cercava di recuperare la URL: %U

    -The following error was encountered: +È avvenuto il seguente errore:

    • -The request or reply is too large. +La richiesta o la risposta è troppo grande.

      -If you are making a POST or PUT request, then your request body -(the thing you are trying to upload) is too large. If you are -making a GET request, then the reply body (what you are trying -to download) is too large. These limits have been established -by the Internet Service Provider who operates this cache. Please -contact them directly if you feel this is an error. +Se state eseguendo una richiesta POST o PUT, allora il corpo della richiesta +(l'oggetto di cui state tendando l'upload) è troppo grande. Se state +eseguendo una richiesta GET, allora il corpo della risposta (l'oggetto di cui +state tendando il download) è troppo grande. Questi limiti sono stati +impostati dal gestore di questa cache. Se ritenete che questo sia un errore +siete pregati di contattarlo direttamente.

    -Your cache administrator is %w. +L'amministratore di questa cache è %w. diff -ruN squid-2.6.STABLE3/errors/Makefile.in squid-2.6.STABLE4/errors/Makefile.in --- squid-2.6.STABLE3/errors/Makefile.in Mon Jun 12 00:09:43 2006 +++ squid-2.6.STABLE4/errors/Makefile.in Fri Sep 22 03:09:37 2006 @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $Id: Makefile.in,v 1.42 2006/06/12 06:09:43 hno Exp $ +# $Id: Makefile.in,v 1.45 2006/09/22 09:09:37 hno Exp $ # srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -86,6 +86,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -126,6 +128,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -163,6 +167,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -180,6 +186,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/Makefile.in squid-2.6.STABLE4/helpers/Makefile.in --- squid-2.6.STABLE3/helpers/Makefile.in Mon Jun 12 00:09:43 2006 +++ squid-2.6.STABLE4/helpers/Makefile.in Fri Sep 22 03:09:38 2006 @@ -91,6 +91,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -131,6 +133,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -168,6 +172,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -185,6 +191,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/LDAP/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/LDAP/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/LDAP/Makefile.in Mon Jun 12 00:09:44 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/LDAP/Makefile.in Fri Sep 22 03:09:39 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid LDAP authentication helper # -# $Id: Makefile.in,v 1.34 2006/06/12 06:09:44 hno Exp $ +# $Id: Makefile.in,v 1.37 2006/09/22 09:09:39 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -113,6 +113,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -153,6 +155,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -190,6 +194,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -207,6 +213,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/LDAP/squid_ldap_auth.c squid-2.6.STABLE4/helpers/basic_auth/LDAP/squid_ldap_auth.c --- squid-2.6.STABLE3/helpers/basic_auth/LDAP/squid_ldap_auth.c Tue May 23 12:44:21 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/LDAP/squid_ldap_auth.c Fri Sep 1 12:26:25 2006 @@ -89,6 +89,7 @@ #include #include #include +#include #ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */ @@ -119,7 +120,6 @@ #include #include -#include #endif diff -ruN squid-2.6.STABLE3/helpers/basic_auth/MSNT/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/MSNT/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/MSNT/Makefile.in Mon Jun 12 00:09:45 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/MSNT/Makefile.in Fri Sep 22 03:09:39 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.37 2006/06/12 06:09:45 hno Exp $ +# $Id: Makefile.in,v 1.40 2006/09/22 09:09:39 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -122,6 +122,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -162,6 +164,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -199,6 +203,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -216,6 +222,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/Makefile.in Mon Jun 12 00:09:43 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/Makefile.in Fri Sep 22 03:09:39 2006 @@ -16,7 +16,7 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.33 2006/06/12 06:09:43 hno Exp $ +# $Id: Makefile.in,v 1.36 2006/09/22 09:09:39 hno Exp $ # srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -95,6 +95,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -135,6 +137,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -172,6 +176,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -189,6 +195,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/NCSA/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/NCSA/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/NCSA/Makefile.in Fri Jun 23 18:12:39 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/NCSA/Makefile.in Fri Sep 22 03:09:40 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.34 2006/06/24 00:12:39 hno Exp $ +# $Id: Makefile.in,v 1.37 2006/09/22 09:09:40 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -113,6 +113,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -153,6 +155,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -190,6 +194,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -207,6 +213,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/NCSA/crypt_md5.c squid-2.6.STABLE4/helpers/basic_auth/NCSA/crypt_md5.c --- squid-2.6.STABLE3/helpers/basic_auth/NCSA/crypt_md5.c Thu Jun 22 19:03:58 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/NCSA/crypt_md5.c Wed Aug 30 12:16:08 2006 @@ -186,7 +186,7 @@ for(idx=0;idx<16;idx++) sprintf(&sum[idx*2],"%02x",digest[idx]); - sum[33]='\0'; + sum[32]='\0'; /* Don't leave anything around in vm they could use. */ memset(digest, 0, sizeof digest); diff -ruN squid-2.6.STABLE3/helpers/basic_auth/NCSA/ncsa_auth.c squid-2.6.STABLE4/helpers/basic_auth/NCSA/ncsa_auth.c --- squid-2.6.STABLE3/helpers/basic_auth/NCSA/ncsa_auth.c Thu Jun 22 19:03:58 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/NCSA/ncsa_auth.c Thu Sep 21 20:18:00 2006 @@ -105,7 +105,7 @@ main(int argc, char **argv) { struct stat sb; - time_t change_time = 0; + time_t change_time = -1; char buf[256]; char *user, *passwd, *p; user_data *u; diff -ruN squid-2.6.STABLE3/helpers/basic_auth/PAM/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/PAM/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/PAM/Makefile.in Mon Jun 12 00:09:47 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/PAM/Makefile.in Fri Sep 22 03:09:40 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid PAM authentication helper # -# $Id: Makefile.in,v 1.33 2006/06/12 06:09:47 hno Exp $ +# $Id: Makefile.in,v 1.36 2006/09/22 09:09:40 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -112,6 +112,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -152,6 +154,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -189,6 +193,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -206,6 +212,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/SASL/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/SASL/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/SASL/Makefile.in Mon Jun 12 00:09:48 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/SASL/Makefile.in Fri Sep 22 03:09:40 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid SASL authentication helper # -# $Id: Makefile.in,v 1.30 2006/06/12 06:09:48 hno Exp $ +# $Id: Makefile.in,v 1.33 2006/09/22 09:09:40 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -109,6 +109,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -149,6 +151,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -186,6 +190,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -203,6 +209,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/SMB/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/SMB/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/SMB/Makefile.in Mon Jun 12 00:09:48 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/SMB/Makefile.in Fri Sep 22 03:09:41 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.33 2006/06/12 06:09:48 hno Exp $ +# $Id: Makefile.in,v 1.36 2006/09/22 09:09:41 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -118,6 +118,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -158,6 +160,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -195,6 +199,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -212,6 +218,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/YP/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/YP/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/YP/Makefile.in Mon Jun 12 00:09:50 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/YP/Makefile.in Fri Sep 22 03:09:41 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.34 2006/06/12 06:09:50 hno Exp $ +# $Id: Makefile.in,v 1.37 2006/09/22 09:09:41 hno Exp $ # # @@ -108,6 +108,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -148,6 +150,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -185,6 +189,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -202,6 +208,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/getpwnam/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/getpwnam/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/getpwnam/Makefile.in Mon Jun 12 00:09:51 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/getpwnam/Makefile.in Fri Sep 22 03:09:41 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.32 2006/06/12 06:09:51 hno Exp $ +# $Id: Makefile.in,v 1.35 2006/09/22 09:09:41 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -110,6 +110,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -150,6 +152,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -187,6 +191,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -204,6 +210,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/mswin_sspi/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/mswin_sspi/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/mswin_sspi/Makefile.in Mon Jun 12 00:09:53 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/mswin_sspi/Makefile.in Fri Sep 22 03:09:41 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.6 2006/06/12 06:09:53 hno Exp $ +# $Id: Makefile.in,v 1.9 2006/09/22 09:09:41 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -109,6 +109,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -149,6 +151,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -186,6 +190,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -203,6 +209,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/basic_auth/mswin_sspi/valid.c squid-2.6.STABLE4/helpers/basic_auth/mswin_sspi/valid.c --- squid-2.6.STABLE3/helpers/basic_auth/mswin_sspi/valid.c Sat May 27 02:58:28 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/mswin_sspi/valid.c Sun Sep 17 03:23:50 2006 @@ -49,11 +49,11 @@ Valid_Group(char *UserName, char *Group) { int result = FALSE; - WCHAR wszUserName[256]; // Unicode user name + WCHAR wszUserName[256]; /* Unicode user name */ - WCHAR wszGroup[256]; // Unicode Group + WCHAR wszGroup[256]; /* Unicode Group */ - LPLOCALGROUP_USERS_INFO_0 pBuf = NULL; + LPLOCALGROUP_USERS_INFO_0 pBuf; LPLOCALGROUP_USERS_INFO_0 pTmpBuf; DWORD dwLevel = 0; DWORD dwFlags = LG_INCLUDE_INDIRECT; @@ -63,6 +63,7 @@ NET_API_STATUS nStatus; DWORD i; DWORD dwTotalCount = 0; + LPBYTE pBufTmp = NULL; /* Convert ANSI User Name and Group to Unicode */ @@ -84,7 +85,11 @@ wszUserName, dwLevel, dwFlags, - (LPBYTE *) & pBuf, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries); + &pBufTmp, + dwPrefMaxLen, + &dwEntriesRead, + &dwTotalEntries); + pBuf = (LPLOCALGROUP_USERS_INFO_0) pBufTmp; /* * If the call succeeds, */ @@ -126,7 +131,7 @@ int result = NTV_SERVER_ERROR; size_t i; char NTDomain[256]; - char *domain_qualify; + char *domain_qualify = NULL; char DomainUser[256]; char User[256]; diff -ruN squid-2.6.STABLE3/helpers/basic_auth/multi-domain-NTLM/Makefile.in squid-2.6.STABLE4/helpers/basic_auth/multi-domain-NTLM/Makefile.in --- squid-2.6.STABLE3/helpers/basic_auth/multi-domain-NTLM/Makefile.in Mon Jun 12 00:09:53 2006 +++ squid-2.6.STABLE4/helpers/basic_auth/multi-domain-NTLM/Makefile.in Fri Sep 22 03:09:42 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.30 2006/06/12 06:09:53 hno Exp $ +# $Id: Makefile.in,v 1.33 2006/09/22 09:09:42 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -94,6 +94,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -134,6 +136,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -171,6 +175,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -188,6 +194,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/digest_auth/Makefile.in squid-2.6.STABLE4/helpers/digest_auth/Makefile.in --- squid-2.6.STABLE3/helpers/digest_auth/Makefile.in Mon Jun 12 00:09:53 2006 +++ squid-2.6.STABLE4/helpers/digest_auth/Makefile.in Fri Sep 22 03:09:42 2006 @@ -16,7 +16,7 @@ # Makefile for digest auth helpers in the Squid Object Cache server # -# $Id: Makefile.in,v 1.30 2006/06/12 06:09:53 hno Exp $ +# $Id: Makefile.in,v 1.33 2006/09/22 09:09:42 hno Exp $ # srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -95,6 +95,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -135,6 +137,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -172,6 +176,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -189,6 +195,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/digest_auth/ldap/Makefile.in squid-2.6.STABLE4/helpers/digest_auth/ldap/Makefile.in --- squid-2.6.STABLE3/helpers/digest_auth/ldap/Makefile.in Mon Jun 12 00:09:53 2006 +++ squid-2.6.STABLE4/helpers/digest_auth/ldap/Makefile.in Fri Sep 22 03:09:43 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.11 2006/06/12 06:09:53 hno Exp $ +# $Id: Makefile.in,v 1.14 2006/09/22 09:09:43 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -112,6 +112,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -152,6 +154,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -189,6 +193,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -206,6 +212,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/digest_auth/password/Makefile.in squid-2.6.STABLE4/helpers/digest_auth/password/Makefile.in --- squid-2.6.STABLE3/helpers/digest_auth/password/Makefile.in Mon Jun 12 00:09:55 2006 +++ squid-2.6.STABLE4/helpers/digest_auth/password/Makefile.in Fri Sep 22 03:09:43 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.32 2006/06/12 06:09:55 hno Exp $ +# $Id: Makefile.in,v 1.35 2006/09/22 09:09:43 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -111,6 +111,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -151,6 +153,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -188,6 +192,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -205,6 +211,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/external_acl/Makefile.in squid-2.6.STABLE4/helpers/external_acl/Makefile.in --- squid-2.6.STABLE3/helpers/external_acl/Makefile.in Mon Jun 12 00:09:55 2006 +++ squid-2.6.STABLE4/helpers/external_acl/Makefile.in Fri Sep 22 03:09:43 2006 @@ -16,7 +16,7 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.20 2006/06/12 06:09:55 hno Exp $ +# $Id: Makefile.in,v 1.23 2006/09/22 09:09:43 hno Exp $ # srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -95,6 +95,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -135,6 +137,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -172,6 +176,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -189,6 +195,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/external_acl/ip_user/Makefile.in squid-2.6.STABLE4/helpers/external_acl/ip_user/Makefile.in --- squid-2.6.STABLE3/helpers/external_acl/ip_user/Makefile.in Mon Jun 12 00:09:55 2006 +++ squid-2.6.STABLE4/helpers/external_acl/ip_user/Makefile.in Fri Sep 22 03:09:43 2006 @@ -17,7 +17,7 @@ # # Makefile for the ip_user external_acl helper by Rodrigo Campos # -# $Id: Makefile.in,v 1.19 2006/06/12 06:09:55 hno Exp $ +# $Id: Makefile.in,v 1.22 2006/09/22 09:09:43 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -109,6 +109,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -149,6 +151,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -186,6 +190,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -203,6 +209,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/external_acl/ldap_group/Makefile.in squid-2.6.STABLE4/helpers/external_acl/ldap_group/Makefile.in --- squid-2.6.STABLE3/helpers/external_acl/ldap_group/Makefile.in Mon Jun 12 00:09:59 2006 +++ squid-2.6.STABLE4/helpers/external_acl/ldap_group/Makefile.in Fri Sep 22 03:09:44 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid LDAP authentication helper # -# $Id: Makefile.in,v 1.20 2006/06/12 06:09:59 hno Exp $ +# $Id: Makefile.in,v 1.23 2006/09/22 09:09:44 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -114,6 +114,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -154,6 +156,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -191,6 +195,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -208,6 +214,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/external_acl/mswin_lm_group/Makefile.in squid-2.6.STABLE4/helpers/external_acl/mswin_lm_group/Makefile.in --- squid-2.6.STABLE3/helpers/external_acl/mswin_lm_group/Makefile.in Mon Jun 12 00:09:59 2006 +++ squid-2.6.STABLE4/helpers/external_acl/mswin_lm_group/Makefile.in Fri Sep 22 03:09:44 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.5 2006/06/12 06:09:59 hno Exp $ +# $Id: Makefile.in,v 1.8 2006/09/22 09:09:44 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -109,6 +109,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -149,6 +151,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -186,6 +190,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -203,6 +209,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/external_acl/mswin_lm_group/win32_check_group.c squid-2.6.STABLE4/helpers/external_acl/mswin_lm_group/win32_check_group.c --- squid-2.6.STABLE3/helpers/external_acl/mswin_lm_group/win32_check_group.c Wed Jul 5 09:22:56 2006 +++ squid-2.6.STABLE4/helpers/external_acl/mswin_lm_group/win32_check_group.c Sun Sep 17 03:23:51 2006 @@ -135,10 +135,11 @@ LSA_HANDLE PolicyHandle; LSA_OBJECT_ATTRIBUTES ObjectAttributes; NTSTATUS status; - PPOLICY_PRIMARY_DOMAIN_INFO ppdiDomainInfo; + PPOLICY_PRIMARY_DOMAIN_INFO ppdiDomainInfo = NULL; PWKSTA_INFO_100 pwkiWorkstationInfo; DWORD netret; char *DomainName = NULL; + LPBYTE pwkiWorkstationInfoTmp; /* * Always initialize the object attributes to all zeroes. @@ -152,7 +153,8 @@ * The wki100_computername field contains a pointer to a UNICODE * string containing the local computer name. */ - netret = NetWkstaGetInfo(NULL, 100, (LPBYTE *) & pwkiWorkstationInfo); + netret = NetWkstaGetInfo(NULL, 100, &pwkiWorkstationInfoTmp); + pwkiWorkstationInfo = (PWKSTA_INFO_100) pwkiWorkstationInfoTmp; if (netret == NERR_Success) { /* * We have the workstation name in: @@ -174,6 +176,7 @@ if (status) { debug("OpenPolicy Error: %ld\n", status); } else { + PVOID ppdiDomainInfoTmp; /* * You have a handle to the policy object. Now, get the @@ -181,7 +184,8 @@ */ status = LsaQueryInformationPolicy(PolicyHandle, PolicyPrimaryDomainInformation, - (PVOID *) & ppdiDomainInfo); + &ppdiDomainInfoTmp); + ppdiDomainInfo = (PPOLICY_PRIMARY_DOMAIN_INFO) ppdiDomainInfoTmp; if (status) { debug("LsaQueryInformationPolicy Error: %ld\n", status); } else { @@ -218,7 +222,7 @@ } /* returns 0 on match, -1 if no match */ -static int +static int wcstrcmparray(const wchar_t * str, const char **array) { WCHAR wszGroup[GNLEN + 1]; // Unicode Group @@ -242,7 +246,7 @@ char *Domain_Separator; WCHAR wszUserName[UNLEN + 1]; // Unicode user name - LPLOCALGROUP_USERS_INFO_0 pBuf = NULL; + LPLOCALGROUP_USERS_INFO_0 pBuf; LPLOCALGROUP_USERS_INFO_0 pTmpBuf; DWORD dwLevel = 0; DWORD dwFlags = LG_INCLUDE_INDIRECT; @@ -252,6 +256,7 @@ NET_API_STATUS nStatus; DWORD i; DWORD dwTotalCount = 0; + LPBYTE pBufTmp = NULL; if ((Domain_Separator = strchr(UserName, '/')) != NULL) *Domain_Separator = '\\'; @@ -271,15 +276,15 @@ * function should also return the names of the local * groups in which the user is indirectly a member. */ - nStatus = NetUserGetLocalGroups( - NULL, + nStatus = NetUserGetLocalGroups(NULL, wszUserName, dwLevel, dwFlags, - (LPBYTE *) & pBuf, + &pBufTmp, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries); + pBuf = (LPLOCALGROUP_USERS_INFO_0) pBufTmp; /* * If the call succeeds, */ @@ -322,7 +327,7 @@ WCHAR wszUserDomain[DNLEN + 1]; // Unicode User Domain char NTDomain[DNLEN + UNLEN + 2]; - char *domain_qualify; + char *domain_qualify = NULL; char User[UNLEN + 1]; size_t j; @@ -330,7 +335,7 @@ LPWSTR UsrDCptr = NULL; LPGROUP_USERS_INFO_0 pUsrBuf = NULL; LPGROUP_USERS_INFO_0 pTmpBuf; - LPSERVER_INFO_101 pSrvBuf = NULL; + LPSERVER_INFO_101 pSrvBuf; DWORD dwLevel = 0; DWORD dwPrefMaxLen = -1; DWORD dwEntriesRead = 0; @@ -338,6 +343,7 @@ NET_API_STATUS nStatus; DWORD i; DWORD dwTotalCount = 0; + LPBYTE pBufTmp = NULL; strncpy(NTDomain, UserName, sizeof(NTDomain)); @@ -367,7 +373,8 @@ /* Call the NetServerGetInfo function for local computer, specifying level 101. */ dwLevel = 101; - nStatus = NetServerGetInfo(NULL, dwLevel, (LPBYTE *) & pSrvBuf); + nStatus = NetServerGetInfo(NULL, dwLevel, &pBufTmp); + pSrvBuf = (LPSERVER_INFO_101) pBufTmp; if (nStatus == NERR_Success) { /* Check if we are running on a Domain Controller */ @@ -375,8 +382,11 @@ (pSrvBuf->sv101_type & SV_TYPE_DOMAIN_BAKCTRL)) { LclDCptr = NULL; debug("Running on a DC.\n"); - } else - nStatus = (use_PDC_only ? NetGetDCName(NULL, wszLocalDomain, (LPBYTE *) & LclDCptr) : NetGetAnyDCName(NULL, wszLocalDomain, (LPBYTE *) & LclDCptr)); + } else { + pBufTmp = NULL; + nStatus = (use_PDC_only ? NetGetDCName(NULL, wszLocalDomain, &pBufTmp) : NetGetAnyDCName(NULL, wszLocalDomain, &pBufTmp)); + LclDCptr = (LPWSTR) pBufTmp; + } } else { fprintf(stderr, "%s NetServerGetInfo() failed.'\n", myname); if (pSrvBuf != NULL) @@ -390,7 +400,9 @@ if (strcmp(NTDomain, machinedomain) != 0) { MultiByteToWideChar(CP_ACP, 0, NTDomain, strlen(NTDomain) + 1, wszUserDomain, sizeof(wszUserDomain) / sizeof(wszUserDomain[0])); - nStatus = (use_PDC_only ? NetGetDCName(LclDCptr, wszUserDomain, (LPBYTE *) & UsrDCptr) : NetGetAnyDCName(LclDCptr, wszUserDomain, (LPBYTE *) & UsrDCptr)); + pBufTmp = NULL; + nStatus = (use_PDC_only ? NetGetDCName(LclDCptr, wszUserDomain, &pBufTmp) : NetGetAnyDCName(LclDCptr, wszUserDomain, &pBufTmp)); + UsrDCptr = (LPWSTR) pBufTmp; if (nStatus != NERR_Success) { fprintf(stderr, "%s Can't find DC for user's domain '%s'\n", myname, NTDomain); if (pSrvBuf != NULL) @@ -410,13 +422,15 @@ * specifying information level 0. */ dwLevel = 0; + pBufTmp = NULL; nStatus = NetUserGetGroups(UsrDCptr, wszUserName, dwLevel, - (LPBYTE *) & pUsrBuf, + &pBufTmp, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries); + pUsrBuf = (LPGROUP_USERS_INFO_0) pBufTmp; /* * If the call succeeds, */ diff -ruN squid-2.6.STABLE3/helpers/external_acl/session/Makefile.in squid-2.6.STABLE4/helpers/external_acl/session/Makefile.in --- squid-2.6.STABLE3/helpers/external_acl/session/Makefile.in Mon Jun 12 00:10:00 2006 +++ squid-2.6.STABLE4/helpers/external_acl/session/Makefile.in Fri Sep 22 03:09:44 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid LDAP authentication helper # -# $Id: Makefile.in,v 1.6 2006/06/12 06:10:00 hno Exp $ +# $Id: Makefile.in,v 1.9 2006/09/22 09:09:44 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -112,6 +112,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -152,6 +154,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -189,6 +193,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -206,6 +212,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/external_acl/unix_group/Makefile.in squid-2.6.STABLE4/helpers/external_acl/unix_group/Makefile.in --- squid-2.6.STABLE3/helpers/external_acl/unix_group/Makefile.in Mon Jun 12 00:10:01 2006 +++ squid-2.6.STABLE4/helpers/external_acl/unix_group/Makefile.in Fri Sep 22 03:09:44 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid LDAP authentication helper # -# $Id: Makefile.in,v 1.19 2006/06/12 06:10:01 hno Exp $ +# $Id: Makefile.in,v 1.22 2006/09/22 09:09:44 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -111,6 +111,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -151,6 +153,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -188,6 +192,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -205,6 +211,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/external_acl/wbinfo_group/Makefile.in squid-2.6.STABLE4/helpers/external_acl/wbinfo_group/Makefile.in --- squid-2.6.STABLE3/helpers/external_acl/wbinfo_group/Makefile.in Mon Jun 12 00:10:04 2006 +++ squid-2.6.STABLE4/helpers/external_acl/wbinfo_group/Makefile.in Fri Sep 22 03:09:44 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid LDAP authentication helper # -# $Id: Makefile.in,v 1.18 2006/06/12 06:10:04 hno Exp $ +# $Id: Makefile.in,v 1.21 2006/09/22 09:09:44 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -94,6 +94,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -134,6 +136,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -171,6 +175,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -188,6 +194,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/negotiate_auth/Makefile.in squid-2.6.STABLE4/helpers/negotiate_auth/Makefile.in --- squid-2.6.STABLE3/helpers/negotiate_auth/Makefile.in Mon Jun 12 00:10:04 2006 +++ squid-2.6.STABLE4/helpers/negotiate_auth/Makefile.in Fri Sep 22 03:09:45 2006 @@ -16,7 +16,7 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.7 2006/06/12 06:10:04 hno Exp $ +# $Id: Makefile.in,v 1.10 2006/09/22 09:09:45 hno Exp $ # srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -95,6 +95,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -135,6 +137,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -172,6 +176,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -189,6 +195,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/negotiate_auth/mswin_sspi/Makefile.in squid-2.6.STABLE4/helpers/negotiate_auth/mswin_sspi/Makefile.in --- squid-2.6.STABLE3/helpers/negotiate_auth/mswin_sspi/Makefile.in Mon Jun 12 00:10:06 2006 +++ squid-2.6.STABLE4/helpers/negotiate_auth/mswin_sspi/Makefile.in Fri Sep 22 03:09:45 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.5 2006/06/12 06:10:06 hno Exp $ +# $Id: Makefile.in,v 1.8 2006/09/22 09:09:45 hno Exp $ # srcdir = @srcdir@ @@ -108,6 +108,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -148,6 +150,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -185,6 +189,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -202,6 +208,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/Makefile.in squid-2.6.STABLE4/helpers/ntlm_auth/Makefile.in --- squid-2.6.STABLE3/helpers/ntlm_auth/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/Makefile.in Fri Sep 22 03:09:46 2006 @@ -16,7 +16,7 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.33 2006/06/12 06:10:08 hno Exp $ +# $Id: Makefile.in,v 1.36 2006/09/22 09:09:46 hno Exp $ # srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -95,6 +95,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -135,6 +137,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -172,6 +176,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -189,6 +195,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/SMB/Makefile.in squid-2.6.STABLE4/helpers/ntlm_auth/SMB/Makefile.in --- squid-2.6.STABLE3/helpers/ntlm_auth/SMB/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/SMB/Makefile.in Fri Sep 22 03:09:46 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.32 2006/06/12 06:10:08 hno Exp $ +# $Id: Makefile.in,v 1.35 2006/09/22 09:09:46 hno Exp $ # srcdir = @srcdir@ @@ -115,6 +115,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -155,6 +157,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -192,6 +196,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -209,6 +215,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/SMB/smbval/Makefile.in squid-2.6.STABLE4/helpers/ntlm_auth/SMB/smbval/Makefile.in --- squid-2.6.STABLE3/helpers/ntlm_auth/SMB/smbval/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/SMB/smbval/Makefile.in Fri Sep 22 03:09:46 2006 @@ -103,6 +103,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -143,6 +145,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -180,6 +184,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -197,6 +203,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/fakeauth/Makefile.in squid-2.6.STABLE4/helpers/ntlm_auth/fakeauth/Makefile.in --- squid-2.6.STABLE3/helpers/ntlm_auth/fakeauth/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/fakeauth/Makefile.in Fri Sep 22 03:09:47 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.31 2006/06/12 06:10:08 hno Exp $ +# $Id: Makefile.in,v 1.34 2006/09/22 09:09:47 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -110,6 +110,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -150,6 +152,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -187,6 +191,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -204,6 +210,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/fakeauth/fakeauth_auth.c squid-2.6.STABLE4/helpers/ntlm_auth/fakeauth/fakeauth_auth.c --- squid-2.6.STABLE3/helpers/ntlm_auth/fakeauth/fakeauth_auth.c Tue Aug 15 18:54:15 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/fakeauth/fakeauth_auth.c Tue Aug 29 09:44:49 2006 @@ -88,7 +88,7 @@ if (n % 16 == 1) { /* store address for this line */ snprintf(addrstr, sizeof(addrstr), "%.4x", - (unsigned int)(p - (unsigned char *)data)); + (unsigned int) (p - (unsigned char *) data)); } c = *p; if (isalnum(c) == 0) { @@ -280,7 +280,7 @@ fprintf(stderr, "ntlmDecodeAuth: header check fails\n"); return -1; } - debug("ntlmDecodeAuth: size of %d\n", (int)size); + debug("ntlmDecodeAuth: size of %d\n", (int) size); debug("ntlmDecodeAuth: flg %08x\n", auth->flags); debug("ntlmDecodeAuth: usr o(%d) l(%d)\n", auth->user.offset, auth->user.len); @@ -388,8 +388,9 @@ if ((p = strchr(buf, '\n')) != NULL) *p = '\0'; /* strip \n */ - if ((strlen(buf) > 3) && NTLM_packet_debug_enabled) { + if (strlen(buf) > 3) decoded = base64_decode(buf + 3); + if ((strlen(buf) > 3) && NTLM_packet_debug_enabled) { strncpy(helper_command, buf, 2); helper_command[2] = '\0'; debug("Got '%s' from Squid with data:\n", helper_command); diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/fakeauth/ntlm.h squid-2.6.STABLE4/helpers/ntlm_auth/fakeauth/ntlm.h --- squid-2.6.STABLE3/helpers/ntlm_auth/fakeauth/ntlm.h Wed Aug 16 12:37:42 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/fakeauth/ntlm.h Mon Aug 28 03:19:29 2006 @@ -1,5 +1,5 @@ /* - * $Id: ntlm.h,v 1.6 2006/08/16 18:37:42 serassio Exp $ + * $Id: ntlm.h,v 1.7 2006/08/28 09:19:29 serassio Exp $ * * AUTHOR: Andrew Doran * @@ -119,9 +119,9 @@ #ifdef DEBUG #include #include -static char *__foo; +static const char *__foo; #define debug(X...) if (debug_enabled) { \ - fprintf(stderr,"ntlm-auth[%d](%s:%d): ", (int)getpid(), \ + fprintf(stderr,"ntlm-auth[%ld](%s:%d): ", (long)getpid(), \ ((__foo=strrchr(__FILE__,'/'))==NULL?__FILE__:__foo+1),\ __LINE__);\ fprintf(stderr,X); } @@ -142,7 +142,7 @@ va_list args; va_start(args, format); - fprintf(stderr, "ntlm-auth[%d]: ", getpid()); + fprintf(stderr, "ntlm-auth[%ld]: ", (long)getpid()); vfprintf(stderr, format, args); va_end(args); #if FAIL_DEBUG diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/mswin_sspi/Makefile.in squid-2.6.STABLE4/helpers/ntlm_auth/mswin_sspi/Makefile.in --- squid-2.6.STABLE3/helpers/ntlm_auth/mswin_sspi/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/mswin_sspi/Makefile.in Fri Sep 22 03:09:47 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.5 2006/06/12 06:10:08 hno Exp $ +# $Id: Makefile.in,v 1.8 2006/09/22 09:09:47 hno Exp $ # srcdir = @srcdir@ @@ -107,6 +107,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -147,6 +149,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -184,6 +188,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -201,6 +207,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/mswin_sspi/libntlmssp.c squid-2.6.STABLE4/helpers/ntlm_auth/mswin_sspi/libntlmssp.c --- squid-2.6.STABLE3/helpers/ntlm_auth/mswin_sspi/libntlmssp.c Sat May 27 02:58:30 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/mswin_sspi/libntlmssp.c Sun Sep 17 03:23:52 2006 @@ -33,7 +33,7 @@ WCHAR wszGroup[GNLEN + 1]; // Unicode Group - LPLOCALGROUP_USERS_INFO_0 pBuf = NULL; + LPLOCALGROUP_USERS_INFO_0 pBuf; LPLOCALGROUP_USERS_INFO_0 pTmpBuf; DWORD dwLevel = 0; DWORD dwFlags = LG_INCLUDE_INDIRECT; @@ -43,6 +43,7 @@ NET_API_STATUS nStatus; DWORD i; DWORD dwTotalCount = 0; + LPBYTE pBufTmp = NULL; /* Convert ANSI User Name and Group to Unicode */ @@ -64,7 +65,11 @@ wszUserName, dwLevel, dwFlags, - (LPBYTE *) & pBuf, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries); + &pBufTmp, + dwPrefMaxLen, + &dwEntriesRead, + &dwTotalEntries); + pBuf = (LPLOCALGROUP_USERS_INFO_0) pBufTmp; /* * If the call succeeds, */ @@ -123,10 +128,11 @@ LSA_HANDLE PolicyHandle; LSA_OBJECT_ATTRIBUTES ObjectAttributes; NTSTATUS status; - PPOLICY_PRIMARY_DOMAIN_INFO ppdiDomainInfo; + PPOLICY_PRIMARY_DOMAIN_INFO ppdiDomainInfo = NULL; PWKSTA_INFO_100 pwkiWorkstationInfo; DWORD netret; char *DomainName = NULL; + LPBYTE pwkiWorkstationInfoTmp; /* * Always initialize the object attributes to all zeroes. @@ -140,7 +146,8 @@ * The wki100_computername field contains a pointer to a UNICODE * string containing the local computer name. */ - netret = NetWkstaGetInfo(NULL, 100, (LPBYTE *) & pwkiWorkstationInfo); + netret = NetWkstaGetInfo(NULL, 100, &pwkiWorkstationInfoTmp); + pwkiWorkstationInfo = (PWKSTA_INFO_100) pwkiWorkstationInfoTmp; if (netret == NERR_Success) { /* * We have the workstation name in: @@ -162,6 +169,7 @@ if (status) { debug("OpenPolicy Error: %ld\n", status); } else { + PVOID ppdiDomainInfoTmp; /* * You have a handle to the policy object. Now, get the @@ -169,7 +177,8 @@ */ status = LsaQueryInformationPolicy(PolicyHandle, PolicyPrimaryDomainInformation, - (void **) &ppdiDomainInfo); + &ppdiDomainInfoTmp); + ppdiDomainInfo = (PPOLICY_PRIMARY_DOMAIN_INFO) ppdiDomainInfoTmp; if (status) { debug("LsaQueryInformationPolicy Error: %ld\n", status); } else { diff -ruN squid-2.6.STABLE3/helpers/ntlm_auth/no_check/Makefile.in squid-2.6.STABLE4/helpers/ntlm_auth/no_check/Makefile.in --- squid-2.6.STABLE3/helpers/ntlm_auth/no_check/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/helpers/ntlm_auth/no_check/Makefile.in Fri Sep 22 03:09:47 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.33 2006/06/12 06:10:08 hno Exp $ +# $Id: Makefile.in,v 1.36 2006/09/22 09:09:47 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -94,6 +94,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -134,6 +136,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -171,6 +175,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -188,6 +194,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/icons/Makefile.in squid-2.6.STABLE4/icons/Makefile.in --- squid-2.6.STABLE3/icons/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/icons/Makefile.in Fri Sep 22 03:09:47 2006 @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.in,v 1.43 2006/06/12 06:10:08 hno Exp $ +# $Id: Makefile.in,v 1.46 2006/09/22 09:09:47 hno Exp $ # srcdir = @srcdir@ @@ -95,6 +95,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -135,6 +137,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -172,6 +176,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -189,6 +195,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/include/autoconf.h.in squid-2.6.STABLE4/include/autoconf.h.in --- squid-2.6.STABLE3/include/autoconf.h.in Wed Jul 12 09:00:31 2006 +++ squid-2.6.STABLE4/include/autoconf.h.in Sat Sep 16 14:30:43 2006 @@ -45,6 +45,9 @@ /* If gettimeofday is known to take only one argument */ #undef GETTIMEOFDAY_NO_TZP +/* Define to 1 if you have the header file. */ +#undef HAVE_AIO_H + /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA @@ -324,6 +327,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_OPENSSL_SSL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_PATHS_H + /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL @@ -584,6 +590,9 @@ /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF + +/* Define if you have PSAPI.DLL on Windows systems */ +#undef HAVE_WIN32_PSAPI /* Some systems support __va_copy */ #undef HAVE___VA_COPY diff -ruN squid-2.6.STABLE3/include/cache_snmp.h squid-2.6.STABLE4/include/cache_snmp.h --- squid-2.6.STABLE3/include/cache_snmp.h Mon May 15 19:08:26 2006 +++ squid-2.6.STABLE4/include/cache_snmp.h Thu Sep 21 20:49:24 2006 @@ -1,5 +1,5 @@ /* - * $Id: cache_snmp.h,v 1.28 2006/05/16 01:08:26 hno Exp $ + * $Id: cache_snmp.h,v 1.29 2006/09/22 02:49:24 hno Exp $ */ #ifndef SQUID_CACHE_SNMP_H @@ -212,6 +212,8 @@ PERF_SYS_CURUNLREQ, PERF_SYS_CURUNUSED_FD, PERF_SYS_CURRESERVED_FD, + PERF_SYS_CURUSED_FD, + PERF_SYS_CURMAX_FD, PERF_SYS_END }; @@ -254,6 +256,7 @@ PERF_MEDIAN_DNS, PERF_MEDIAN_RHR, PERF_MEDIAN_BHR, + PERF_MEDIAN_HTTP_NH, PERF_MEDIAN_END }; diff -ruN squid-2.6.STABLE3/include/config.h squid-2.6.STABLE4/include/config.h --- squid-2.6.STABLE3/include/config.h Fri Jun 2 11:32:44 2006 +++ squid-2.6.STABLE4/include/config.h Fri Sep 8 13:41:23 2006 @@ -1,5 +1,5 @@ /* - * $Id: config.h,v 1.12 2006/06/02 17:32:44 serassio Exp $ + * $Id: config.h,v 1.14 2006/09/08 19:41:23 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -121,6 +121,7 @@ #elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32) #define _SQUID_MSWIN_ #define _SQUID_WIN32_ +#include "squid_mswin.h" #elif defined(__APPLE__) #define _SQUID_APPLE_ @@ -142,6 +143,14 @@ #define fd_mask unsigned long #endif #endif + +/* Large cache file support needs SIZEOF_INT64_T. + * On system with __int64 type could be not defined, so here we define it if needed. + */ +#if (SIZEOF_INT64_T == 0) && (SIZEOF___INT64 > 0) +#undef SIZEOF_INT64_T +#define SIZEOF_INT64_T SIZEOF___INT64 +#endif /* * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD diff -ruN squid-2.6.STABLE3/include/squid_mswin.h squid-2.6.STABLE4/include/squid_mswin.h --- squid-2.6.STABLE3/include/squid_mswin.h Wed Dec 31 17:00:00 1969 +++ squid-2.6.STABLE4/include/squid_mswin.h Fri Sep 22 05:30:17 2006 @@ -0,0 +1,436 @@ +/* + * $Id: squid_mswin.h,v 1.3 2006/09/22 11:30:17 serassio Exp $ + * + * AUTHOR: Andrey Shorin + * AUTHOR: Guido Serassio + * + * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from the + * Internet community. Development is led by Duane Wessels of the + * National Laboratory for Applied Network Research and funded by the + * National Science Foundation. Squid is Copyrighted (C) 1998 by + * the Regents of the University of California. Please see the + * COPYRIGHT file for full details. Squid incorporates software + * developed and/or copyrighted by other sources. Please see the + * CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#ifndef STDC_HEADERS +#define STDC_HEADERS 1 +#endif + +#define _WIN32_WINNT 0x0500 + +#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 +# define __USE_FILE_OFFSET64 1 +#endif + +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ + +typedef unsigned char u_char; + +typedef int SOCKET; +typedef int ssize_t; +typedef int mode_t; + +#if defined __USE_FILE_OFFSET64 +typedef int64_t off_t; +typedef uint64_t ino_t; + +#else +typedef long off_t; +typedef unsigned long ino_t; + +#endif + +#define INT64_MAX _I64_MAX +#define INT64_MIN _I64_MIN + +#include "default_config_file.h" +/* Some tricks for MS Compilers */ +#define __STDC__ 1 +#pragma include_alias(, ) +#define THREADLOCAL __declspec(thread) + +#elif defined(__GNUC__) /* gcc environment */ + +#define THREADLOCAL __attribute__((section(".tls"))) + +#endif + +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define alloca _alloca +#endif +#define chdir _chdir +#define dup _dup +#define dup2 _dup2 +#define fdopen _fdopen +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define fileno _fileno +#endif +#define ftruncate WIN32_ftruncate +#define getcwd _getcwd +#define getpid _getpid +#define getrusage WIN32_getrusage +#define ioctl ioctlsocket +#define memccpy _memccpy +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define mkdir(p) _mkdir(p) +#endif +#define mktemp _mktemp +#define open _open +#define pclose _pclose +#define pipe WIN32_pipe +#define popen _popen +#define putenv _putenv +#define setmode _setmode +#define sleep(t) Sleep((t)*1000) +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define snprintf _snprintf +#endif +#define strcasecmp _stricmp +#define strdup _strdup +#define strlwr _strlwr +#define strncasecmp _strnicmp +#define tempnam _tempnam +#define truncate WIN32_truncate +#define umask _umask +#define unlink _unlink +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define vsnprintf _vsnprintf +#endif + +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_APPEND _O_APPEND + +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL + +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_RAW _O_BINARY +#define O_TEMPORARY _O_TEMPORARY +#define O_NOINHERIT _O_NOINHERIT +#define O_SEQUENTIAL _O_SEQUENTIAL +#define O_RANDOM _O_RANDOM +#define O_NDELAY 0 + +#define S_IRWXO 007 +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR) +#define S_ISREG(m) (((m) & _S_IFREG) == _S_IFREG) +#endif + +#ifndef SIGHUP +#define SIGHUP 1 /* hangup */ +#endif +#ifndef SIGBUS +#define SIGBUS 7 /* bus error */ +#endif +#ifndef SIGKILL +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#endif +#ifndef SIGSEGV +#define SIGSEGV 11 /* segment violation */ +#endif +#ifndef SIGPIPE +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#endif +#ifndef SIGCHLD +#define SIGCHLD 20 /* to parent on child stop or exit */ +#endif +#ifndef SIGUSR1 +#define SIGUSR1 30 /* user defined signal 1 */ +#endif +#ifndef SIGUSR2 +#define SIGUSR2 31 /* user defined signal 2 */ +#endif + +typedef unsigned short in_port_t; +typedef unsigned short int ushort; +typedef int uid_t; +typedef int gid_t; + +#if defined __USE_FILE_OFFSET64 +#define stat _stati64 +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define lseek _lseeki64 +#endif +#define fstat _fstati64 +#define tell _telli64 + +#else +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define stat _stat +#define lseek _lseek +#define fstat _fstat +#define tell _tell +#endif + +#endif + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* user password */ + uid_t pw_uid; /* user id */ + gid_t pw_gid; /* group id */ + char *pw_gecos; /* real name */ + char *pw_dir; /* home directory */ + char *pw_shell; /* shell program */ +}; + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; + +struct statfs { + long f_type; /* type of filesystem (see below) */ + long f_bsize; /* optimal transfer block size */ + long f_blocks; /* total data blocks in file system */ + long f_bfree; /* free blocks in fs */ + long f_bavail; /* free blocks avail to non-superuser */ + long f_files; /* total file nodes in file system */ + long f_ffree; /* free file nodes in fs */ + long f_fsid; /* file system id */ + long f_namelen; /* maximum length of filenames */ + long f_spare[6]; /* spare for later */ +}; + +struct timezone + { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ + }; + +#define CHANGE_FD_SETSIZE 1 +#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE +#define FD_SETSIZE SQUID_MAXFD +#endif + +#include +#include +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +/* Hack to suppress compiler warnings on FD_SET() & FD_CLR() */ +#pragma warning (push) +#pragma warning (disable:4142) +#endif +/* prevent inclusion of wingdi.h */ +#define NOGDI +#include +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#pragma warning (pop) +#include "readdir.h" +#else +#include +#include +#include +#endif + +typedef char * caddr_t; + +#undef FD_CLOSE +#undef FD_OPEN +#undef FD_READ +#undef FD_WRITE +#define EISCONN WSAEISCONN +#define EINPROGRESS WSAEINPROGRESS +#define EWOULDBLOCK WSAEWOULDBLOCK +#define EALREADY WSAEALREADY +#define ETIMEDOUT WSAETIMEDOUT +#define ECONNREFUSED WSAECONNREFUSED +#define ECONNRESET WSAECONNRESET +#define ERESTART WSATRY_AGAIN +#define ENOTCONN WSAENOTCONN + +#undef h_errno +#define h_errno errno /* we'll set it ourselves */ + +#undef FD_CLR +#define FD_CLR(fd, set) do { \ + u_int __i; \ + SOCKET __sock = _get_osfhandle(fd); \ + for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count ; __i++) { \ + if (((fd_set FAR *)(set))->fd_array[__i] == __sock) { \ + while (__i < ((fd_set FAR *)(set))->fd_count-1) { \ + ((fd_set FAR *)(set))->fd_array[__i] = \ + ((fd_set FAR *)(set))->fd_array[__i+1]; \ + __i++; \ + } \ + ((fd_set FAR *)(set))->fd_count--; \ + break; \ + } \ + } \ +} while(0) + +#undef FD_SET +#define FD_SET(fd, set) do { \ + u_int __i; \ + SOCKET __sock = _get_osfhandle(fd); \ + for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count; __i++) { \ + if (((fd_set FAR *)(set))->fd_array[__i] == (__sock)) { \ + break; \ + } \ + } \ + if (__i == ((fd_set FAR *)(set))->fd_count) { \ + if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) { \ + ((fd_set FAR *)(set))->fd_array[__i] = (__sock); \ + ((fd_set FAR *)(set))->fd_count++; \ + } \ + } \ +} while(0) + +#undef FD_ISSET +#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(_get_osfhandle(fd)), (fd_set FAR *)(set)) + +extern THREADLOCAL int ws32_result; + +#define strerror(e) WIN32_strerror(e) + +#define socket(f,t,p) \ + (INVALID_SOCKET == ((SOCKET)(ws32_result = (int)socket(f,t,p))) ? \ + ((WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1), -1) : \ + (SOCKET)_open_osfhandle(ws32_result,0)) +#define accept(s,a,l) \ + (INVALID_SOCKET == ((SOCKET)(ws32_result = (int)accept(_get_osfhandle(s),a,l))) ? \ + ((WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1), -1) : \ + (SOCKET)_open_osfhandle(ws32_result,0)) +#define bind(s,n,l) \ + (SOCKET_ERROR == bind(_get_osfhandle(s),n,l) ? \ + (errno = WSAGetLastError()), -1 : 0) +#define connect(s,n,l) \ + (SOCKET_ERROR == connect(_get_osfhandle(s),n,l) ? \ + (WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1, -1) : 0) +#define listen(s,b) \ + (SOCKET_ERROR == listen(_get_osfhandle(s),b) ? \ + (WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1, -1) : 0) +#define shutdown(s,h) \ + (SOCKET_ERROR == shutdown(_get_osfhandle(s),h) ? \ + (errno = WSAGetLastError()), -1 : 0) +#define select(n,r,w,e,t) \ + (SOCKET_ERROR == (ws32_result = select(n,r,w,e,t)) ? \ + (errno = WSAGetLastError()), -1 : ws32_result) +#define recv(s,b,l,f) \ + (SOCKET_ERROR == (ws32_result = recv(_get_osfhandle(s),b,l,f)) ? \ + (errno = WSAGetLastError()), -1 : ws32_result) +#define recvfrom(s,b,l,f,fr,frl) \ + (SOCKET_ERROR == (ws32_result = recvfrom(_get_osfhandle(s),b,l,f,fr,frl)) ? \ + (errno = WSAGetLastError()), -1 : ws32_result) +#define send(s,b,l,f) \ + (SOCKET_ERROR == (ws32_result = send(_get_osfhandle(s),b,l,f)) ? \ + (errno = WSAGetLastError()), -1 : ws32_result) +#define sendto(s,b,l,f,t,tl) \ + (SOCKET_ERROR == (ws32_result = sendto(_get_osfhandle(s),b,l,f,t,tl)) ? \ + (errno = WSAGetLastError()), -1 : ws32_result) +#define getsockname(s,n,l) \ + (SOCKET_ERROR == getsockname(_get_osfhandle(s),n,l) ? \ + (errno = WSAGetLastError()), -1 : 0) +#define getsockopt(s,l,o,v,n) \ + (Sleep(1), SOCKET_ERROR == getsockopt(_get_osfhandle(s),l,o,(char*)v,n) ? \ + (errno = WSAGetLastError()), -1 : 0) +#define setsockopt(s,l,o,v,n) \ + (SOCKET_ERROR == setsockopt(_get_osfhandle(s),l,o,v,n) ? \ + (errno = WSAGetLastError()), -1 : 0) +#define ioctlsocket(s,c,a) \ + (SOCKET_ERROR == ioctlsocket(_get_osfhandle(s),c,a) ? \ + (errno = WSAGetLastError()), -1 : 0) +#define gethostname(n,l) \ + (SOCKET_ERROR == gethostname(n,l) ? \ + (errno = WSAGetLastError()), -1 : 0) +#define gethostbyname(n) \ + (NULL == ((HOSTENT FAR*)(ws32_result = (int)gethostbyname(n))) ? \ + (errno = WSAGetLastError()), NULL : (HOSTENT FAR*)ws32_result) +#define getservbyname(n,p) \ + (NULL == ((SERVENT FAR*)(ws32_result = (int)getservbyname(n,p))) ? \ + (errno = WSAGetLastError()), NULL : (SERVENT FAR*)ws32_result) +#define gethostbyaddr(a,l,t) \ + (NULL == ((HOSTENT FAR*)(ws32_result = (int)gethostbyaddr(a,l,t))) ? \ + (errno = WSAGetLastError()), NULL : (HOSTENT FAR*)ws32_result) +#undef WSASocket +#ifdef UNICODE +#define WSASocket(a,t,p,i,g,f) \ + (INVALID_SOCKET == ((SOCKET)(ws32_result = (int)WSASocketW(a,t,p,i,g,f))) ? \ + ((WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1), -1) : \ + (SOCKET)_open_osfhandle(ws32_result,0)) +#else +#define WSASocket(a,t,p,i,g,f) \ + (INVALID_SOCKET == ((SOCKET)(ws32_result = (int)WSASocketA(a,t,p,i,g,f))) ? \ + ((WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1), -1) : \ + (SOCKET)_open_osfhandle(ws32_result,0)) +#endif /* !UNICODE */ +#undef WSADuplicateSocket +#ifdef UNICODE +#define WSADuplicateSocket(s,n,l) \ + (SOCKET_ERROR == WSADuplicateSocketW(_get_osfhandle(s),n,l) ? \ + (errno = WSAGetLastError()), -1 : 0) +#else +#define WSADuplicateSocket(s,n,l) \ + (SOCKET_ERROR == WSADuplicateSocketA(_get_osfhandle(s),n,l) ? \ + (errno = WSAGetLastError()), -1 : 0) +#endif /* !UNICODE */ + +#if defined(UTIL_C) +#define read _read +#define write _write +#else +extern THREADLOCAL int _so_err; +extern THREADLOCAL int _so_err_siz; +#define read(fd,buf,siz) \ + (_so_err_siz = sizeof(_so_err), \ + getsockopt((fd),SOL_SOCKET,SO_ERROR,&_so_err,&_so_err_siz) \ + == 0 ? recv((fd),(buf),(siz),0) : _read((fd),(buf),(siz))) +#define write(fd,buf,siz) \ + (_so_err_siz = sizeof(_so_err), \ + getsockopt((fd),SOL_SOCKET,SO_ERROR,&_so_err,&_so_err_siz) \ + == 0 ? send((fd),(buf),(siz),0) : _write((fd),(buf),(siz))) +#endif + +#if defined(COMM_C) || defined(TOOLS_C) +#define close WIN32_Close_FD_Socket +#else +#define close _close +#endif + +#define RUSAGE_SELF 0 /* calling process */ +#define RUSAGE_CHILDREN -1 /* terminated child processes */ + +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ + long ru_maxrss; /* integral max resident set size */ + long ru_ixrss; /* integral shared text memory size */ + long ru_idrss; /* integral unshared data size */ + long ru_isrss; /* integral unshared stack size */ + long ru_minflt; /* page reclaims */ + long ru_majflt; /* page faults */ + long ru_nswap; /* swaps */ + long ru_inblock; /* block input operations */ + long ru_oublock; /* block output operations */ + long ru_msgsnd; /* messages sent */ + long ru_msgrcv; /* messages received */ + long ru_nsignals; /* signals received */ + long ru_nvcsw; /* voluntary context switches */ + long ru_nivcsw; /* involuntary context switches */ +}; diff -ruN squid-2.6.STABLE3/include/sspwin32.h squid-2.6.STABLE4/include/sspwin32.h --- squid-2.6.STABLE3/include/sspwin32.h Sat May 27 02:58:31 2006 +++ squid-2.6.STABLE4/include/sspwin32.h Sat Sep 9 09:41:45 2006 @@ -1,18 +1,36 @@ + /* - * (C) 2002 Guido Serassio + * $Id: sspwin32.h,v 1.2 2006/09/09 15:41:45 serassio Exp $ + * + * AUTHOR: Guido Serassio * Based on previous work of Francesco Chemolli, Robert Collins and Andrew Doran * - * Distributed freely under the terms of the GNU General Public License, - * version 2. See the file COPYING for licensing details + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. */ #ifndef _LIBSSPWIN32_H_ diff -ruN squid-2.6.STABLE3/include/util.h squid-2.6.STABLE4/include/util.h --- squid-2.6.STABLE3/include/util.h Fri May 12 16:06:51 2006 +++ squid-2.6.STABLE4/include/util.h Mon Sep 18 16:54:38 2006 @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.65 2006/05/12 22:06:51 hno Exp $ + * $Id: util.h,v 1.67 2006/09/18 22:54:38 hno Exp $ * * AUTHOR: Harvest Derived * @@ -59,7 +59,6 @@ extern char *xstrdup(const char *); extern char *xstrndup(const char *, size_t); extern const char *xstrerror(void); -extern const char *xbstrerror(int); extern int tvSubMsec(struct timeval, struct timeval); extern int tvSubUsec(struct timeval, struct timeval); extern double tvSubDsec(struct timeval, struct timeval); @@ -121,6 +120,35 @@ /* * Returns the amount of known allocated memory */ -int statMemoryAccounted(void); +extern size_t statMemoryAccounted(void); + +/* Cygwin & Windows NT Port */ +/* win32lib.c */ +#ifdef _SQUID_MSWIN_ +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +extern int64_t WIN32_strtoll(const char *nptr, char **endptr, int base); +#endif +extern int chroot(const char *); +extern int ftruncate(int, off_t); +extern int gettimeofday(struct timeval *, struct timezone *); +extern int inet_aton(const char *, struct in_addr *); +extern int kill(pid_t, int); +extern int statfs(const char *, struct statfs *); +extern int truncate(const char *, off_t); +extern const char *wsastrerror(int); +extern struct passwd *getpwnam(char *); +extern struct group *getgrnam(char *); +extern uid_t geteuid(void); +extern uid_t getuid(void); +extern int setuid(uid_t); +extern int seteuid(uid_t); +extern gid_t getgid(void); +extern gid_t getegid(void); +extern int setgid(gid_t); +extern int setegid(gid_t); +extern const char *WIN32_strerror(int); +extern void WIN32_maperror(unsigned long); +extern int WIN32_Close_FD_Socket(int); +#endif #endif /* SQUID_UTIL_H */ diff -ruN squid-2.6.STABLE3/include/version.h squid-2.6.STABLE4/include/version.h --- squid-2.6.STABLE3/include/version.h Fri Aug 18 15:32:54 2006 +++ squid-2.6.STABLE4/include/version.h Sat Sep 23 11:49:33 2006 @@ -9,5 +9,5 @@ */ #ifndef SQUID_RELEASE_TIME -#define SQUID_RELEASE_TIME 1155936771 +#define SQUID_RELEASE_TIME 1159033770 #endif diff -ruN squid-2.6.STABLE3/lib/Makefile.am squid-2.6.STABLE4/lib/Makefile.am --- squid-2.6.STABLE3/lib/Makefile.am Sat May 27 02:58:31 2006 +++ squid-2.6.STABLE4/lib/Makefile.am Fri Sep 8 13:41:24 2006 @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in # -# $Id: Makefile.am,v 1.8 2006/05/27 08:58:31 serassio Exp $ +# $Id: Makefile.am,v 1.9 2006/09/08 19:41:24 serassio Exp $ # if NEED_OWN_SNPRINTF @@ -24,6 +24,12 @@ LIBSSPWIN32= endif +if ENABLE_MINGW32SPECIFIC +WIN32SRC = win32lib.c +else +WIN32SRC= +endif + EXTRA_LIBRARIES = \ libdlmalloc.a \ libregex.a \ @@ -37,7 +43,8 @@ EXTRA_libmiscutil_a_SOURCES = \ md5.c \ snprintf.c \ - strsep.c + strsep.c \ + win32lib.c libmiscutil_a_SOURCES = \ Array.c \ base64.c \ @@ -59,7 +66,8 @@ $(STRSEPSOURCE) \ stub_memaccount.c \ util.c \ - uudecode.c + uudecode.c \ + $(WIN32SRC) libmiscutil_a_LIBADD = \ @LIBOBJS@ # $(top_srcdir)/include/version.h should be a dependency diff -ruN squid-2.6.STABLE3/lib/Makefile.in squid-2.6.STABLE4/lib/Makefile.in --- squid-2.6.STABLE3/lib/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/lib/Makefile.in Fri Sep 22 03:09:48 2006 @@ -15,7 +15,7 @@ @SET_MAKE@ # -# $Id: Makefile.in,v 1.82 2006/06/12 06:10:08 hno Exp $ +# $Id: Makefile.in,v 1.85 2006/09/22 09:09:48 hno Exp $ # srcdir = @srcdir@ @@ -62,10 +62,12 @@ am__libmiscutil_a_SOURCES_DIST = Array.c base64.c getfullhostname.c \ hash.c heap.c html_quote.c iso3307.c md5.c radix.c rfc1035.c \ rfc1123.c rfc1738.c rfc2617.c safe_inet_addr.c snprintf.c \ - splay.c Stack.c strsep.c stub_memaccount.c util.c uudecode.c + splay.c Stack.c strsep.c stub_memaccount.c util.c uudecode.c \ + win32lib.c @NEED_OWN_MD5_TRUE@am__objects_1 = md5.$(OBJEXT) @NEED_OWN_SNPRINTF_TRUE@am__objects_2 = snprintf.$(OBJEXT) @NEED_OWN_STRSEP_TRUE@am__objects_3 = strsep.$(OBJEXT) +@ENABLE_MINGW32SPECIFIC_TRUE@am__objects_4 = win32lib.$(OBJEXT) am_libmiscutil_a_OBJECTS = Array.$(OBJEXT) base64.$(OBJEXT) \ getfullhostname.$(OBJEXT) hash.$(OBJEXT) heap.$(OBJEXT) \ html_quote.$(OBJEXT) iso3307.$(OBJEXT) $(am__objects_1) \ @@ -73,7 +75,7 @@ rfc1738.$(OBJEXT) rfc2617.$(OBJEXT) safe_inet_addr.$(OBJEXT) \ $(am__objects_2) splay.$(OBJEXT) Stack.$(OBJEXT) \ $(am__objects_3) stub_memaccount.$(OBJEXT) util.$(OBJEXT) \ - uudecode.$(OBJEXT) + uudecode.$(OBJEXT) $(am__objects_4) libmiscutil_a_OBJECTS = $(am_libmiscutil_a_OBJECTS) libntlmauth_a_AR = $(AR) $(ARFLAGS) libntlmauth_a_DEPENDENCIES = @LIBOBJS@ @@ -138,6 +140,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -178,6 +182,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -215,6 +221,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -232,6 +240,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ @@ -281,6 +290,8 @@ @NEED_OWN_MD5_TRUE@MD5SOURCE = md5.c @ENABLE_WIN32SPECIFIC_FALSE@LIBSSPWIN32 = @ENABLE_WIN32SPECIFIC_TRUE@LIBSSPWIN32 = libsspwin32.a +@ENABLE_MINGW32SPECIFIC_FALSE@WIN32SRC = +@ENABLE_MINGW32SPECIFIC_TRUE@WIN32SRC = win32lib.c EXTRA_LIBRARIES = \ libdlmalloc.a \ libregex.a \ @@ -296,7 +307,8 @@ EXTRA_libmiscutil_a_SOURCES = \ md5.c \ snprintf.c \ - strsep.c + strsep.c \ + win32lib.c libmiscutil_a_SOURCES = \ Array.c \ @@ -319,7 +331,8 @@ $(STRSEPSOURCE) \ stub_memaccount.c \ util.c \ - uudecode.c + uudecode.c \ + $(WIN32SRC) libmiscutil_a_LIBADD = \ @LIBOBJS@ @@ -434,6 +447,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub_memaccount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uudecode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32lib.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ diff -ruN squid-2.6.STABLE3/lib/sspwin32.c squid-2.6.STABLE4/lib/sspwin32.c --- squid-2.6.STABLE3/lib/sspwin32.c Sat May 27 02:58:31 2006 +++ squid-2.6.STABLE4/lib/sspwin32.c Sat Sep 9 09:41:45 2006 @@ -1,18 +1,36 @@ + /* - * (C) 2002 Guido Serassio - * Based on previous work of Francesco Chemolli, Robert Collins + * $Id: sspwin32.c,v 1.2 2006/09/09 15:41:45 serassio Exp $ * - * Distributed freely under the terms of the GNU General Public License, - * version 2. See the file COPYING for licensing details + * AUTHOR: Guido Serassio + * inspired by previous work by Robert Collins, Francesco Chemolli. + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. */ #include "util.h" diff -ruN squid-2.6.STABLE3/lib/stub_memaccount.c squid-2.6.STABLE4/lib/stub_memaccount.c --- squid-2.6.STABLE3/lib/stub_memaccount.c Wed Feb 7 11:56:51 2001 +++ squid-2.6.STABLE4/lib/stub_memaccount.c Mon Sep 18 16:54:38 2006 @@ -1,11 +1,11 @@ /* - * $Id: stub_memaccount.c,v 1.5 2001/02/07 18:56:51 hno Exp $ + * $Id: stub_memaccount.c,v 1.6 2006/09/18 22:54:38 hno Exp $ */ /* Stub function for programs not implementing statMemoryAccounted */ #include "config.h" #include "util.h" -int +size_t statMemoryAccounted(void) { return -1; diff -ruN squid-2.6.STABLE3/lib/util.c squid-2.6.STABLE4/lib/util.c --- squid-2.6.STABLE3/lib/util.c Mon Jun 26 09:01:59 2006 +++ squid-2.6.STABLE4/lib/util.c Mon Sep 18 16:54:38 2006 @@ -1,6 +1,6 @@ /* - * $Id: util.c,v 1.92 2006/06/26 15:01:59 hno Exp $ + * $Id: util.c,v 1.94 2006/09/18 22:54:38 hno Exp $ * * DEBUG: * AUTHOR: Harvest Derived @@ -33,6 +33,11 @@ * */ +/* On native Windows, squid_mswin.h needs to know when we are compiling + * util.c for the correct handling of FD<=>socket magic + */ +#define UTIL_C + #define _etext etext #include "config.h" @@ -312,7 +317,6 @@ static void xmalloc_show_trace(void *p, int sign) { - int statMemoryAccounted(); static size_t last_total = 0, last_accounted = 0, last_mallinfo = 0; size_t accounted = statMemoryAccounted(); size_t mi = 0; @@ -626,7 +630,7 @@ const char *errmsg; errmsg = strerror(errno); - + if (!errmsg || !*errmsg) errmsg = "Unknown error"; diff -ruN squid-2.6.STABLE3/lib/win32lib.c squid-2.6.STABLE4/lib/win32lib.c --- squid-2.6.STABLE3/lib/win32lib.c Wed Dec 31 17:00:00 1969 +++ squid-2.6.STABLE4/lib/win32lib.c Sat Sep 9 09:41:45 2006 @@ -0,0 +1,786 @@ + +/* + * $Id: win32lib.c,v 1.2 2006/09/09 15:41:45 serassio Exp $ + * + * Windows support + * AUTHOR: Guido Serassio + * inspired by previous work by Romeo Anghelache & Eric Stern. + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#include "util.h" + +/* The following code section is part of an EXPERIMENTAL native */ +/* Windows NT/2000 Squid port - Compiles only on MS Visual C++ */ +#if defined(_SQUID_MSWIN_) + +#undef strerror +#define sys_nerr _sys_nerr + +#undef assert +#include +#include +#include +#include +#include +#include +#include +#if HAVE_WIN32_PSAPI +#include +#endif + +THREADLOCAL int ws32_result; +THREADLOCAL int _so_err; +THREADLOCAL int _so_err_siz = sizeof(int); +LPCRITICAL_SECTION dbg_mutex = NULL; + +/* internal to Microsoft CRTLIB */ +#define FPIPE 0x08 /* file handle refers to a pipe */ +typedef struct { + long osfhnd; /* underlying OS file HANDLE */ + char osfile; /* attributes of file (e.g., open in text mode?) */ + char pipech; /* one char buffer for handles opened on pipes */ +#ifdef _MT + int lockinitflag; + CRITICAL_SECTION lock; +#endif /* _MT */ +} ioinfo; + +#define IOINFO_L2E 5 +#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) +#define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1)) ) +#define _osfile(i) ( _pioinfo(i)->osfile ) +#define _osfhnd(i) ( _pioinfo(i)->osfhnd ) + +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ + +extern _CRTIMP ioinfo *__pioinfo[]; +int __cdecl _free_osfhnd(int); +#define FOPEN 0x01 /* file handle open */ + +#elif defined(__MINGW32__) /* MinGW environment */ + +#define FOPEN 0x01 /* file handle open */ +__MINGW_IMPORT ioinfo *__pioinfo[]; +int _free_osfhnd(int); + +#endif + + +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +size_t +getpagesize() +{ + return 4096; +} + +int64_t +WIN32_strtoll(const char *nptr, char **endptr, int base) +{ + const char *s; + int64_t acc; + int64_t val; + int neg, any; + char c; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + s = nptr; + do { + c = *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else { + neg = 0; + if (c == '+') + c = *s++; + } + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + acc = any = 0; + if (base < 2 || base > 36) { + errno = EINVAL; + if (endptr != NULL) + *endptr = (char *) (any ? s - 1 : nptr); + return acc; + } + /* The classic bsd implementation requires div/mod operators + * to compute a cutoff. Benchmarking proves that is very, very + * evil to some 32 bit processors. Instead, look for underflow + * in both the mult and add/sub operation. Unlike the bsd impl, + * we also work strictly in a signed int64 word as we haven't + * implemented the unsigned type in win32. + * + * Set 'any' if any `digits' consumed; make it negative to indicate + * overflow. + */ + val = 0; + for (;; c = *s++) { + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'Z') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'z') + c -= 'a' - 10; + else + break; + if (c >= base) + break; + val *= base; + if ((any < 0) /* already noted an over/under flow - short circuit */ + ||(neg && (val > acc || (val -= c) > acc)) /* underflow */ + ||(!neg && (val < acc || (val += c) < acc))) { /* overflow */ + any = -1; /* once noted, over/underflows never go away */ + } else { + acc = val; + any = 1; + } + } + + if (any < 0) { + acc = neg ? INT64_MIN : INT64_MAX; + errno = ERANGE; + } else if (!any) { + errno = EINVAL; + } + if (endptr != NULL) + *endptr = (char *) (any ? s - 1 : nptr); + return (acc); +} +#endif + +uid_t +geteuid(void) +{ + return 100; +} + +uid_t +getuid(void) +{ + return 100; +} + +int +setuid(uid_t uid) +{ + return 0; +} + +int +seteuid(uid_t euid) +{ + return 0; +} + +gid_t +getegid(void) +{ + return 100; +} + +gid_t +getgid(void) +{ + return 100; +} + +int +setgid(gid_t gid) +{ + return 0; +} + +int +setegid(gid_t egid) +{ + return 0; +} + +int +chroot(const char *dirname) +{ + if (SetCurrentDirectory(dirname)) + return 0; + else + return GetLastError(); +} + +/* Convert from "a.b.c.d" IP address string into + * an in_addr structure. Returns 0 on failure, + * and 1 on success. + */ +int +inet_aton(const char *cp, struct in_addr *addr) +{ + if (cp == NULL || addr == NULL) { + return (0); + } + addr->s_addr = inet_addr(cp); + return (addr->s_addr == INADDR_NONE) ? 0 : 1; +} + +void +GetProcessName(pid_t pid, char *ProcessName) +{ + HANDLE hProcess; + + strcpy(ProcessName, "unknown"); +#if HAVE_WIN32_PSAPI + /* Get a handle to the process. */ + hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | + PROCESS_VM_READ, + FALSE, pid); + /* Get the process name. */ + if (NULL != hProcess) { + HMODULE hMod; + DWORD cbNeeded; + + if (EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded)) + GetModuleBaseName(hProcess, hMod, ProcessName, sizeof(ProcessName)); + else { + CloseHandle(hProcess); + return; + } + } else + return; + CloseHandle(hProcess); +#endif +} + +int +kill(pid_t pid, int sig) +{ + HANDLE hProcess; + char MyProcessName[MAX_PATH]; + char ProcessNameToCheck[MAX_PATH]; + + if (sig == 0) { + if ((hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | + PROCESS_VM_READ, + FALSE, pid)) == NULL) + return -1; + else { + CloseHandle(hProcess); + GetProcessName(getpid(), MyProcessName); + GetProcessName(pid, ProcessNameToCheck); + if (strcmp(MyProcessName, ProcessNameToCheck) == 0) + return 0; + return -1; + } + } else + return 0; +} + +int +gettimeofday(struct timeval *pcur_time, struct timezone *tz) +{ + + struct _timeb current; + + _ftime(¤t); + + pcur_time->tv_sec = current.time; + pcur_time->tv_usec = current.millitm * 1000L; + if (tz) { + tz->tz_minuteswest = current.timezone; /* minutes west of Greenwich */ + tz->tz_dsttime = current.dstflag; /* type of dst correction */ + } + return 0; +} + +int +statfs(const char *path, struct statfs *sfs) +{ + char drive[4]; + DWORD spc, bps, freec, totalc; + DWORD vsn, maxlen, flags; + + if (!sfs) { + errno = EINVAL; + return -1; + } + strncpy(drive, path, 2); + drive[2] = '\0'; + strcat(drive, "\\"); + + if (!GetDiskFreeSpace(drive, &spc, &bps, &freec, &totalc)) { + errno = ENOENT; + return -1; + } + if (!GetVolumeInformation(drive, NULL, 0, &vsn, &maxlen, &flags, NULL, 0)) { + errno = ENOENT; + return -1; + } + sfs->f_type = flags; + sfs->f_bsize = spc * bps; + sfs->f_blocks = totalc; + sfs->f_bfree = sfs->f_bavail = freec; + sfs->f_files = -1; + sfs->f_ffree = -1; + sfs->f_fsid = vsn; + sfs->f_namelen = maxlen; + return 0; +} + +#if USE_TRUNCATE +int +WIN32_ftruncate(int fd, off_t size) +{ + HANDLE file; + DWORD error; + LARGE_INTEGER size64; + LARGE_INTEGER test64; + + if (fd < 0) { + errno = EBADF; + return -1; + } + size64.QuadPart = (__int64) size; + test64.QuadPart = 0; + + file = (HANDLE) _get_osfhandle(fd); + + /* Get current file position to check File Handle */ + test64.LowPart = SetFilePointer(file, test64.LowPart, &test64.HighPart, FILE_CURRENT); + if ((test64.LowPart == INVALID_SET_FILE_POINTER) && ((error = GetLastError()) != NO_ERROR)) + goto WIN32_ftruncate_error; + + /* Set the current File Pointer position */ + size64.LowPart = SetFilePointer(file, size64.LowPart, &size64.HighPart, FILE_BEGIN); + if ((size64.LowPart == INVALID_SET_FILE_POINTER) && ((error = GetLastError()) != NO_ERROR)) + goto WIN32_ftruncate_error; + else if (!SetEndOfFile(file)) { + int error = GetLastError(); + goto WIN32_ftruncate_error; + } + return 0; + + WIN32_ftruncate_error: + switch (error) { + case ERROR_INVALID_HANDLE: + errno = EBADF; + break; + default: + errno = EIO; + break; + } + + return -1; +} + +int +WIN32_truncate(const char *pathname, off_t length) +{ + int fd; + int res = -1; + + fd = open(pathname, O_RDWR); + + if (fd == -1) + errno = EBADF; + else { + res = WIN32_ftruncate(fd, length); + _close(fd); + } + + return res; +} +#endif + +static struct _wsaerrtext { + int err; + const char *errconst; + const char *errdesc; +} _wsaerrtext[] = { + + { + WSA_E_CANCELLED, "WSA_E_CANCELLED", "Lookup cancelled." + }, + { + WSA_E_NO_MORE, "WSA_E_NO_MORE", "No more data available." + }, + { + WSAEACCES, "WSAEACCES", "Permission denied." + }, + { + WSAEADDRINUSE, "WSAEADDRINUSE", "Address already in use." + }, + { + WSAEADDRNOTAVAIL, "WSAEADDRNOTAVAIL", "Cannot assign requested address." + }, + { + WSAEAFNOSUPPORT, "WSAEAFNOSUPPORT", "Address family not supported by protocol family." + }, + { + WSAEALREADY, "WSAEALREADY", "Operation already in progress." + }, + { + WSAEBADF, "WSAEBADF", "Bad file number." + }, + { + WSAECANCELLED, "WSAECANCELLED", "Operation cancelled." + }, + { + WSAECONNABORTED, "WSAECONNABORTED", "Software caused connection abort." + }, + { + WSAECONNREFUSED, "WSAECONNREFUSED", "Connection refused." + }, + { + WSAECONNRESET, "WSAECONNRESET", "Connection reset by peer." + }, + { + WSAEDESTADDRREQ, "WSAEDESTADDRREQ", "Destination address required." + }, + { + WSAEDQUOT, "WSAEDQUOT", "Disk quota exceeded." + }, + { + WSAEFAULT, "WSAEFAULT", "Bad address." + }, + { + WSAEHOSTDOWN, "WSAEHOSTDOWN", "Host is down." + }, + { + WSAEHOSTUNREACH, "WSAEHOSTUNREACH", "No route to host." + }, + { + WSAEINPROGRESS, "WSAEINPROGRESS", "Operation now in progress." + }, + { + WSAEINTR, "WSAEINTR", "Interrupted function call." + }, + { + WSAEINVAL, "WSAEINVAL", "Invalid argument." + }, + { + WSAEINVALIDPROCTABLE, "WSAEINVALIDPROCTABLE", "Invalid procedure table from service provider." + }, + { + WSAEINVALIDPROVIDER, "WSAEINVALIDPROVIDER", "Invalid service provider version number." + }, + { + WSAEISCONN, "WSAEISCONN", "Socket is already connected." + }, + { + WSAELOOP, "WSAELOOP", "Too many levels of symbolic links." + }, + { + WSAEMFILE, "WSAEMFILE", "Too many open files." + }, + { + WSAEMSGSIZE, "WSAEMSGSIZE", "Message too long." + }, + { + WSAENAMETOOLONG, "WSAENAMETOOLONG", "File name is too long." + }, + { + WSAENETDOWN, "WSAENETDOWN", "Network is down." + }, + { + WSAENETRESET, "WSAENETRESET", "Network dropped connection on reset." + }, + { + WSAENETUNREACH, "WSAENETUNREACH", "Network is unreachable." + }, + { + WSAENOBUFS, "WSAENOBUFS", "No buffer space available." + }, + { + WSAENOMORE, "WSAENOMORE", "No more data available." + }, + { + WSAENOPROTOOPT, "WSAENOPROTOOPT", "Bad protocol option." + }, + { + WSAENOTCONN, "WSAENOTCONN", "Socket is not connected." + }, + { + WSAENOTEMPTY, "WSAENOTEMPTY", "Directory is not empty." + }, + { + WSAENOTSOCK, "WSAENOTSOCK", "Socket operation on nonsocket." + }, + { + WSAEOPNOTSUPP, "WSAEOPNOTSUPP", "Operation not supported." + }, + { + WSAEPFNOSUPPORT, "WSAEPFNOSUPPORT", "Protocol family not supported." + }, + { + WSAEPROCLIM, "WSAEPROCLIM", "Too many processes." + }, + { + WSAEPROTONOSUPPORT, "WSAEPROTONOSUPPORT", "Protocol not supported." + }, + { + WSAEPROTOTYPE, "WSAEPROTOTYPE", "Protocol wrong type for socket." + }, + { + WSAEPROVIDERFAILEDINIT, "WSAEPROVIDERFAILEDINIT", "Unable to initialise a service provider." + }, + { + WSAEREFUSED, "WSAEREFUSED", "Refused." + }, + { + WSAEREMOTE, "WSAEREMOTE", "Too many levels of remote in path." + }, + { + WSAESHUTDOWN, "WSAESHUTDOWN", "Cannot send after socket shutdown." + }, + { + WSAESOCKTNOSUPPORT, "WSAESOCKTNOSUPPORT", "Socket type not supported." + }, + { + WSAESTALE, "WSAESTALE", "Stale NFS file handle." + }, + { + WSAETIMEDOUT, "WSAETIMEDOUT", "Connection timed out." + }, + { + WSAETOOMANYREFS, "WSAETOOMANYREFS", "Too many references." + }, + { + WSAEUSERS, "WSAEUSERS", "Too many users." + }, + { + WSAEWOULDBLOCK, "WSAEWOULDBLOCK", "Resource temporarily unavailable." + }, + { + WSANOTINITIALISED, "WSANOTINITIALISED", "Successful WSAStartup not yet performed." + }, + { + WSASERVICE_NOT_FOUND, "WSASERVICE_NOT_FOUND", "Service not found." + }, + { + WSASYSCALLFAILURE, "WSASYSCALLFAILURE", "System call failure." + }, + { + WSASYSNOTREADY, "WSASYSNOTREADY", "Network subsystem is unavailable." + }, + { + WSATYPE_NOT_FOUND, "WSATYPE_NOT_FOUND", "Class type not found." + }, + { + WSAVERNOTSUPPORTED, "WSAVERNOTSUPPORTED", "Winsock.dll version out of range." + }, + { + WSAEDISCON, "WSAEDISCON", "Graceful shutdown in progress." + } +}; + +/* + * wsastrerror() - description of WSAGetLastError() + */ +const char * +wsastrerror(int err) +{ + static char xwsaerror_buf[BUFSIZ]; + int i, errind = -1; + + if (err == 0) + return "(0) No error."; + for (i = 0; i < sizeof(_wsaerrtext) / sizeof(struct _wsaerrtext); i++) { + if (_wsaerrtext[i].err != err) + continue; + errind = i; + break; + } + if (errind == -1) + snprintf(xwsaerror_buf, BUFSIZ, "Unknown"); + else + snprintf(xwsaerror_buf, BUFSIZ, "%s, %s", _wsaerrtext[errind].errconst, _wsaerrtext[errind].errdesc); + return xwsaerror_buf; +} + +struct passwd * +getpwnam(char *unused) +{ + static struct passwd pwd = + {NULL, NULL, 100, 100, NULL, NULL, NULL}; + return &pwd; +} + +struct group * +getgrnam(char *unused) +{ + static struct group grp = + {NULL, NULL, 100, NULL}; + return &grp; +} + +/* + * WIN32_strerror with argument for late notification */ + +const char * +WIN32_strerror(int err) +{ + static char xbstrerror_buf[BUFSIZ]; + + if (err < 0 || err >= sys_nerr) + strncpy(xbstrerror_buf, wsastrerror(err), BUFSIZ); + else + strncpy(xbstrerror_buf, strerror(err), BUFSIZ); + return xbstrerror_buf; +} + +int +WIN32_Close_FD_Socket(int fd) +{ + int result = 0; + + if (closesocket(_get_osfhandle(fd)) == SOCKET_ERROR) { + errno = WSAGetLastError(); + result = 1; + } + _free_osfhnd(fd); + _osfile(fd) = 0; + return result; +} + +#if defined(__MINGW32__) /* MinGW environment */ +int +_free_osfhnd(int filehandle) +{ + if (((unsigned) filehandle < SQUID_MAXFD) && + (_osfile(filehandle) & FOPEN) && + (_osfhnd(filehandle) != (long) INVALID_HANDLE_VALUE)) { + switch (filehandle) { + case 0: + SetStdHandle(STD_INPUT_HANDLE, NULL); + break; + case 1: + SetStdHandle(STD_OUTPUT_HANDLE, NULL); + break; + case 2: + SetStdHandle(STD_ERROR_HANDLE, NULL); + break; + } + _osfhnd(filehandle) = (long) INVALID_HANDLE_VALUE; + return (0); + } else { + errno = EBADF; /* bad handle */ + _doserrno = 0L; /* not an OS error */ + return -1; + } +} +#endif + +struct errorentry { + unsigned long WIN32_code; + int POSIX_errno; +}; + +static struct errorentry errortable[] = +{ + {ERROR_INVALID_FUNCTION, EINVAL}, + {ERROR_FILE_NOT_FOUND, ENOENT}, + {ERROR_PATH_NOT_FOUND, ENOENT}, + {ERROR_TOO_MANY_OPEN_FILES, EMFILE}, + {ERROR_ACCESS_DENIED, EACCES}, + {ERROR_INVALID_HANDLE, EBADF}, + {ERROR_ARENA_TRASHED, ENOMEM}, + {ERROR_NOT_ENOUGH_MEMORY, ENOMEM}, + {ERROR_INVALID_BLOCK, ENOMEM}, + {ERROR_BAD_ENVIRONMENT, E2BIG}, + {ERROR_BAD_FORMAT, ENOEXEC}, + {ERROR_INVALID_ACCESS, EINVAL}, + {ERROR_INVALID_DATA, EINVAL}, + {ERROR_INVALID_DRIVE, ENOENT}, + {ERROR_CURRENT_DIRECTORY, EACCES}, + {ERROR_NOT_SAME_DEVICE, EXDEV}, + {ERROR_NO_MORE_FILES, ENOENT}, + {ERROR_LOCK_VIOLATION, EACCES}, + {ERROR_BAD_NETPATH, ENOENT}, + {ERROR_NETWORK_ACCESS_DENIED, EACCES}, + {ERROR_BAD_NET_NAME, ENOENT}, + {ERROR_FILE_EXISTS, EEXIST}, + {ERROR_CANNOT_MAKE, EACCES}, + {ERROR_FAIL_I24, EACCES}, + {ERROR_INVALID_PARAMETER, EINVAL}, + {ERROR_NO_PROC_SLOTS, EAGAIN}, + {ERROR_DRIVE_LOCKED, EACCES}, + {ERROR_BROKEN_PIPE, EPIPE}, + {ERROR_DISK_FULL, ENOSPC}, + {ERROR_INVALID_TARGET_HANDLE, EBADF}, + {ERROR_INVALID_HANDLE, EINVAL}, + {ERROR_WAIT_NO_CHILDREN, ECHILD}, + {ERROR_CHILD_NOT_COMPLETE, ECHILD}, + {ERROR_DIRECT_ACCESS_HANDLE, EBADF}, + {ERROR_NEGATIVE_SEEK, EINVAL}, + {ERROR_SEEK_ON_DEVICE, EACCES}, + {ERROR_DIR_NOT_EMPTY, ENOTEMPTY}, + {ERROR_NOT_LOCKED, EACCES}, + {ERROR_BAD_PATHNAME, ENOENT}, + {ERROR_MAX_THRDS_REACHED, EAGAIN}, + {ERROR_LOCK_FAILED, EACCES}, + {ERROR_ALREADY_EXISTS, EEXIST}, + {ERROR_FILENAME_EXCED_RANGE, ENOENT}, + {ERROR_NESTING_NOT_ALLOWED, EAGAIN}, + {ERROR_NOT_ENOUGH_QUOTA, ENOMEM} +}; + +#define MIN_EXEC_ERROR ERROR_INVALID_STARTING_CODESEG +#define MAX_EXEC_ERROR ERROR_INFLOOP_IN_RELOC_CHAIN + +#define MIN_EACCES_RANGE ERROR_WRITE_PROTECT +#define MAX_EACCES_RANGE ERROR_SHARING_BUFFER_EXCEEDED + +void +WIN32_maperror(unsigned long WIN32_oserrno) +{ + int i; + + _doserrno = WIN32_oserrno; + for (i = 0; i < (sizeof(errortable) / sizeof(struct errorentry)); ++i) { + if (WIN32_oserrno == errortable[i].WIN32_code) { + errno = errortable[i].POSIX_errno; + return; + } + } + if (WIN32_oserrno >= MIN_EACCES_RANGE && WIN32_oserrno <= MAX_EACCES_RANGE) + errno = EACCES; + else if (WIN32_oserrno >= MIN_EXEC_ERROR && WIN32_oserrno <= MAX_EXEC_ERROR) + errno = ENOEXEC; + else + errno = EINVAL; +} +#endif diff -ruN squid-2.6.STABLE3/scripts/Makefile.in squid-2.6.STABLE4/scripts/Makefile.in --- squid-2.6.STABLE3/scripts/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/scripts/Makefile.in Fri Sep 22 03:09:48 2006 @@ -92,6 +92,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -132,6 +134,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -169,6 +173,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -186,6 +192,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/snmplib/Makefile.in squid-2.6.STABLE4/snmplib/Makefile.in --- squid-2.6.STABLE3/snmplib/Makefile.in Mon Jun 12 00:10:08 2006 +++ squid-2.6.STABLE4/snmplib/Makefile.in Fri Sep 22 03:09:48 2006 @@ -101,6 +101,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -141,6 +143,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -178,6 +182,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -195,6 +201,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = 3.4 +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/src/Makefile.am squid-2.6.STABLE4/src/Makefile.am --- squid-2.6.STABLE3/src/Makefile.am Sun Jul 30 02:55:22 2006 +++ squid-2.6.STABLE4/src/Makefile.am Fri Sep 8 13:41:24 2006 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.52 2006/07/30 08:55:22 serassio Exp $ +# $Id: Makefile.am,v 1.55 2006/09/08 19:41:24 serassio Exp $ # # Uncomment and customize the following to suit your needs: # @@ -62,6 +62,14 @@ WIN32SOURCE = endif +if ENABLE_MINGW32SPECIFIC +MINGWEXLIB = -lmingwex +IPC_SOURCE = ipc_win32.c +else +MINGWEXLIB = +IPC_SOURCE = ipc.c +endif + if USE_POLL COMMLOOP_SOURCE = comm_poll.c endif @@ -121,6 +129,8 @@ comm_select_win32.c \ comm_kqueue.c \ comm_generic.c \ + ipc.c \ + ipc_win32.c \ win32.c squid_SOURCES = \ @@ -172,7 +182,7 @@ icp_v3.c \ ident.c \ internal.c \ - ipc.c \ + $(IPC_SOURCE) \ ipcache.c \ $(LEAKFINDERSOURCE) \ locrewrite.c \ @@ -250,7 +260,8 @@ @SSLLIB@ \ @LIB_EPOLL@ \ -lmiscutil \ - @XTRA_LIBS@ + @XTRA_LIBS@ \ + $(MINGWEXLIB) unlinkd_SOURCES = unlinkd_LDADD = unlinkd-daemon.o diff -ruN squid-2.6.STABLE3/src/Makefile.in squid-2.6.STABLE4/src/Makefile.in --- squid-2.6.STABLE3/src/Makefile.in Sun Jul 30 02:56:18 2006 +++ squid-2.6.STABLE4/src/Makefile.in Fri Sep 22 03:09:48 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.273 2006/07/30 08:56:18 serassio Exp $ +# $Id: Makefile.in,v 1.278 2006/09/22 09:09:48 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -91,17 +91,18 @@ http.c HttpStatusLine.c HttpHdrCc.c HttpHdrRange.c \ HttpHdrContRange.c HttpHeader.c HttpHeaderTools.c HttpBody.c \ HttpMsg.c HttpReply.c HttpRequest.c icmp.c icp_v2.c icp_v3.c \ - ident.c internal.c ipc.c ipcache.c leakfinder.c locrewrite.c \ - logfile.c main.c mem.c MemPool.c MemBuf.c mime.c multicast.c \ - neighbors.c net_db.c Packer.c pconn.c peer_digest.c \ - peer_monitor.c peer_select.c peer_sourcehash.c peer_userhash.c \ - protos.h redirect.c referer.c refresh.c send-announce.c \ - snmp_core.c snmp_agent.c squid.h ssl.c ssl_support.c stat.c \ - StatHist.c String.c stmem.c store.c store_io.c store_client.c \ - store_digest.c store_dir.c store_key_md5.c store_log.c \ - store_rebuild.c store_swapin.c store_swapmeta.c \ - store_swapout.c structs.h tools.c typedefs.h unlinkd.c url.c \ - urn.c useragent.c wais.c wccp.c wccp2.c whois.c win32.c + ident.c internal.c ipc.c ipc_win32.c ipcache.c leakfinder.c \ + locrewrite.c logfile.c main.c mem.c MemPool.c MemBuf.c mime.c \ + multicast.c neighbors.c net_db.c Packer.c pconn.c \ + peer_digest.c peer_monitor.c peer_select.c peer_sourcehash.c \ + peer_userhash.c protos.h redirect.c referer.c refresh.c \ + send-announce.c snmp_core.c snmp_agent.c squid.h ssl.c \ + ssl_support.c stat.c StatHist.c String.c stmem.c store.c \ + store_io.c store_client.c store_digest.c store_dir.c \ + store_key_md5.c store_log.c store_rebuild.c store_swapin.c \ + store_swapmeta.c store_swapout.c structs.h tools.c typedefs.h \ + unlinkd.c url.c urn.c useragent.c wais.c wccp.c wccp2.c \ + whois.c win32.c @USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_FALSE@@USE_SELECT_WIN32_TRUE@am__objects_1 = comm_select_win32.$(OBJEXT) @USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_TRUE@am__objects_1 = comm_select.$(OBJEXT) @USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_TRUE@am__objects_1 = comm_poll.$(OBJEXT) @@ -112,12 +113,14 @@ @USE_DNSSERVER_FALSE@am__objects_3 = dns_internal.$(OBJEXT) @USE_DNSSERVER_TRUE@am__objects_3 = dns.$(OBJEXT) @ENABLE_HTCP_TRUE@am__objects_4 = htcp.$(OBJEXT) -@MAKE_LEAKFINDER_TRUE@am__objects_5 = leakfinder.$(OBJEXT) -@USE_SNMP_TRUE@am__objects_6 = snmp_core.$(OBJEXT) \ +@ENABLE_MINGW32SPECIFIC_FALSE@am__objects_5 = ipc.$(OBJEXT) +@ENABLE_MINGW32SPECIFIC_TRUE@am__objects_5 = ipc_win32.$(OBJEXT) +@MAKE_LEAKFINDER_TRUE@am__objects_6 = leakfinder.$(OBJEXT) +@USE_SNMP_TRUE@am__objects_7 = snmp_core.$(OBJEXT) \ @USE_SNMP_TRUE@ snmp_agent.$(OBJEXT) -@ENABLE_SSL_TRUE@am__objects_7 = ssl_support.$(OBJEXT) -@ENABLE_UNLINKD_TRUE@am__objects_8 = unlinkd.$(OBJEXT) -@ENABLE_WIN32SPECIFIC_TRUE@am__objects_9 = win32.$(OBJEXT) +@ENABLE_SSL_TRUE@am__objects_8 = ssl_support.$(OBJEXT) +@ENABLE_UNLINKD_TRUE@am__objects_9 = unlinkd.$(OBJEXT) +@ENABLE_WIN32SPECIFIC_TRUE@am__objects_10 = win32.$(OBJEXT) am_squid_OBJECTS = access_log.$(OBJEXT) acl.$(OBJEXT) asn.$(OBJEXT) \ authenticate.$(OBJEXT) cache_cf.$(OBJEXT) \ CacheDigest.$(OBJEXT) cache_manager.$(OBJEXT) carp.$(OBJEXT) \ @@ -134,7 +137,7 @@ HttpBody.$(OBJEXT) HttpMsg.$(OBJEXT) HttpReply.$(OBJEXT) \ HttpRequest.$(OBJEXT) icmp.$(OBJEXT) icp_v2.$(OBJEXT) \ icp_v3.$(OBJEXT) ident.$(OBJEXT) internal.$(OBJEXT) \ - ipc.$(OBJEXT) ipcache.$(OBJEXT) $(am__objects_5) \ + $(am__objects_5) ipcache.$(OBJEXT) $(am__objects_6) \ locrewrite.$(OBJEXT) logfile.$(OBJEXT) main.$(OBJEXT) \ mem.$(OBJEXT) MemPool.$(OBJEXT) MemBuf.$(OBJEXT) \ mime.$(OBJEXT) multicast.$(OBJEXT) neighbors.$(OBJEXT) \ @@ -142,22 +145,23 @@ peer_digest.$(OBJEXT) peer_monitor.$(OBJEXT) \ peer_select.$(OBJEXT) peer_sourcehash.$(OBJEXT) \ peer_userhash.$(OBJEXT) redirect.$(OBJEXT) referer.$(OBJEXT) \ - refresh.$(OBJEXT) send-announce.$(OBJEXT) $(am__objects_6) \ - ssl.$(OBJEXT) $(am__objects_7) stat.$(OBJEXT) \ + refresh.$(OBJEXT) send-announce.$(OBJEXT) $(am__objects_7) \ + ssl.$(OBJEXT) $(am__objects_8) stat.$(OBJEXT) \ StatHist.$(OBJEXT) String.$(OBJEXT) stmem.$(OBJEXT) \ store.$(OBJEXT) store_io.$(OBJEXT) store_client.$(OBJEXT) \ store_digest.$(OBJEXT) store_dir.$(OBJEXT) \ store_key_md5.$(OBJEXT) store_log.$(OBJEXT) \ store_rebuild.$(OBJEXT) store_swapin.$(OBJEXT) \ store_swapmeta.$(OBJEXT) store_swapout.$(OBJEXT) \ - tools.$(OBJEXT) $(am__objects_8) url.$(OBJEXT) urn.$(OBJEXT) \ + tools.$(OBJEXT) $(am__objects_9) url.$(OBJEXT) urn.$(OBJEXT) \ useragent.$(OBJEXT) wais.$(OBJEXT) wccp.$(OBJEXT) \ - wccp2.$(OBJEXT) whois.$(OBJEXT) $(am__objects_9) + wccp2.$(OBJEXT) whois.$(OBJEXT) $(am__objects_10) nodist_squid_OBJECTS = repl_modules.$(OBJEXT) auth_modules.$(OBJEXT) \ store_modules.$(OBJEXT) globals.$(OBJEXT) \ string_arrays.$(OBJEXT) squid_OBJECTS = $(am_squid_OBJECTS) $(nodist_squid_OBJECTS) -squid_DEPENDENCIES = +am__DEPENDENCIES_1 = +squid_DEPENDENCIES = $(am__DEPENDENCIES_1) am_unlinkd_OBJECTS = unlinkd_OBJECTS = $(am_unlinkd_OBJECTS) unlinkd_DEPENDENCIES = unlinkd-daemon.o @@ -228,6 +232,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -268,6 +274,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -305,6 +313,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -322,6 +332,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ @@ -384,6 +395,10 @@ @ENABLE_SSL_TRUE@SSLSOURCE = ssl_support.c @ENABLE_WIN32SPECIFIC_FALSE@WIN32SOURCE = @ENABLE_WIN32SPECIFIC_TRUE@WIN32SOURCE = win32.c +@ENABLE_MINGW32SPECIFIC_FALSE@MINGWEXLIB = +@ENABLE_MINGW32SPECIFIC_TRUE@MINGWEXLIB = -lmingwex +@ENABLE_MINGW32SPECIFIC_FALSE@IPC_SOURCE = ipc.c +@ENABLE_MINGW32SPECIFIC_TRUE@IPC_SOURCE = ipc_win32.c @USE_EPOLL_TRUE@COMMLOOP_SOURCE = comm_epoll.c @USE_KQUEUE_TRUE@COMMLOOP_SOURCE = comm_kqueue.c @USE_POLL_TRUE@COMMLOOP_SOURCE = comm_poll.c @@ -412,6 +427,8 @@ comm_select_win32.c \ comm_kqueue.c \ comm_generic.c \ + ipc.c \ + ipc_win32.c \ win32.c squid_SOURCES = \ @@ -463,7 +480,7 @@ icp_v3.c \ ident.c \ internal.c \ - ipc.c \ + $(IPC_SOURCE) \ ipcache.c \ $(LEAKFINDERSOURCE) \ locrewrite.c \ @@ -541,7 +558,8 @@ @SSLLIB@ \ @LIB_EPOLL@ \ -lmiscutil \ - @XTRA_LIBS@ + @XTRA_LIBS@ \ + $(MINGWEXLIB) unlinkd_SOURCES = unlinkd_LDADD = unlinkd-daemon.o @@ -774,6 +792,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ident.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/internal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipc_win32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ipcache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/leakfinder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locrewrite.Po@am__quote@ diff -ruN squid-2.6.STABLE3/src/MemPool.c squid-2.6.STABLE4/src/MemPool.c --- squid-2.6.STABLE3/src/MemPool.c Mon Jun 26 09:01:59 2006 +++ squid-2.6.STABLE4/src/MemPool.c Mon Sep 18 16:54:39 2006 @@ -1,6 +1,6 @@ /* - * $Id: MemPool.c,v 1.38 2006/06/26 15:01:59 hno Exp $ + * $Id: MemPool.c,v 1.39 2006/09/18 22:54:39 hno Exp $ * * DEBUG: section 63 Low Level Memory Pool Management * AUTHOR: Alex Rousskov @@ -377,7 +377,7 @@ (long int) toKB(memPoolInUseSize(pool))); } -int +size_t memTotalAllocated(void) { return TheMeter.alloc.level; diff -ruN squid-2.6.STABLE3/src/access_log.c squid-2.6.STABLE4/src/access_log.c --- squid-2.6.STABLE3/src/access_log.c Wed Aug 2 19:26:18 2006 +++ squid-2.6.STABLE4/src/access_log.c Sat Sep 2 08:08:42 2006 @@ -1,6 +1,6 @@ /* - * $Id: access_log.c,v 1.88 2006/08/03 01:26:18 hno Exp $ + * $Id: access_log.c,v 1.92 2006/09/02 14:08:42 hno Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -579,26 +579,24 @@ break; case LFT_USER_NAME: - { - char *user = accessLogFormatName(al->cache.authuser); - if (!user) - user = accessLogFormatName(al->cache.rfc931); + out = al->cache.authuser; + if (!out || !*out) + out = al->cache.rfc931; #if USE_SSL - if (!user) - user = accessLogFormatName(al->cache.ssluser); + if (!out || !*out) + out = al->cache.ssluser; #endif - dofree = 1; - } + quote = 1; break; case LFT_USER_LOGIN: - out = accessLogFormatName(al->cache.authuser); - dofree = 1; + out = al->cache.authuser; + quote = 1; break; case LFT_USER_IDENT: - out = accessLogFormatName(al->cache.rfc931); - dofree = 1; + out = al->cache.rfc931; + quote = 1; break; /* case LFT_USER_REALM: */ @@ -606,15 +604,15 @@ #if USE_SSL case LFT_USER_SSL: - out = accessLogFormatName(al->cache.ssluser); - dofree = 1; + out = al->cache.ssluser; + quote = 1; break; #endif case LFT_USER_EXT: if (al->request) - out = accessLogFormatName(strBuf(al->request->extacl_log)); - dofree = 1; + out = strBuf(al->request->extacl_log); + quote = 1; break; case LFT_HTTP_CODE: diff -ruN squid-2.6.STABLE3/src/acl.c squid-2.6.STABLE4/src/acl.c --- squid-2.6.STABLE3/src/acl.c Sun Aug 6 12:39:44 2006 +++ squid-2.6.STABLE4/src/acl.c Fri Sep 22 04:44:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: acl.c,v 1.310 2006/08/06 18:39:44 hno Exp $ + * $Id: acl.c,v 1.314 2006/09/22 10:44:24 hno Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -44,7 +44,7 @@ static void aclParseProtoList(void *curlist); static void aclParseMethodList(void *curlist); static void aclParseTimeSpec(void *curlist); -static void aclParseIntRange(void *curlist); +static void aclParsePortRange(void *curlist); static void aclDestroyTimeList(acl_time_data * data); static void aclDestroyIntRange(intrange *); static void aclLookupProxyAuthStart(aclCheck_t * checklist); @@ -322,29 +322,38 @@ for (Tail = curlist; *Tail; Tail = &((*Tail)->next)); while ((t = strtokFile())) { q = memAllocate(MEM_INTLIST); - q->i = atoi(t); + q->i = xatoi(t); *(Tail) = q; Tail = &q->next; } } static void -aclParseIntRange(void *curlist) +aclParsePortRange(void *curlist) { intrange **Tail; - intrange *q = NULL; - char *t = NULL; + char *a; for (Tail = curlist; *Tail; Tail = &((*Tail)->next)); - while ((t = strtokFile())) { - q = xcalloc(1, sizeof(intrange)); - q->i = atoi(t); - t = strchr(t, '-'); - if (t && *(++t)) - q->j = atoi(t); + while ((a = strtokFile())) { + char *b = strchr(a, '-'); + unsigned short port1, port2; + if (b) + *b++ = '\0'; + port1 = xatos(a); + if (b) + port2 = xatos(b); else - q->j = q->i; - *(Tail) = q; - Tail = &q->next; + port2 = port1; + if (port2 >= port1) { + intrange *q = xcalloc(1, sizeof(intrange)); + q->i = port1; + q->j = port2; + *(Tail) = q; + Tail = &q->next; + } else { + debug(28, 0) ("aclParsePortRange: Invalid port value\n"); + self_destruct(); + } } } @@ -614,10 +623,8 @@ } } else { /* assume its time-of-day spec */ - if (sscanf(t, "%d:%d-%d:%d", &h1, &m1, &h2, &m2) < 4) { - debug(28, 0) ("aclParseTimeSpec: ERROR: Bad time range in" - "%s line %d: %s\n", - cfg_filename, config_lineno, config_input_line); + if ((sscanf(t, "%d:%d-%d:%d", &h1, &m1, &h2, &m2) < 4) || (!((h1 >= 0 && h1 < 24) && (h2 >= 0 && h2 < 24) && (m1 >= 0 && m1 < 60) && (m2 >= 0 && m2 < 60)))) { + debug(28, 0) ("aclParseTimeSpec: ERROR: Bad time range '%s'\n", t); self_destruct(); } q = memAllocate(MEM_ACL_TIME_DATA); @@ -1025,7 +1032,7 @@ #endif case ACL_URL_PORT: case ACL_MY_PORT: - aclParseIntRange(&A->data); + aclParsePortRange(&A->data); break; #if USE_IDENT case ACL_IDENT: @@ -1512,7 +1519,7 @@ if (!t) goto error; } - (*acldata)->max = atoi(t); + (*acldata)->max = xatoi(t); debug(28, 5) ("aclParseUserMaxIP: Max IP address's %d\n", (int) (*acldata)->max); return; error: diff -ruN squid-2.6.STABLE3/src/auth/Makefile.in squid-2.6.STABLE4/src/auth/Makefile.in --- squid-2.6.STABLE3/src/auth/Makefile.in Mon Jun 12 00:10:12 2006 +++ squid-2.6.STABLE4/src/auth/Makefile.in Fri Sep 22 03:09:49 2006 @@ -113,6 +113,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -153,6 +155,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -190,6 +194,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -207,6 +213,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ @@ -251,7 +258,7 @@ # Makefile for authentication modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.32 2006/06/12 06:10:12 hno Exp $ +# $Id: Makefile.in,v 1.35 2006/09/22 09:09:49 hno Exp $ # AUTOMAKE_OPTIONS = subdir-objects EXTRA_LIBRARIES = libbasic.a libdigest.a libntlm.a libnegotiate.a diff -ruN squid-2.6.STABLE3/src/authenticate.c squid-2.6.STABLE4/src/authenticate.c --- squid-2.6.STABLE3/src/authenticate.c Sat Aug 5 09:01:26 2006 +++ squid-2.6.STABLE4/src/authenticate.c Fri Sep 22 02:48:38 2006 @@ -1,6 +1,6 @@ /* - * $Id: authenticate.c,v 1.49 2006/08/05 15:01:26 hno Exp $ + * $Id: authenticate.c,v 1.50 2006/09/22 08:48:38 hno Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -545,8 +545,10 @@ /* failed connection based authentication */ debug(29, 4) ("authenticateAuthenticate: Auth user request %p conn-auth user request %p conn type %d authentication failed.\n", *auth_user_request, conn->auth_user_request, conn->auth_type); - authenticateAuthUserRequestUnlock(*auth_user_request); - *auth_user_request = NULL; + if (*auth_user_request) { + authenticateAuthUserRequestUnlock(*auth_user_request); + *auth_user_request = NULL; + } return AUTH_ACL_CHALLENGE; } } diff -ruN squid-2.6.STABLE3/src/cache_cf.c squid-2.6.STABLE4/src/cache_cf.c --- squid-2.6.STABLE3/src/cache_cf.c Sun Aug 6 13:00:19 2006 +++ squid-2.6.STABLE4/src/cache_cf.c Fri Sep 22 04:47:04 2006 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.453 2006/08/06 19:00:19 hno Exp $ + * $Id: cache_cf.c,v 1.457 2006/09/22 10:47:04 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -231,17 +231,26 @@ { char *end; long ret = strtol(token, &end, 10); - if (ret == 0 && end == token) + if (end == token || *end) self_destruct(); return ret; } -static int +int xatoi(const char *token) { return xatol(token); } +unsigned short +xatos(const char *token) +{ + long port = xatol(token); + if (port & ~0xFFFF) + self_destruct(); + return port; +} + static double xatof(const char *token) { @@ -2611,7 +2620,7 @@ /* host:port */ host = token; *t = '\0'; - port = (unsigned short) xatoi(t + 1); + port = xatos(t + 1); if (0 == port) self_destruct(); } else if ((port = strtol(token, &tmp, 10)), !*tmp) { @@ -2678,14 +2687,13 @@ /* host:port */ host = token; *t = '\0'; - port = (unsigned short) xatoi(t + 1); - if (0 == port) - self_destruct(); - } else if ((port = xatoi(token)) > 0) { - /* port */ + port = xatos(t + 1); } else { - self_destruct(); + /* port */ + port = xatos(token); } + if (port == 0) + self_destruct(); s->s.sin_port = htons(port); if (NULL == host) s->s.sin_addr = any_addr; @@ -2718,7 +2726,7 @@ s->vport = ntohs(s->s.sin_port); s->accel = 1; } else if (strncmp(token, "vport=", 6) == 0) { - s->vport = xatoi(token + 6); + s->vport = xatos(token + 6); s->accel = 1; } else if (strcmp(token, "no-connection-auth") == 0) { s->no_connection_auth = 1; @@ -2732,6 +2740,10 @@ need_linux_tproxy = 1; #endif } else { + self_destruct(); + } + if (s->accel && s->transparent) { + debug(28, 0) ("Can't be both a transparent proxy and web server accelerator on the same port\n"); self_destruct(); } } diff -ruN squid-2.6.STABLE3/src/cache_manager.c squid-2.6.STABLE4/src/cache_manager.c --- squid-2.6.STABLE3/src/cache_manager.c Tue Jun 6 11:38:59 2006 +++ squid-2.6.STABLE4/src/cache_manager.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: cache_manager.c,v 1.29 2006/06/06 17:38:59 hno Exp $ + * $Id: cache_manager.c,v 1.30 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 16 Cache Manager Objects * AUTHOR: Duane Wessels @@ -201,9 +201,8 @@ action_table *a; debug(16, 3) ("objectcacheStart: '%s'\n", storeUrl(entry)); if ((mgr = cachemgrParseUrl(storeUrl(entry))) == NULL) { - err = errorCon(ERR_INVALID_URL, HTTP_NOT_FOUND); + err = errorCon(ERR_INVALID_URL, HTTP_NOT_FOUND, request); err->url = xstrdup(storeUrl(entry)); - err->request = requestLink(request); errorAppendEntry(entry, err); entry->expires = squid_curtime; return; @@ -220,7 +219,7 @@ /* build error message */ ErrorState *err; HttpReply *rep; - err = errorCon(ERR_CACHE_MGR_ACCESS_DENIED, HTTP_UNAUTHORIZED); + err = errorCon(ERR_CACHE_MGR_ACCESS_DENIED, HTTP_UNAUTHORIZED, request); /* warn if user specified incorrect password */ if (mgr->passwd) debug(16, 1) ("CACHEMGR: %s@%s: incorrect password for '%s'\n", @@ -230,7 +229,6 @@ debug(16, 1) ("CACHEMGR: %s@%s: password needed for '%s'\n", mgr->user_name ? mgr->user_name : "", fd_table[fd].ipaddr, mgr->action); - err->request = requestLink(request); rep = errorBuildReply(err); errorStateFree(err); /* diff -ruN squid-2.6.STABLE3/src/cf.data.pre squid-2.6.STABLE4/src/cf.data.pre --- squid-2.6.STABLE3/src/cf.data.pre Tue Aug 15 20:33:22 2006 +++ squid-2.6.STABLE4/src/cf.data.pre Fri Sep 22 00:36:51 2006 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.364 2006/08/16 02:33:22 swilton Exp $ +# $Id: cf.data.pre,v 1.371 2006/09/22 06:36:51 swilton Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -509,14 +509,12 @@ Note: The string can include URL escapes (i.e. %20 for spaces). This also means % must be written as %%. - use 'login=PASS' if users must authenticate against - the upstream proxy. This will pass the users credentials - as they are to the peer proxy. This only works for the - Basic HTTP authentication scheme. Note: To combine this - with proxy_auth both proxies must share the same user - database as HTTP only allows for one proxy login. - Also be warned this will expose your users proxy - password to the peer. USE WITH CAUTION + use 'login=PASS' to forward authentication to the peer. + Needed if the peer requires login. + Note: To combine this with local authentication the Basic + authentication scheme must be used, and both servers must + share the same user database as HTTP only allows for + a single login (one for proxy, one for origin server). use 'login=*:password' to pass the username to the upstream cache, but with a fixed password. This is meant @@ -4291,6 +4289,22 @@ option is set to GRE. DOC_END +NAME: wccp2_assignment_method +TYPE: int +LOC: Config.Wccp2.assignment_method +DEFAULT: 1 +IFDEF: USE_WCCPv2 +DOC_START + WCCP2 allows the setting of methods to assign the WCCP hash + Valid values are as follows: + + 1 - Hash assignment + 2 - Mask assignment + + As a general rule, cisco routers support the hash assignment method + and cisco switches support the mask assignment method. +DOC_END + NAME: wccp2_service TYPE: wccp2_service LOC: Config.Wccp2.info @@ -4352,6 +4366,16 @@ 'wccp2_service dynamic ' entry. DOC_END +NAME: wccp2_weight +TYPE: int +LOC: Config.Wccp2.weight +DEFAULT: 10000 +IFDEF: USE_WCCPv2 +DOC_START + Each cache server gets assigned a set of the destination + hash proportional to their weight. +DOC_END + NAME: wccp_address TYPE: address LOC: Config.Wccp.address @@ -5042,6 +5066,8 @@ processes, these sleep delays will add up and your Squid will not service requests for some amount of time until all the child processes have been started. + On Windows value less then 1000 (1 milliseconds) are + rounded to 1000. DOC_END NAME: minimum_expiry_time diff -ruN squid-2.6.STABLE3/src/client_side.c squid-2.6.STABLE4/src/client_side.c --- squid-2.6.STABLE3/src/client_side.c Tue Aug 15 18:40:20 2006 +++ squid-2.6.STABLE4/src/client_side.c Fri Sep 22 03:47:55 2006 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.673 2006/08/16 00:40:20 hno Exp $ + * $Id: client_side.c,v 1.678 2006/09/22 09:47:55 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -455,9 +455,7 @@ if (page_id == ERR_NONE) page_id = ERR_ACCESS_DENIED; } - err = errorCon(page_id, status); - err->request = requestLink(http->orig_request); - err->src_addr = http->conn->peer.sin_addr; + err = errorCon(page_id, status, http->orig_request); if (http->conn->auth_user_request) err->auth_user_request = http->conn->auth_user_request; else if (http->request->auth_user_request) @@ -517,9 +515,7 @@ if (page_id == ERR_NONE) page_id = ERR_ACCESS_DENIED; } - err = errorCon(page_id, status); - err->request = requestLink(http->orig_request); - err->src_addr = http->conn->peer.sin_addr; + err = errorCon(page_id, status, http->orig_request); if (http->conn->auth_user_request) err->auth_user_request = http->conn->auth_user_request; else if (http->request->auth_user_request) @@ -1084,9 +1080,7 @@ debug(33, 3) ("Config2.onoff.enable_purge = %d\n", Config2.onoff.enable_purge); if (!Config2.onoff.enable_purge) { http->log_type = LOG_TCP_DENIED; - err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN); - err->request = requestLink(http->orig_request); - err->src_addr = http->conn->peer.sin_addr; + err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, http->orig_request); http->entry = clientCreateStoreEntry(http, http->request->method, null_request_flags); errorAppendEntry(http->entry, err); return; @@ -1103,9 +1097,7 @@ if (entry) { if (EBIT_TEST(entry->flags, ENTRY_SPECIAL)) { http->log_type = LOG_TCP_DENIED; - err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN); - err->request = requestLink(http->request); - err->src_addr = http->conn->peer.sin_addr; + err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, http->request); http->entry = clientCreateStoreEntry(http, http->request->method, null_request_flags); errorAppendEntry(http->entry, err); return; @@ -2679,8 +2671,7 @@ } clientMaxBodySize(http->request, http, rep); if (http->log_type != LOG_TCP_DENIED && clientReplyBodyTooLarge(http, rep->content_length)) { - ErrorState *err = errorCon(ERR_TOO_BIG, HTTP_FORBIDDEN); - err->request = requestLink(http->orig_request); + ErrorState *err = errorCon(ERR_TOO_BIG, HTTP_FORBIDDEN, http->orig_request); storeClientUnregister(http->sc, http->entry, http); http->sc = NULL; storeUnlockObject(http->entry); @@ -2841,8 +2832,7 @@ page_id = aclGetDenyInfoPage(&Config.denyInfoList, AclMatchedName); if (page_id == ERR_NONE) page_id = ERR_ACCESS_DENIED; - err = errorCon(page_id, HTTP_FORBIDDEN); - err->request = requestLink(http->orig_request); + err = errorCon(page_id, HTTP_FORBIDDEN, http->orig_request); storeClientUnregister(http->sc, http->entry, http); http->sc = NULL; storeUnlockObject(http->entry); @@ -3211,9 +3201,7 @@ debug(33, 4) ("clientProcessOnlyIfCachedMiss: '%s %s'\n", RequestMethodStr[r->method], url); http->al.http.code = HTTP_GATEWAY_TIMEOUT; - err = errorCon(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT); - err->request = requestLink(http->orig_request); - err->src_addr = http->conn->peer.sin_addr; + err = errorCon(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, http->orig_request); if (http->entry) { storeClientUnregister(http->sc, http->entry, http); http->sc = NULL; @@ -3293,7 +3281,7 @@ debug(33, 3) ("clientProcessRequest2: storeGet() MISS\n"); if (r->vary) { if (r->done_etag) { - debug(33, 1) ("clientProcessRequest2: ETag loop\n"); + debug(33, 2) ("clientProcessRequest2: ETag loop\n"); } else if (r->etags) { debug(33, 2) ("clientProcessRequest2: ETag miss\n"); r->etags = NULL; @@ -3469,9 +3457,7 @@ */ if (r->flags.loopdetect && (http->flags.accel || http->flags.transparent)) { http->al.http.code = HTTP_FORBIDDEN; - err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN); - err->request = requestLink(http->orig_request); - err->src_addr = http->conn->peer.sin_addr; + err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, http->orig_request); http->log_type = LOG_TCP_DENIED; http->entry = clientCreateStoreEntry(http, r->method, null_request_flags); errorAppendEntry(http->entry, err); @@ -3667,10 +3653,14 @@ /* handle "accelerated" objects (and internal) */ if (method == METHOD_CONNECT) { - if (http_ver.major < 1) + if (http_ver.major < 1) { + debug(33, 1) ("parseHttpRequest: Invalid HTTP version\n"); goto invalid_request; - if (conn->port->accel) + } + if (conn->port->accel) { + debug(33, 1) ("parseHttpRequest: CONNECT not valid in accelerator mode\n"); goto invalid_request; + } } else if (*url == '/') accel:{ int vhost = conn->port->vhost || conn->port->transparent; @@ -3920,17 +3910,11 @@ for (H = &conn->chr; *H; H = &(*H)->next); *H = http; conn->nrequests++; - /* - * I wanted to lock 'http' here since its callback data for - * clientLifetimeTimeout(), but there's no logical place to - * cbdataUnlock if the timeout never happens. Maybe its safe - * enough to assume that if the FD is open, and the timeout - * triggers, that 'http' is valid. - */ commSetTimeout(fd, Config.Timeout.lifetime, clientLifetimeTimeout, http); if (parser_return_code < 0) { - debug(33, 1) ("clientReadRequest: FD %d Invalid Request\n", fd); - err = errorCon(ERR_INVALID_REQ, HTTP_BAD_REQUEST); + debug(33, 1) ("clientReadRequest: FD %d (%s:%d) Invalid Request\n", fd, fd_table[fd].ipaddr, fd_table[fd].remote_port); + err = errorCon(ERR_INVALID_REQ, HTTP_BAD_REQUEST, NULL); + err->src_addr = conn->peer.sin_addr; err->request_hdrs = xstrdup(conn->in.buf); http->log_type = LOG_TCP_DENIED; http->entry = clientCreateStoreEntry(http, method, null_request_flags); @@ -3940,7 +3924,7 @@ } if ((request = urlParse(method, http->uri)) == NULL) { debug(33, 5) ("Invalid URL: %s\n", http->uri); - err = errorCon(ERR_INVALID_URL, HTTP_BAD_REQUEST); + err = errorCon(ERR_INVALID_URL, HTTP_BAD_REQUEST, NULL); err->src_addr = conn->peer.sin_addr; err->url = xstrdup(http->uri); http->al.http.code = err->http_status; @@ -3955,10 +3939,8 @@ if ((http->http_ver.major >= 1) && !httpRequestParseHeader(request, prefix + req_line_sz)) { debug(33, 1) ("Failed to parse request headers: %s\n%s\n", http->uri, prefix); - err = errorCon(ERR_INVALID_URL, HTTP_BAD_REQUEST); - err->src_addr = conn->peer.sin_addr; + err = errorCon(ERR_INVALID_URL, HTTP_BAD_REQUEST, request); err->url = xstrdup(http->uri); - err->request = requestLink(request); http->al.http.code = err->http_status; http->log_type = LOG_TCP_DENIED; http->entry = clientCreateStoreEntry(http, method, null_request_flags); @@ -4005,9 +3987,7 @@ request->http_ver = http->http_ver; if (!urlCheckRequest(request) || httpHeaderHas(&request->header, HDR_TRANSFER_ENCODING)) { - err = errorCon(ERR_UNSUP_REQ, HTTP_NOT_IMPLEMENTED); - err->src_addr = conn->peer.sin_addr; - err->request = requestLink(request); + err = errorCon(ERR_UNSUP_REQ, HTTP_NOT_IMPLEMENTED, request); request->flags.proxy_keepalive = 0; http->al.http.code = err->http_status; http->log_type = LOG_TCP_DENIED; @@ -4016,9 +3996,7 @@ break; } if (!clientCheckContentLength(request)) { - err = errorCon(ERR_INVALID_REQ, HTTP_LENGTH_REQUIRED); - err->src_addr = conn->peer.sin_addr; - err->request = requestLink(request); + err = errorCon(ERR_INVALID_REQ, HTTP_LENGTH_REQUIRED, request); http->al.http.code = err->http_status; http->log_type = LOG_TCP_DENIED; http->entry = clientCreateStoreEntry(http, request->method, null_request_flags); @@ -4036,8 +4014,7 @@ cbdataLock(conn); /* Is it too large? */ if (clientRequestBodyTooLarge(request->content_length)) { - err = errorCon(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE); - err->request = requestLink(request); + err = errorCon(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE, request); http->log_type = LOG_TCP_DENIED; http->entry = clientCreateStoreEntry(http, METHOD_NONE, null_request_flags); @@ -4070,7 +4047,8 @@ (int) conn->in.offset); debug(33, 1) ("Config 'request_header_max_size'= %ld bytes.\n", (long int) Config.maxRequestHeaderSize); - err = errorCon(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE); + err = errorCon(ERR_TOO_BIG, HTTP_REQUEST_ENTITY_TOO_LARGE, NULL); + err->src_addr = conn->peer.sin_addr; http = parseHttpRequestAbort(conn, "error:request-too-large"); /* add to the client request queue */ for (H = &conn->chr; *H; H = &(*H)->next); @@ -4282,7 +4260,8 @@ /* * Generate an error */ - err = errorCon(ERR_LIFETIME_EXP, HTTP_REQUEST_TIMEOUT); + err = errorCon(ERR_LIFETIME_EXP, HTTP_REQUEST_TIMEOUT, NULL); + err->src_addr = conn->peer.sin_addr; err->url = xstrdup("N/A"); /* * Normally we shouldn't call errorSend() in client_side.c, but diff -ruN squid-2.6.STABLE3/src/comm.c squid-2.6.STABLE4/src/comm.c --- squid-2.6.STABLE3/src/comm.c Sat Aug 12 17:27:20 2006 +++ squid-2.6.STABLE4/src/comm.c Sat Sep 9 06:45:06 2006 @@ -1,6 +1,6 @@ /* - * $Id: comm.c,v 1.355 2006/08/12 23:27:20 hno Exp $ + * $Id: comm.c,v 1.357 2006/09/09 12:45:06 serassio Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -33,6 +33,11 @@ * */ +/* On native Windows, squid_mswin.h needs to know when we are compiling + * comm.c for the correct handling of FD<=>socket magic + */ +#define COMM_C + #include "squid.h" #if defined(_SQUID_CYGWIN_) @@ -940,24 +945,28 @@ int commSetNonBlocking(int fd) { -#ifndef _SQUID_MSWIN_ +#ifdef _SQUID_MSWIN_ + unsigned long nonblocking = TRUE; + + if (ioctlsocket(fd, FIONBIO, &nonblocking) < 0) { + debug(5, 0) ("commSetNonBlocking: FD %d: %s %u\n", fd, xstrerror(), fd_table[fd].type); + return COMM_ERROR; + } +#else /* _SQUID_MSWIN_ */ + int flags; int dummy = 0; -#endif -#ifdef _SQUID_WIN32_ - int nonblocking = TRUE; + #ifdef _SQUID_CYGWIN_ + int nonblocking = TRUE; + if (fd_table[fd].type != FD_PIPE) { -#endif if (ioctl(fd, FIONBIO, &nonblocking) < 0) { debug(5, 0) ("commSetNonBlocking: FD %d: %s %u\n", fd, xstrerror(), fd_table[fd].type); return COMM_ERROR; } -#ifdef _SQUID_CYGWIN_ } else { #endif -#endif -#ifndef _SQUID_MSWIN_ if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) { debug(5, 0) ("FD %d: fcntl F_GETFL: %s\n", fd, xstrerror()); return COMM_ERROR; @@ -966,10 +975,10 @@ debug(5, 0) ("commSetNonBlocking: FD %d: %s\n", fd, xstrerror()); return COMM_ERROR; } -#endif #ifdef _SQUID_CYGWIN_ } #endif +#endif /* _SQUID_MSWIN_ */ fd_table[fd].flags.nonblocking = 1; return 0; } @@ -978,8 +987,8 @@ commUnsetNonBlocking(int fd) { #ifdef _SQUID_MSWIN_ - int nonblocking = FALSE; - if (ioctlsocket(fd, FIONBIO, (unsigned long *) &nonblocking) < 0) { + unsigned long nonblocking = FALSE; + if (ioctlsocket(fd, FIONBIO, &nonblocking) < 0) { #else int flags; int dummy = 0; diff -ruN squid-2.6.STABLE3/src/debug.c squid-2.6.STABLE4/src/debug.c --- squid-2.6.STABLE3/src/debug.c Tue Jul 4 15:45:24 2006 +++ squid-2.6.STABLE4/src/debug.c Sat Sep 9 06:45:06 2006 @@ -1,6 +1,6 @@ /* - * $Id: debug.c,v 1.90 2006/07/04 21:45:24 hno Exp $ + * $Id: debug.c,v 1.93 2006/09/09 12:45:06 serassio Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -48,6 +48,10 @@ static void _db_print_stderr(const char *format, va_list args); static void _db_print_file(const char *format, va_list args); +#ifdef _SQUID_MSWIN_ +extern LPCRITICAL_SECTION dbg_mutex; +#endif + #ifdef _SQUID_LINUX_ /* Workaround for crappy glic header files */ extern int backtrace(void *, int); @@ -74,6 +78,33 @@ #define args2 args1 #define args3 args1 #endif +#ifdef _SQUID_MSWIN_ + /* Multiple WIN32 threads may call this simultaneously */ + if (!dbg_mutex) { + HMODULE krnl_lib = GetModuleHandle("Kernel32"); + BOOL(FAR WINAPI * InitializeCriticalSectionAndSpinCount) + (LPCRITICAL_SECTION, DWORD) = NULL; + if (krnl_lib) + InitializeCriticalSectionAndSpinCount = + GetProcAddress(krnl_lib, + "InitializeCriticalSectionAndSpinCount"); + dbg_mutex = xcalloc(1, sizeof(CRITICAL_SECTION)); + + if (InitializeCriticalSectionAndSpinCount) { + /* let multiprocessor systems EnterCriticalSection() fast */ + if (!InitializeCriticalSectionAndSpinCount(dbg_mutex, 4000)) { + if (debug_log) { + fprintf(debug_log, "FATAL: _db_print: can't initialize critical section\n"); + fflush(debug_log); + } + fprintf(stderr, "FATAL: _db_print: can't initialize critical section\n"); + abort(); + } else + InitializeCriticalSection(dbg_mutex); + } + } + EnterCriticalSection(dbg_mutex); +#endif /* give a chance to context-based debugging to print current context */ if (!Ctx_Lock) ctx_print(); @@ -92,6 +123,9 @@ #if HAVE_SYSLOG _db_print_syslog(format, args3); #endif +#ifdef _SQUID_MSWIN_ + LeaveCriticalSection(dbg_mutex); +#endif va_end(args1); #if STDC_HEADERS va_end(args2); @@ -99,6 +133,21 @@ #endif } +static int debug_log_dirty = 0; +int +debug_log_flush(void) +{ + static time_t last_flush = 0; + if (!debug_log_dirty) + return 0; + if (last_flush != squid_curtime) { + fflush(debug_log); + last_flush = squid_curtime; + debug_log_dirty = 0; + } + return debug_log_dirty; +} + static void _db_print_file(const char *format, va_list args) { @@ -110,6 +159,8 @@ vfprintf(debug_log, format, args); if (!Config.onoff.buffered_logs) fflush(debug_log); + else + debug_log_dirty++; } static void diff -ruN squid-2.6.STABLE3/src/defines.h squid-2.6.STABLE4/src/defines.h --- squid-2.6.STABLE3/src/defines.h Wed Aug 2 20:31:11 2006 +++ squid-2.6.STABLE4/src/defines.h Sat Aug 19 06:40:31 2006 @@ -1,6 +1,6 @@ /* - * $Id: defines.h,v 1.120 2006/08/03 02:31:11 adrian Exp $ + * $Id: defines.h,v 1.121 2006/08/19 12:40:31 serassio Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -298,7 +298,11 @@ #define URI_WHITESPACE_DENY 4 #ifndef _PATH_DEVNULL +#ifdef _SQUID_MSWIN_ +#define _PATH_DEVNULL "NUL" +#else #define _PATH_DEVNULL "/dev/null" +#endif #endif /* cbdata macros */ diff -ruN squid-2.6.STABLE3/src/dns_internal.c squid-2.6.STABLE4/src/dns_internal.c --- squid-2.6.STABLE3/src/dns_internal.c Tue Aug 15 18:27:20 2006 +++ squid-2.6.STABLE4/src/dns_internal.c Mon Sep 18 17:11:13 2006 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.59 2006/08/16 00:27:20 hno Exp $ + * $Id: dns_internal.c,v 1.60 2006/09/18 23:11:13 hno Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -1089,8 +1089,6 @@ { idns_query *q; const char *ip = inet_ntoa(addr); - if (idnsCachedLookup(ip, callback, data)) - return; q = cbdataAlloc(idns_query); q->tcp_socket = -1; q->id = idnsQueryID(); @@ -1100,6 +1098,10 @@ if (q->sz < 0) { /* problem with query data -- query not sent */ callback(data, NULL, 0, "Internal error"); + cbdataFree(q); + return; + } + if (idnsCachedLookup(q->query.name, callback, data)) { cbdataFree(q); return; } diff -ruN squid-2.6.STABLE3/src/errorpage.c squid-2.6.STABLE4/src/errorpage.c --- squid-2.6.STABLE3/src/errorpage.c Tue Jul 4 15:45:24 2006 +++ squid-2.6.STABLE4/src/errorpage.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.c,v 1.186 2006/07/04 21:45:24 hno Exp $ + * $Id: errorpage.c,v 1.188 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -261,13 +261,17 @@ * Abstract: This function creates a ErrorState object. */ ErrorState * -errorCon(err_type type, http_status status) +errorCon(err_type type, http_status status, request_t * request) { ErrorState *err; err = cbdataAlloc(ErrorState); err->page_id = type; /* has to be reset manually if needed */ err->type = type; err->http_status = status; + if (request != NULL) { + err->request = requestLink(request); + err->src_addr = request->client_addr; + } return err; } @@ -452,7 +456,7 @@ memBufReset(&mb); switch (token) { case 'a': - if (r->auth_user_request) + if (r && r->auth_user_request) p = authenticateUserRequestUsername(r->auth_user_request); if (!p) p = "-"; diff -ruN squid-2.6.STABLE3/src/fd.c squid-2.6.STABLE4/src/fd.c --- squid-2.6.STABLE3/src/fd.c Sun Jun 11 11:06:25 2006 +++ squid-2.6.STABLE4/src/fd.c Sat Sep 9 06:45:06 2006 @@ -1,6 +1,6 @@ /* - * $Id: fd.c,v 1.52 2006/06/11 17:06:25 serassio Exp $ + * $Id: fd.c,v 1.53 2006/09/09 12:45:06 serassio Exp $ * * DEBUG: section 51 Filedescriptor Functions * AUTHOR: Duane Wessels @@ -117,6 +117,7 @@ return (send(fd, buf, len, 0)); } +int file_write_method(int fd, const char *buf, int len) { return (_write(fd, buf, len)); diff -ruN squid-2.6.STABLE3/src/forward.c squid-2.6.STABLE4/src/forward.c --- squid-2.6.STABLE3/src/forward.c Fri Jun 30 15:23:05 2006 +++ squid-2.6.STABLE4/src/forward.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.115 2006/06/30 21:23:05 hno Exp $ + * $Id: forward.c,v 1.116 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -217,10 +217,8 @@ eventAdd("fwdConnectStart", fwdConnectStart, fwdState, originserver ? 0.05 : 0.005, 0); return; } - if (!fwdState->err && shutting_down) { - fwdState->err = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE); - fwdState->err->request = requestLink(fwdState->request); - } + if (!fwdState->err && shutting_down) + fwdState->err = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE, fwdState->request); fwdStateFree(fwdState); } @@ -248,13 +246,12 @@ return; default: debug(81, 1) ("fwdNegotiateSSL: Error negotiating SSL connection on FD %d: %s (%d/%d/%d)\n", fd, ERR_error_string(ERR_get_error(), NULL), ssl_error, ret, errno); - err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE, request); #ifdef EPROTO err->xerrno = EPROTO; #else err->xerrno = EACCES; #endif - err->request = requestLink(request); fwdFail(fwdState, err); if (fs->peer) { peerConnectFailed(fs->peer); @@ -308,9 +305,8 @@ ErrorState *err; debug(83, 1) ("fwdInitiateSSL: Error allocating handle: %s\n", ERR_error_string(ERR_get_error(), NULL)); - err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR); + err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR, fwdState->request); err->xerrno = errno; - err->request = requestLink(fwdState->request); fwdFail(fwdState, err); fwdStateFree(fwdState); return; @@ -347,13 +343,13 @@ fwdState->flags.dont_retry = 1; debug(17, 4) ("fwdConnectDone: Unknown host: %s\n", request->host); - err = errorCon(ERR_DNS_FAIL, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_DNS_FAIL, HTTP_SERVICE_UNAVAILABLE, fwdState->request); err->dnsserver_msg = xstrdup(dns_error_message); fwdFail(fwdState, err); comm_close(server_fd); } else if (status != COMM_OK) { assert(fs); - err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE, fwdState->request); err->xerrno = errno; fwdFail(fwdState, err); if (fs->peer) @@ -388,7 +384,7 @@ if (Config.onoff.log_ip_on_direct && fs->code == HIER_DIRECT && fd_table[fd].ipaddr[0]) hierarchyNote(&fwdState->request->hier, fs->code, fd_table[fd].ipaddr); if (entry->mem_obj->inmem_hi == 0) { - err = errorCon(ERR_CONNECT_FAIL, HTTP_GATEWAY_TIMEOUT); + err = errorCon(ERR_CONNECT_FAIL, HTTP_GATEWAY_TIMEOUT, fwdState->request); err->xerrno = ETIMEDOUT; fwdFail(fwdState, err); /* @@ -566,7 +562,7 @@ url); if (fd < 0) { debug(50, 4) ("fwdConnectStart: %s\n", xstrerror()); - err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR); + err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR, fwdState->request); err->xerrno = errno; fwdFail(fwdState, err); fwdStateFree(fwdState); @@ -643,7 +639,7 @@ { ErrorState *err; debug(17, 3) ("fwdStartFail: %s\n", storeUrl(fwdState->entry)); - err = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE, fwdState->request); err->xerrno = errno; fwdFail(fwdState, err); fwdStateFree(fwdState); @@ -710,7 +706,7 @@ default: debug(17, 1) ("fwdDispatch: Cannot retrieve '%s'\n", storeUrl(entry)); - err = errorCon(ERR_UNSUP_REQ, HTTP_BAD_REQUEST); + err = errorCon(ERR_UNSUP_REQ, HTTP_BAD_REQUEST, fwdState->request); fwdFail(fwdState, err); /* * Force a persistent connection to be closed because @@ -825,9 +821,7 @@ page_id = aclGetDenyInfoPage(&Config.denyInfoList, AclMatchedName); if (page_id == ERR_NONE) page_id = ERR_FORWARDING_DENIED; - err = errorCon(page_id, HTTP_FORBIDDEN); - err->request = requestLink(r); - err->src_addr = r->client_addr; + err = errorCon(page_id, HTTP_FORBIDDEN, r); errorAppendEntry(e, err); return; } @@ -839,8 +833,7 @@ #endif if (shutting_down) { /* more yuck */ - err = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE); - err->request = requestLink(r); + err = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE, r); errorAppendEntry(e, err); return; } diff -ruN squid-2.6.STABLE3/src/fs/Makefile.am squid-2.6.STABLE4/src/fs/Makefile.am --- squid-2.6.STABLE3/src/fs/Makefile.am Mon Jun 12 00:04:08 2006 +++ squid-2.6.STABLE4/src/fs/Makefile.am Sat Sep 9 10:04:38 2006 @@ -1,14 +1,22 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.am,v 1.8 2006/06/12 06:04:08 hno Exp $ +# $Id: Makefile.am,v 1.9 2006/09/09 16:04:38 serassio Exp $ # AUTOMAKE_OPTIONS = subdir-objects +if USE_AIOPS_WIN32 +AIOPS_SOURCE = aufs/aiops_win32.c +else +AIOPS_SOURCE = aufs/aiops.c +endif + EXTRA_LIBRARIES = libaufs.a libcoss.a libdiskd.a libnull.a libufs.a noinst_LIBRARIES = @STORE_LIBS@ -libaufs_a_SOURCES = aufs/aiops.c aufs/async_io.c aufs/store_asyncufs.h \ +EXTRA_libaufs_a_SOURCES = aufs/aiops.c aufs/aiops_win32.c + +libaufs_a_SOURCES = $(AIOPS_SOURCE) aufs/async_io.c aufs/store_asyncufs.h \ aufs/store_dir_aufs.c aufs/store_io_aufs.c aufs/async_io.h libcoss_a_SOURCES = coss/store_coss.h coss/store_io_coss.c coss/store_dir_coss.c \ coss/async_io.c coss/async_io.h diff -ruN squid-2.6.STABLE3/src/fs/Makefile.in squid-2.6.STABLE4/src/fs/Makefile.in --- squid-2.6.STABLE3/src/fs/Makefile.in Mon Jun 12 00:10:12 2006 +++ squid-2.6.STABLE4/src/fs/Makefile.in Fri Sep 22 03:09:50 2006 @@ -16,7 +16,7 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.35 2006/06/12 06:10:12 hno Exp $ +# $Id: Makefile.in,v 1.38 2006/09/22 09:09:50 hno Exp $ # @@ -57,8 +57,13 @@ ARFLAGS = cru libaufs_a_AR = $(AR) $(ARFLAGS) libaufs_a_LIBADD = +am__libaufs_a_SOURCES_DIST = aufs/aiops.c aufs/aiops_win32.c \ + aufs/async_io.c aufs/store_asyncufs.h aufs/store_dir_aufs.c \ + aufs/store_io_aufs.c aufs/async_io.h am__dirstamp = $(am__leading_dot)dirstamp -am_libaufs_a_OBJECTS = aufs/aiops.$(OBJEXT) aufs/async_io.$(OBJEXT) \ +@USE_AIOPS_WIN32_FALSE@am__objects_1 = aufs/aiops.$(OBJEXT) +@USE_AIOPS_WIN32_TRUE@am__objects_1 = aufs/aiops_win32.$(OBJEXT) +am_libaufs_a_OBJECTS = $(am__objects_1) aufs/async_io.$(OBJEXT) \ aufs/store_dir_aufs.$(OBJEXT) aufs/store_io_aufs.$(OBJEXT) libaufs_a_OBJECTS = $(am_libaufs_a_OBJECTS) libcoss_a_AR = $(AR) $(ARFLAGS) @@ -95,10 +100,12 @@ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libaufs_a_SOURCES) $(libcoss_a_SOURCES) \ - $(libdiskd_a_SOURCES) $(libnull_a_SOURCES) $(libufs_a_SOURCES) \ +SOURCES = $(libaufs_a_SOURCES) $(EXTRA_libaufs_a_SOURCES) \ + $(libcoss_a_SOURCES) $(libdiskd_a_SOURCES) \ + $(libnull_a_SOURCES) $(libufs_a_SOURCES) \ $(diskd_daemon_SOURCES) -DIST_SOURCES = $(libaufs_a_SOURCES) $(libcoss_a_SOURCES) \ +DIST_SOURCES = $(am__libaufs_a_SOURCES_DIST) \ + $(EXTRA_libaufs_a_SOURCES) $(libcoss_a_SOURCES) \ $(libdiskd_a_SOURCES) $(libnull_a_SOURCES) $(libufs_a_SOURCES) \ $(diskd_daemon_SOURCES) ETAGS = etags @@ -138,6 +145,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -178,6 +187,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -215,6 +226,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -232,6 +245,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ @@ -274,9 +288,12 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AUTOMAKE_OPTIONS = subdir-objects +@USE_AIOPS_WIN32_FALSE@AIOPS_SOURCE = aufs/aiops.c +@USE_AIOPS_WIN32_TRUE@AIOPS_SOURCE = aufs/aiops_win32.c EXTRA_LIBRARIES = libaufs.a libcoss.a libdiskd.a libnull.a libufs.a noinst_LIBRARIES = @STORE_LIBS@ -libaufs_a_SOURCES = aufs/aiops.c aufs/async_io.c aufs/store_asyncufs.h \ +EXTRA_libaufs_a_SOURCES = aufs/aiops.c aufs/aiops_win32.c +libaufs_a_SOURCES = $(AIOPS_SOURCE) aufs/async_io.c aufs/store_asyncufs.h \ aufs/store_dir_aufs.c aufs/store_io_aufs.c aufs/async_io.h libcoss_a_SOURCES = coss/store_coss.h coss/store_io_coss.c coss/store_dir_coss.c \ @@ -341,6 +358,8 @@ @: > aufs/$(DEPDIR)/$(am__dirstamp) aufs/aiops.$(OBJEXT): aufs/$(am__dirstamp) \ aufs/$(DEPDIR)/$(am__dirstamp) +aufs/aiops_win32.$(OBJEXT): aufs/$(am__dirstamp) \ + aufs/$(DEPDIR)/$(am__dirstamp) aufs/async_io.$(OBJEXT): aufs/$(am__dirstamp) \ aufs/$(DEPDIR)/$(am__dirstamp) aufs/store_dir_aufs.$(OBJEXT): aufs/$(am__dirstamp) \ @@ -439,6 +458,7 @@ mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f aufs/aiops.$(OBJEXT) + -rm -f aufs/aiops_win32.$(OBJEXT) -rm -f aufs/async_io.$(OBJEXT) -rm -f aufs/store_dir_aufs.$(OBJEXT) -rm -f aufs/store_io_aufs.$(OBJEXT) @@ -456,6 +476,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@aufs/$(DEPDIR)/aiops.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@aufs/$(DEPDIR)/aiops_win32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@aufs/$(DEPDIR)/async_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@aufs/$(DEPDIR)/store_dir_aufs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@aufs/$(DEPDIR)/store_io_aufs.Po@am__quote@ diff -ruN squid-2.6.STABLE3/src/fs/aufs/aiops.c squid-2.6.STABLE4/src/fs/aufs/aiops.c --- squid-2.6.STABLE3/src/fs/aufs/aiops.c Sat Jul 29 11:37:18 2006 +++ squid-2.6.STABLE4/src/fs/aufs/aiops.c Sat Sep 23 04:16:40 2006 @@ -1,5 +1,5 @@ /* - * $Id: aiops.c,v 1.29 2006/07/29 17:37:18 hno Exp $ + * $Id: aiops.c,v 1.31 2006/09/23 10:16:40 serassio Exp $ * * DEBUG: section 43 AIOPS * AUTHOR: Stewart Forster @@ -129,7 +129,9 @@ static void squidaio_do_close(squidaio_request_t *); static void squidaio_do_stat(squidaio_request_t *); static void squidaio_do_unlink(squidaio_request_t *); +#if USE_TRUNCATE static void squidaio_do_truncate(squidaio_request_t *); +#endif #if AIO_OPENDIR static void *squidaio_do_opendir(squidaio_request_t *); #endif @@ -327,7 +329,7 @@ if (j < 4) j = 4; } -#if COSS_USE_AUFSOPS +#if USE_AUFSOPS j = 6; for (i = 0; i < n_coss_dirs; i++) { squidaio_nthreads += j; @@ -448,9 +450,11 @@ case _AIO_OP_UNLINK: squidaio_do_unlink(request); break; +#if USE_TRUNCATE case _AIO_OP_TRUNCATE: squidaio_do_truncate(request); break; +#endif #if AIO_OPENDIR /* Opendir not implemented yet */ case _AIO_OP_OPENDIR: squidaio_do_opendir(request); @@ -801,6 +805,8 @@ requestp->err = errno; } + +#if USE_TRUNCATE int squidaio_truncate(const char *path, off_t length, squidaio_result_t * resultp) { @@ -824,6 +830,8 @@ requestp->ret = truncate(requestp->path, requestp->offset); requestp->err = errno; } + +#endif #if AIO_OPENDIR diff -ruN squid-2.6.STABLE3/src/fs/aufs/aiops_win32.c squid-2.6.STABLE4/src/fs/aufs/aiops_win32.c --- squid-2.6.STABLE3/src/fs/aufs/aiops_win32.c Wed Dec 31 17:00:00 1969 +++ squid-2.6.STABLE4/src/fs/aufs/aiops_win32.c Sat Sep 23 04:16:40 2006 @@ -0,0 +1,1072 @@ +/* + * $Id: aiops_win32.c,v 1.3 2006/09/23 10:16:40 serassio Exp $ + * + * DEBUG: section 43 Windows AIOPS + * AUTHOR: Stewart Forster + * AUTHOR: Robert Collins + * AUTHOR: Guido Serassio + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#include "squid.h" +#include +#include "async_io.h" + +#include +#include +#include +#include +#include +#include +#include + +#define RIDICULOUS_LENGTH 4096 + +#ifdef AUFS_IO_THREADS +int squidaio_nthreads = AUFS_IO_THREADS; +#else +int squidaio_nthreads = 0; +#endif +int squidaio_magic1 = 1; /* dummy initializer value */ +int squidaio_magic2 = 1; /* real value set in aiops.c */ + +enum _squidaio_thread_status { + _THREAD_STARTING = 0, + _THREAD_WAITING, + _THREAD_BUSY, + _THREAD_FAILED, + _THREAD_DONE +}; +typedef enum _squidaio_thread_status squidaio_thread_status; + +enum _squidaio_request_type { + _AIO_OP_NONE = 0, + _AIO_OP_OPEN, + _AIO_OP_READ, + _AIO_OP_WRITE, + _AIO_OP_CLOSE, + _AIO_OP_UNLINK, + _AIO_OP_TRUNCATE, + _AIO_OP_OPENDIR, + _AIO_OP_STAT +}; +typedef enum _squidaio_request_type squidaio_request_type; + +typedef struct squidaio_request_t { + struct squidaio_request_t *next; + squidaio_request_type request_type; + int cancelled; + char *path; + int oflag; + mode_t mode; + int fd; + char *bufferp; + int buflen; + off_t offset; + int whence; + int ret; + int err; + struct stat *tmpstatp; + struct stat *statp; + squidaio_result_t *resultp; +} squidaio_request_t; + +typedef struct squidaio_request_queue_t { + HANDLE mutex; + HANDLE cond; /* See Event objects */ + squidaio_request_t *volatile head; + squidaio_request_t *volatile *volatile tailp; + unsigned long requests; + unsigned long blocked; /* main failed to lock the queue */ +} squidaio_request_queue_t; + +typedef struct squidaio_thread_t squidaio_thread_t; +struct squidaio_thread_t { + squidaio_thread_t *next; + HANDLE thread; + DWORD dwThreadId; /* thread ID */ + squidaio_thread_status status; + struct squidaio_request_t *current_req; + unsigned long requests; + int volatile exit; +}; + +static void squidaio_queue_request(squidaio_request_t *); +static void squidaio_cleanup_request(squidaio_request_t *); +static DWORD WINAPI squidaio_thread_loop(LPVOID lpParam); +static void squidaio_do_open(squidaio_request_t *); +static void squidaio_do_read(squidaio_request_t *); +static void squidaio_do_write(squidaio_request_t *); +static void squidaio_do_close(squidaio_request_t *); +static void squidaio_do_stat(squidaio_request_t *); +static void squidaio_do_unlink(squidaio_request_t *); +#if USE_TRUNCATE +static void squidaio_do_truncate(squidaio_request_t *); +#endif +#if AIO_OPENDIR +static void *squidaio_do_opendir(squidaio_request_t *); +#endif +static void squidaio_debug(squidaio_request_t *); +static void squidaio_poll_queues(void); + +static squidaio_thread_t *threads = NULL; +static int squidaio_initialised = 0; + +#define AIO_LARGE_BUFS 16384 +#define AIO_MEDIUM_BUFS AIO_LARGE_BUFS >> 1 +#define AIO_SMALL_BUFS AIO_LARGE_BUFS >> 2 +#define AIO_TINY_BUFS AIO_LARGE_BUFS >> 3 +#define AIO_MICRO_BUFS 128 + +static MemPool *squidaio_large_bufs = NULL; /* 16K */ +static MemPool *squidaio_medium_bufs = NULL; /* 8K */ +static MemPool *squidaio_small_bufs = NULL; /* 4K */ +static MemPool *squidaio_tiny_bufs = NULL; /* 2K */ +static MemPool *squidaio_micro_bufs = NULL; /* 128K */ + +static int request_queue_len = 0; +static MemPool *squidaio_request_pool = NULL; +static MemPool *squidaio_thread_pool = NULL; +static squidaio_request_queue_t request_queue; +static struct { + squidaio_request_t *head, **tailp; +} request_queue2 = { + + NULL, &request_queue2.head +}; +static squidaio_request_queue_t done_queue; +static struct { + squidaio_request_t *head, **tailp; +} done_requests = { + + NULL, &done_requests.head +}; +static int done_fd = 0; +static int done_fd_read = 0; +static int done_signalled = 0; +static HANDLE main_thread; + +static MemPool * +squidaio_get_pool(int size) +{ + MemPool *p; + if (size <= AIO_LARGE_BUFS) { + if (size <= AIO_MICRO_BUFS) + p = squidaio_micro_bufs; + else if (size <= AIO_TINY_BUFS) + p = squidaio_tiny_bufs; + else if (size <= AIO_SMALL_BUFS) + p = squidaio_small_bufs; + else if (size <= AIO_MEDIUM_BUFS) + p = squidaio_medium_bufs; + else + p = squidaio_large_bufs; + } else + p = NULL; + return p; +} + +void * +squidaio_xmalloc(int size) +{ + void *p; + MemPool *pool; + + if ((pool = squidaio_get_pool(size)) != NULL) { + p = memPoolAlloc(pool); + } else + p = xmalloc(size); + + return p; +} + +static char * +squidaio_xstrdup(const char *str) +{ + char *p; + int len = strlen(str) + 1; + + p = squidaio_xmalloc(len); + strncpy(p, str, len); + + return p; +} + +void +squidaio_xfree(void *p, int size) +{ + MemPool *pool; + + if ((pool = squidaio_get_pool(size)) != NULL) { + memPoolFree(pool, p); + } else + xfree(p); +} + +static void +squidaio_xstrfree(char *str) +{ + MemPool *pool; + int len = strlen(str) + 1; + + if ((pool = squidaio_get_pool(len)) != NULL) { + memPoolFree(pool, str); + } else + xfree(str); +} + +static void +squidaio_fdhandler(int fd, void *data) +{ + char junk[256]; + FD_READ_METHOD(done_fd_read, junk, sizeof(junk)); + commSetSelect(fd, COMM_SELECT_READ, squidaio_fdhandler, NULL, 0); +} + +void +squidaio_init(void) +{ + int i; + int done_pipe[2]; + squidaio_thread_t *threadp; + + if (squidaio_initialised) + return; + + if (!DuplicateHandle(GetCurrentProcess(), /* pseudo handle, don't close */ + GetCurrentThread(), /* pseudo handle to copy */ + GetCurrentProcess(), /* pseudo handle, don't close */ + &main_thread, + 0, /* required access */ + FALSE, /* child process's don't inherit the handle */ + DUPLICATE_SAME_ACCESS)) { + /* spit errors */ + fatal("couldn't get current thread handle\n"); + } + /* Initialize request queue */ + if ((request_queue.mutex = CreateMutex(NULL, /* no inheritance */ + FALSE, /* start unowned (as per mutex_init) */ + NULL) /* no name */ + ) == NULL) { + fatal("failed to create mutex\n"); + } + if ((request_queue.cond = CreateEvent(NULL, /* no inheritance */ + FALSE, /* auto signal reset - which I think is pthreads like ? */ + FALSE, /* start non signaled */ + NULL) /* no name */ + ) == NULL) { + fatal("failed to create condition event variable.\n"); + } + request_queue.head = NULL; + request_queue.tailp = &request_queue.head; + request_queue.requests = 0; + request_queue.blocked = 0; + + /* Initialize done queue */ + if ((done_queue.mutex = CreateMutex(NULL, /* no inheritance */ + FALSE, /* start unowned (as per mutex_init) */ + NULL) /* no name */ + ) == NULL) { + fatal("failed to create mutex\n"); + } + if ((done_queue.cond = CreateEvent(NULL, /* no inheritance */ + TRUE, /* manually signaled - which I think is pthreads like ? */ + FALSE, /* start non signaled */ + NULL) /* no name */ + ) == NULL) { + fatal("failed to create condition event variable.\n"); + } + done_queue.head = NULL; + done_queue.tailp = &done_queue.head; + done_queue.requests = 0; + done_queue.blocked = 0; + + /* Initialize done pipe signal */ + pipe(done_pipe); + done_fd = done_pipe[1]; + done_fd_read = done_pipe[0]; + fd_open(done_fd_read, FD_PIPE, "async-io completion event: main"); + fd_open(done_fd, FD_PIPE, "async-io completion event: threads"); + commSetNonBlocking(done_pipe[0]); + commSetNonBlocking(done_pipe[1]); + commSetCloseOnExec(done_pipe[0]); + commSetCloseOnExec(done_pipe[1]); + commSetSelect(done_pipe[0], COMM_SELECT_READ, squidaio_fdhandler, NULL, 0); + + /* Create threads and get them to sit in their wait loop */ + squidaio_thread_pool = memPoolCreate("aio_thread", sizeof(squidaio_thread_t)); + if (squidaio_nthreads == 0) { + int j = 16; + for (i = 0; i < n_asyncufs_dirs; i++) { + squidaio_nthreads += j; + j = j * 2 / 3; + if (j < 4) + j = 4; + } +#if USE_AUFSOPS + j = 6; + for (i = 0; i < n_coss_dirs; i++) { + squidaio_nthreads += j; + j = 3; + } +#endif + } + if (squidaio_nthreads == 0) + squidaio_nthreads = 16; + squidaio_magic1 = squidaio_nthreads * MAGIC1_FACTOR; + squidaio_magic2 = squidaio_nthreads * MAGIC2_FACTOR; + for (i = 0; i < squidaio_nthreads; i++) { + threadp = memPoolAlloc(squidaio_thread_pool); + threadp->status = _THREAD_STARTING; + threadp->current_req = NULL; + threadp->requests = 0; + threadp->next = threads; + threads = threadp; + if ((threadp->thread = CreateThread(NULL, /* no security attributes */ + 0, /* use default stack size */ + squidaio_thread_loop, /* thread function */ + threadp, /* argument to thread function */ + 0, /* use default creation flags */ + &(threadp->dwThreadId)) /* returns the thread identifier */ + ) == NULL) { + fprintf(stderr, "Thread creation failed\n"); + threadp->status = _THREAD_FAILED; + continue; + } + /* Set the new thread priority above parent process */ + SetThreadPriority(threadp->thread, THREAD_PRIORITY_ABOVE_NORMAL); + } + + /* Create request pool */ + squidaio_request_pool = memPoolCreate("aio_request", sizeof(squidaio_request_t)); + squidaio_large_bufs = memPoolCreate("squidaio_large_bufs", AIO_LARGE_BUFS); + squidaio_medium_bufs = memPoolCreate("squidaio_medium_bufs", AIO_MEDIUM_BUFS); + squidaio_small_bufs = memPoolCreate("squidaio_small_bufs", AIO_SMALL_BUFS); + squidaio_tiny_bufs = memPoolCreate("squidaio_tiny_bufs", AIO_TINY_BUFS); + squidaio_micro_bufs = memPoolCreate("squidaio_micro_bufs", AIO_MICRO_BUFS); + + squidaio_initialised = 1; +} + +void +squidaio_shutdown(void) +{ + squidaio_thread_t *threadp; + int i; + HANDLE *hthreads; + + if (!squidaio_initialised) + return; + + /* This is the same as in squidaio_sync */ + do { + squidaio_poll_queues(); + } while (request_queue_len > 0); + + hthreads = (HANDLE *) xcalloc(squidaio_nthreads, sizeof(HANDLE)); + threadp = threads; + for (i = 0; i < squidaio_nthreads; i++) { + threadp->exit = 1; + hthreads[i] = threadp->thread; + threadp = threadp->next; + } + ReleaseMutex(request_queue.mutex); + ResetEvent(request_queue.cond); + ReleaseMutex(done_queue.mutex); + ResetEvent(done_queue.cond); + Sleep(0); + + WaitForMultipleObjects(squidaio_nthreads, hthreads, TRUE, 2000); + for (i = 0; i < squidaio_nthreads; i++) { + CloseHandle(hthreads[i]); + } + CloseHandle(main_thread); + xfree(hthreads); + + fd_close(done_fd); + fd_close(done_fd_read); + close(done_fd); + close(done_fd_read); +} + +static DWORD WINAPI +squidaio_thread_loop(LPVOID lpParam) +{ + squidaio_thread_t *threadp = lpParam; + squidaio_request_t *request; + HANDLE cond; /* local copy of the event queue because win32 event handles + * don't atomically release the mutex as cond variables do. */ + + /* lock the thread info */ + if (WAIT_FAILED == WaitForSingleObject(request_queue.mutex, INFINITE)) { + fatal("Can't get ownership of mutex\n"); + } + /* duplicate the handle */ + if (!DuplicateHandle(GetCurrentProcess(), /* pseudo handle, don't close */ + request_queue.cond, /* handle to copy */ + GetCurrentProcess(), /* pseudo handle, don't close */ + &cond, + 0, /* required access */ + FALSE, /* child process's don't inherit the handle */ + DUPLICATE_SAME_ACCESS)) + fatal("Can't duplicate mutex handle\n"); + if (!ReleaseMutex(request_queue.mutex)) { + CloseHandle(cond); + fatal("Can't release mutex\n"); + } + while (1) { + DWORD rv; + threadp->current_req = request = NULL; + request = NULL; + /* Get a request to process */ + threadp->status = _THREAD_WAITING; + if (threadp->exit) { + CloseHandle(request_queue.mutex); + CloseHandle(cond); + return 0; + } + rv = WaitForSingleObject(request_queue.mutex, INFINITE); + if (rv == WAIT_FAILED) { + CloseHandle(cond); + return 1; + } + while (!request_queue.head) { + if (!ReleaseMutex(request_queue.mutex)) { + CloseHandle(cond); + threadp->status = _THREAD_FAILED; + return 1; + } + rv = WaitForSingleObject(cond, INFINITE); + if (rv == WAIT_FAILED) { + CloseHandle(cond); + return 1; + } + rv = WaitForSingleObject(request_queue.mutex, INFINITE); + if (rv == WAIT_FAILED) { + CloseHandle(cond); + return 1; + } + } + request = request_queue.head; + if (request) + request_queue.head = request->next; + if (!request_queue.head) + request_queue.tailp = &request_queue.head; + if (!ReleaseMutex(request_queue.mutex)) { + CloseHandle(cond); + return 1; + } + /* process the request */ + threadp->status = _THREAD_BUSY; + request->next = NULL; + threadp->current_req = request; + errno = 0; + if (!request->cancelled) { + switch (request->request_type) { + case _AIO_OP_OPEN: + squidaio_do_open(request); + break; + case _AIO_OP_READ: + squidaio_do_read(request); + break; + case _AIO_OP_WRITE: + squidaio_do_write(request); + break; + case _AIO_OP_CLOSE: + squidaio_do_close(request); + break; + case _AIO_OP_UNLINK: + squidaio_do_unlink(request); + break; +#if USE_TRUNCATE + case _AIO_OP_TRUNCATE: + squidaio_do_truncate(request); + break; +#endif +#if AIO_OPENDIR /* Opendir not implemented yet */ + case _AIO_OP_OPENDIR: + squidaio_do_opendir(request); + break; +#endif + case _AIO_OP_STAT: + squidaio_do_stat(request); + break; + default: + request->ret = -1; + request->err = EINVAL; + break; + } + } else { /* cancelled */ + request->ret = -1; + request->err = EINTR; + } + threadp->status = _THREAD_DONE; + /* put the request in the done queue */ + rv = WaitForSingleObject(done_queue.mutex, INFINITE); + if (rv == WAIT_FAILED) { + CloseHandle(cond); + return 1; + } + *done_queue.tailp = request; + done_queue.tailp = &request->next; + if (!ReleaseMutex(done_queue.mutex)) { + CloseHandle(cond); + return 1; + } + if (!done_signalled) { + done_signalled = 1; + FD_WRITE_METHOD(done_fd, "!", 1); + } + threadp->requests++; +/* Relinquish the remainder of thread time slice to any other thread + * of equal priority that is ready to run. + */ + Sleep(0); + } /* while forever */ + CloseHandle(cond); + return 0; +} /* squidaio_thread_loop */ + +static void +squidaio_queue_request(squidaio_request_t * request) +{ + static int high_start = 0; + debug(43, 9) ("squidaio_queue_request: %p type=%d result=%p\n", + request, request->request_type, request->resultp); + /* Mark it as not executed (failing result, no error) */ + request->ret = -1; + request->err = 0; + /* Internal housekeeping */ + request_queue_len += 1; + request->resultp->_data = request; + /* Play some tricks with the request_queue2 queue */ + request->next = NULL; + if (!request_queue2.head) { + if (WaitForSingleObject(request_queue.mutex, 0) == WAIT_OBJECT_0) { + /* Normal path */ + *request_queue.tailp = request; + request_queue.tailp = &request->next; + if (!SetEvent(request_queue.cond)) + fatal("couldn't push queue\n"); + if (!ReleaseMutex(request_queue.mutex)) { + /* unexpected error */ + fatal("couldn't push queue\n"); + } + } else { + /* Oops, the request queue is blocked, use request_queue2 */ + *request_queue2.tailp = request; + request_queue2.tailp = &request->next; + } + } else { + /* Secondary path. We have blocked requests to deal with */ + /* add the request to the chain */ + *request_queue2.tailp = request; + if (WaitForSingleObject(request_queue.mutex, 0) == WAIT_OBJECT_0) { + /* Ok, the queue is no longer blocked */ + *request_queue.tailp = request_queue2.head; + request_queue.tailp = &request->next; + if (!SetEvent(request_queue.cond)) + fatal("couldn't push queue\n"); + if (!ReleaseMutex(request_queue.mutex)) { + /* unexpected error */ + fatal("couldn't push queue\n"); + } + request_queue2.head = NULL; + request_queue2.tailp = &request_queue2.head; + } else { + /* still blocked, bump the blocked request chain */ + request_queue2.tailp = &request->next; + } + } + if (request_queue2.head) { + static int filter = 0; + static int filter_limit = 8; + if (++filter >= filter_limit) { + filter_limit += filter; + filter = 0; + debug(43, 1) ("squidaio_queue_request: WARNING - Queue congestion\n"); + } + } + /* Warn if out of threads */ + if (request_queue_len > MAGIC1) { + static int last_warn = 0; + static int queue_high, queue_low; + if (high_start == 0) { + high_start = squid_curtime; + queue_high = request_queue_len; + queue_low = request_queue_len; + } + if (request_queue_len > queue_high) + queue_high = request_queue_len; + if (request_queue_len < queue_low) + queue_low = request_queue_len; + if (squid_curtime >= (last_warn + 15) && + squid_curtime >= (high_start + 5)) { + debug(43, 1) ("squidaio_queue_request: WARNING - Disk I/O overloading\n"); + if (squid_curtime >= (high_start + 15)) + debug(43, 1) ("squidaio_queue_request: Queue Length: current=%d, high=%d, low=%d, duration=%ld\n", + request_queue_len, queue_high, queue_low, (long int) (squid_curtime - high_start)); + last_warn = squid_curtime; + } + } else { + high_start = 0; + } + /* Warn if seriously overloaded */ + if (request_queue_len > RIDICULOUS_LENGTH) { + debug(43, 0) ("squidaio_queue_request: Async request queue growing uncontrollably!\n"); + debug(43, 0) ("squidaio_queue_request: Syncing pending I/O operations.. (blocking)\n"); + squidaio_sync(); + debug(43, 0) ("squidaio_queue_request: Synced\n"); + } +} /* squidaio_queue_request */ + +static void +squidaio_cleanup_request(squidaio_request_t * requestp) +{ + squidaio_result_t *resultp = requestp->resultp; + int cancelled = requestp->cancelled; + + /* Free allocated structures and copy data back to user space if the */ + /* request hasn't been cancelled */ + switch (requestp->request_type) { + case _AIO_OP_STAT: + if (!cancelled && requestp->ret == 0) + xmemcpy(requestp->statp, requestp->tmpstatp, sizeof(struct stat)); + squidaio_xfree(requestp->tmpstatp, sizeof(struct stat)); + squidaio_xstrfree(requestp->path); + break; + case _AIO_OP_OPEN: + if (cancelled && requestp->ret >= 0) + /* The open() was cancelled but completed */ + close(requestp->ret); + squidaio_xstrfree(requestp->path); + break; + case _AIO_OP_CLOSE: + if (cancelled && requestp->ret < 0) + /* The close() was cancelled and never got executed */ + close(requestp->fd); + break; + case _AIO_OP_UNLINK: + case _AIO_OP_TRUNCATE: + case _AIO_OP_OPENDIR: + squidaio_xstrfree(requestp->path); + break; + case _AIO_OP_READ: + break; + case _AIO_OP_WRITE: + break; + default: + break; + } + if (resultp != NULL && !cancelled) { + resultp->aio_return = requestp->ret; + resultp->aio_errno = requestp->err; + } + memPoolFree(squidaio_request_pool, requestp); +} /* squidaio_cleanup_request */ + + +int +squidaio_cancel(squidaio_result_t * resultp) +{ + squidaio_request_t *request = resultp->_data; + + if (request && request->resultp == resultp) { + debug(43, 9) ("squidaio_cancel: %p type=%d result=%p\n", + request, request->request_type, request->resultp); + request->cancelled = 1; + request->resultp = NULL; + resultp->_data = NULL; + return 0; + } + return 1; +} /* squidaio_cancel */ + + +int +squidaio_open(const char *path, int oflag, mode_t mode, squidaio_result_t * resultp) +{ + squidaio_request_t *requestp; + + requestp = memPoolAlloc(squidaio_request_pool); + requestp->path = (char *) squidaio_xstrdup(path); + requestp->oflag = oflag; + requestp->mode = mode; + requestp->resultp = resultp; + requestp->request_type = _AIO_OP_OPEN; + requestp->cancelled = 0; + + squidaio_queue_request(requestp); + return 0; +} + + +static void +squidaio_do_open(squidaio_request_t * requestp) +{ + requestp->ret = open(requestp->path, requestp->oflag, requestp->mode); + requestp->err = errno; +} + + +int +squidaio_read(int fd, char *bufp, int bufs, off_t offset, int whence, squidaio_result_t * resultp) +{ + squidaio_request_t *requestp; + + requestp = memPoolAlloc(squidaio_request_pool); + requestp->fd = fd; + requestp->bufferp = bufp; + requestp->buflen = bufs; + requestp->offset = offset; + requestp->whence = whence; + requestp->resultp = resultp; + requestp->request_type = _AIO_OP_READ; + requestp->cancelled = 0; + + squidaio_queue_request(requestp); + return 0; +} + + +static void +squidaio_do_read(squidaio_request_t * requestp) +{ + lseek(requestp->fd, requestp->offset, requestp->whence); + if (!ReadFile((HANDLE) _get_osfhandle(requestp->fd), requestp->bufferp, + requestp->buflen, (LPDWORD) & requestp->ret, NULL)) { + WIN32_maperror(GetLastError()); + requestp->ret = -1; + } + requestp->err = errno; +} + + +int +squidaio_write(int fd, char *bufp, int bufs, off_t offset, int whence, squidaio_result_t * resultp) +{ + squidaio_request_t *requestp; + + requestp = memPoolAlloc(squidaio_request_pool); + requestp->fd = fd; + requestp->bufferp = bufp; + requestp->buflen = bufs; + requestp->offset = offset; + requestp->whence = whence; + requestp->resultp = resultp; + requestp->request_type = _AIO_OP_WRITE; + requestp->cancelled = 0; + + squidaio_queue_request(requestp); + return 0; +} + + +static void +squidaio_do_write(squidaio_request_t * requestp) +{ + assert(requestp->offset >= 0); + if (!WriteFile((HANDLE) _get_osfhandle(requestp->fd), requestp->bufferp, + requestp->buflen, (LPDWORD) & requestp->ret, NULL)) { + WIN32_maperror(GetLastError()); + requestp->ret = -1; + } + requestp->err = errno; +} + + +int +squidaio_close(int fd, squidaio_result_t * resultp) +{ + squidaio_request_t *requestp; + + requestp = memPoolAlloc(squidaio_request_pool); + requestp->fd = fd; + requestp->resultp = resultp; + requestp->request_type = _AIO_OP_CLOSE; + requestp->cancelled = 0; + + squidaio_queue_request(requestp); + return 0; +} + + +static void +squidaio_do_close(squidaio_request_t * requestp) +{ + if ((requestp->ret = close(requestp->fd)) < 0) + debug(43, 0) ("squidaio_do_close: FD %d, errno %d\n", requestp->fd, errno); + requestp->err = errno; +} + + +int +squidaio_stat(const char *path, struct stat *sb, squidaio_result_t * resultp) +{ + squidaio_request_t *requestp; + + requestp = memPoolAlloc(squidaio_request_pool); + requestp->path = (char *) squidaio_xstrdup(path); + requestp->statp = sb; + requestp->tmpstatp = (struct stat *) squidaio_xmalloc(sizeof(struct stat)); + requestp->resultp = resultp; + requestp->request_type = _AIO_OP_STAT; + requestp->cancelled = 0; + + squidaio_queue_request(requestp); + return 0; +} + + +static void +squidaio_do_stat(squidaio_request_t * requestp) +{ + requestp->ret = stat(requestp->path, requestp->tmpstatp); + requestp->err = errno; +} + + +int +squidaio_unlink(const char *path, squidaio_result_t * resultp) +{ + squidaio_request_t *requestp; + + requestp = memPoolAlloc(squidaio_request_pool); + requestp->path = squidaio_xstrdup(path); + requestp->resultp = resultp; + requestp->request_type = _AIO_OP_UNLINK; + requestp->cancelled = 0; + + squidaio_queue_request(requestp); + return 0; +} + + +static void +squidaio_do_unlink(squidaio_request_t * requestp) +{ + requestp->ret = unlink(requestp->path); + requestp->err = errno; +} + + +#if USE_TRUNCATE +int +squidaio_truncate(const char *path, off_t length, squidaio_result_t * resultp) +{ + squidaio_request_t *requestp; + + requestp = memPoolAlloc(squidaio_request_pool); + requestp->path = (char *) squidaio_xstrdup(path); + requestp->offset = length; + requestp->resultp = resultp; + requestp->request_type = _AIO_OP_TRUNCATE; + requestp->cancelled = 0; + + squidaio_queue_request(requestp); + return 0; +} + + +static void +squidaio_do_truncate(squidaio_request_t * requestp) +{ + requestp->ret = truncate(requestp->path, requestp->offset); + requestp->err = errno; +} + +#endif + + +#if AIO_OPENDIR +/* XXX squidaio_opendir NOT implemented yet.. */ + +int +squidaio_opendir(const char *path, squidaio_result_t * resultp) +{ + squidaio_request_t *requestp; + int len; + + requestp = memPoolAlloc(squidaio_request_pool); + return -1; +} + +static void +squidaio_do_opendir(squidaio_request_t * requestp) +{ + /* NOT IMPLEMENTED */ +} + +#endif + +static void +squidaio_poll_queues(void) +{ + /* kick "overflow" request queue */ + if (request_queue2.head && + (WaitForSingleObject(request_queue.mutex, 0) == WAIT_OBJECT_0)) { + *request_queue.tailp = request_queue2.head; + request_queue.tailp = request_queue2.tailp; + if (!SetEvent(request_queue.cond)) + fatal("couldn't push queue\n"); + if (!ReleaseMutex(request_queue.mutex)) { + /* unexpected error */ + fatal("couldn't push queue\n"); + } + request_queue2.head = NULL; + request_queue2.tailp = &request_queue2.head; + } + /* Give up the CPU to allow the threads to do their work */ + if (done_queue.head || request_queue.head) + Sleep(0); + /* poll done queue */ + if (done_queue.head && + (WaitForSingleObject(done_queue.mutex, 0) == WAIT_OBJECT_0)) { + struct squidaio_request_t *requests = done_queue.head; + done_queue.head = NULL; + done_queue.tailp = &done_queue.head; + if (!ReleaseMutex(done_queue.mutex)) { + /* unexpected error */ + fatal("couldn't poll queue\n"); + } + *done_requests.tailp = requests; + request_queue_len -= 1; + while (requests->next) { + requests = requests->next; + request_queue_len -= 1; + } + done_requests.tailp = &requests->next; + } +} + +squidaio_result_t * +squidaio_poll_done(void) +{ + squidaio_request_t *request; + squidaio_result_t *resultp; + int cancelled; + int polled = 0; + + AIO_REPOLL: + request = done_requests.head; + if (request == NULL && !polled) { + if (done_signalled) { + char junk[256]; + FD_READ_METHOD(done_fd_read, junk, sizeof(junk)); + done_signalled = 0; + } + squidaio_poll_queues(); + polled = 1; + request = done_requests.head; + } + if (!request) { + return NULL; + } + debug(43, 9) ("squidaio_poll_done: %p type=%d result=%p\n", + request, request->request_type, request->resultp); + done_requests.head = request->next; + if (!done_requests.head) + done_requests.tailp = &done_requests.head; + resultp = request->resultp; + cancelled = request->cancelled; + squidaio_debug(request); + debug(43, 5) ("DONE: %d -> %d\n", request->ret, request->err); + squidaio_cleanup_request(request); + if (cancelled) + goto AIO_REPOLL; + return resultp; +} /* squidaio_poll_done */ + +int +squidaio_operations_pending(void) +{ + return request_queue_len + (done_requests.head ? 1 : 0); +} + +int +squidaio_sync(void) +{ + /* XXX This might take a while if the queue is large.. */ + do { + squidaio_poll_queues(); + } while (request_queue_len > 0); + return squidaio_operations_pending(); +} + +int +squidaio_get_queue_len(void) +{ + return request_queue_len; +} + +static void +squidaio_debug(squidaio_request_t * request) +{ + switch (request->request_type) { + case _AIO_OP_OPEN: + debug(43, 5) ("OPEN of %s to FD %d\n", request->path, request->ret); + break; + case _AIO_OP_READ: + debug(43, 5) ("READ on fd: %d\n", request->fd); + break; + case _AIO_OP_WRITE: + debug(43, 5) ("WRITE on fd: %d\n", request->fd); + break; + case _AIO_OP_CLOSE: + debug(43, 5) ("CLOSE of fd: %d\n", request->fd); + break; + case _AIO_OP_UNLINK: + debug(43, 5) ("UNLINK of %s\n", request->path); + break; + case _AIO_OP_TRUNCATE: + debug(43, 5) ("UNLINK of %s\n", request->path); + break; + default: + break; + } +} + +void +squidaio_stats(StoreEntry * sentry) +{ + squidaio_thread_t *threadp; + int i; + + if (!squidaio_initialised) + return; + + storeAppendPrintf(sentry, "\n\nThreads Status:\n"); + storeAppendPrintf(sentry, "#\tID\t# Requests\n"); + + threadp = threads; + for (i = 0; i < squidaio_nthreads; i++) { + storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, threadp->dwThreadId, threadp->requests); + threadp = threadp->next; + } +} diff -ruN squid-2.6.STABLE3/src/fs/aufs/async_io.c squid-2.6.STABLE4/src/fs/aufs/async_io.c --- squid-2.6.STABLE3/src/fs/aufs/async_io.c Thu May 18 18:16:14 2006 +++ squid-2.6.STABLE4/src/fs/aufs/async_io.c Sat Sep 9 10:04:38 2006 @@ -1,6 +1,6 @@ /* - * $Id: async_io.c,v 1.20 2006/05/19 00:16:14 adrian Exp $ + * $Id: async_io.c,v 1.21 2006/09/09 16:04:38 serassio Exp $ * * DEBUG: section 32 Asynchronous Disk I/O * AUTHOR: Pete Bentley @@ -268,6 +268,7 @@ dlinkAdd(ctrlp, &ctrlp->node, &used_list); } /* aioUnlink */ +#if USE_TRUNCATE void aioTruncate(const char *path, off_t length, AIOCB * callback, void *callback_data) { @@ -285,6 +286,7 @@ dlinkAdd(ctrlp, &ctrlp->node, &used_list); } /* aioTruncate */ +#endif int aioCheckCallbacks(SwapDir * SD) diff -ruN squid-2.6.STABLE3/src/fs/aufs/store_dir_aufs.c squid-2.6.STABLE4/src/fs/aufs/store_dir_aufs.c --- squid-2.6.STABLE3/src/fs/aufs/store_dir_aufs.c Wed Aug 2 20:31:12 2006 +++ squid-2.6.STABLE4/src/fs/aufs/store_dir_aufs.c Fri Sep 15 14:13:02 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.c,v 1.62 2006/08/03 02:31:12 adrian Exp $ + * $Id: store_dir_aufs.c,v 1.64 2006/09/15 20:13:02 serassio Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -216,7 +216,11 @@ } else { fatalf("Swap directory %s is not a directory.", path); } +#ifdef _SQUID_MSWIN_ + } else if (0 == mkdir(path)) { +#else } else if (0 == mkdir(path, 0755)) { +#endif debug(47, should_exist ? 1 : 3) ("%s created\n", path); created = 1; } else { @@ -1301,7 +1305,7 @@ fd = state->fd; /* rename */ if (state->fd >= 0) { -#if defined(_SQUID_OS2_) || defined (_SQUID_CYGWIN_) +#if defined(_SQUID_OS2_) || defined(_SQUID_WIN32_) file_close(state->fd); state->fd = -1; #endif @@ -1400,7 +1404,11 @@ if (dp == NULL) { if (errno == ENOENT) { debug(36, 0) ("storeDirClean: WARNING: Creating %s\n", p1); +#ifdef _SQUID_MSWIN_ + if (mkdir(p1) == 0) +#else if (mkdir(p1, 0777) == 0) +#endif return 0; } debug(50, 0) ("storeDirClean: %s: %s\n", p1, xstrerror()); @@ -1625,7 +1633,7 @@ { debug(79, 3) ("storeAufsDirUnlinkFile: unlinking fileno %08X\n", f); /* storeAufsDirMapBitReset(SD, f); */ -#if USE_TRUNCATE_NOT_UNLINK +#if USE_TRUNCATE aioTruncate(storeAufsDirFullPath(SD, f, NULL), NULL, NULL); #else aioUnlink(storeAufsDirFullPath(SD, f, NULL), NULL, NULL); @@ -1688,13 +1696,13 @@ x = storeDirGetUFSStats(SD->path, &totl_kb, &free_kb, &totl_in, &free_in); if (0 == x) { #ifdef HAVE_STATVFS - storeAppendPrintf(sentry, "Filesystem Space in use: %llu/%llu KB (%.0f%%)\n", - (unsigned long long) (totl_kb - free_kb), - (unsigned long long) totl_kb, + storeAppendPrintf(sentry, "Filesystem Space in use: %" PRIu64 "/%" PRIu64 " KB (%.0f%%)\n", + (uint64_t) (totl_kb - free_kb), + (uint64_t) totl_kb, dpercent(totl_kb - free_kb, totl_kb)); - storeAppendPrintf(sentry, "Filesystem Inodes in use: %llu/%llu (%.0f%%)\n", - (unsigned long long) (totl_in - free_in), - (unsigned long long) totl_in, + storeAppendPrintf(sentry, "Filesystem Inodes in use: %" PRIu64 "/%" PRIu64 " (%.0f%%)\n", + (uint64_t) (totl_in - free_in), + (uint64_t) totl_in, dpercent(totl_in - free_in, totl_in)); #else storeAppendPrintf(sentry, "Filesystem Space in use: %d/%d KB (%d%%)\n", diff -ruN squid-2.6.STABLE3/src/fs/aufs/store_io_aufs.c squid-2.6.STABLE4/src/fs/aufs/store_io_aufs.c --- squid-2.6.STABLE3/src/fs/aufs/store_io_aufs.c Wed Jul 5 00:52:12 2006 +++ squid-2.6.STABLE4/src/fs/aufs/store_io_aufs.c Sat Sep 9 10:04:38 2006 @@ -1,6 +1,35 @@ /* - * DEBUG 79 + * $Id: store_io_aufs.c,v 1.33 2006/09/09 16:04:38 serassio Exp $ + * + * DEBUG: section 79 Squid-side AUFS I/O functions. + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * */ #include "squid.h" diff -ruN squid-2.6.STABLE3/src/fs/coss/async_io.c squid-2.6.STABLE4/src/fs/coss/async_io.c --- squid-2.6.STABLE3/src/fs/coss/async_io.c Sat May 20 06:23:50 2006 +++ squid-2.6.STABLE4/src/fs/coss/async_io.c Sat Sep 16 14:29:58 2006 @@ -11,12 +11,14 @@ * supports are read/write, and since COSS works on a single file * per storedir it should work just fine. * - * $Id: async_io.c,v 1.13 2006/05/20 12:23:50 adrian Exp $ + * $Id: async_io.c,v 1.14 2006/09/16 20:29:58 serassio Exp $ */ #include "squid.h" #include +#if HAVE_AIO_H #include +#endif #include "async_io.h" @@ -29,6 +31,7 @@ /* Internal routines */ +#if !USE_AUFSOPS /* * find a free aio slot. * Return the index, or -1 if we can't find one. @@ -49,8 +52,6 @@ } - - /* Exported routines */ void @@ -221,6 +222,7 @@ } return completed; } +#endif void diff -ruN squid-2.6.STABLE3/src/fs/coss/async_io.h squid-2.6.STABLE4/src/fs/coss/async_io.h --- squid-2.6.STABLE3/src/fs/coss/async_io.h Wed Aug 15 18:16:20 2001 +++ squid-2.6.STABLE4/src/fs/coss/async_io.h Sat Sep 23 04:46:00 2006 @@ -27,7 +27,9 @@ struct _async_queue_entry { async_queue_entry_state_t aq_e_state; async_queue_entry_type_t aq_e_type; +#if !USE_AUFSOPS struct aiocb aq_e_aiocb; +#endif union { DRCB *read; DWCB *write; diff -ruN squid-2.6.STABLE3/src/fs/coss/store_coss.h squid-2.6.STABLE4/src/fs/coss/store_coss.h --- squid-2.6.STABLE3/src/fs/coss/store_coss.h Tue Aug 15 20:33:22 2006 +++ squid-2.6.STABLE4/src/fs/coss/store_coss.h Sat Sep 23 04:34:41 2006 @@ -166,6 +166,7 @@ int nummemstripes; struct _cossstripe *memstripes; int curmemstripe; + const char *stripe_path; }; struct _cossindex { @@ -217,6 +218,7 @@ extern void membufsDump(CossInfo * cs, StoreEntry * e); extern void storeCossFreeDeadMemBufs(CossInfo * cs); extern int storeCossFilenoToStripe(CossInfo * cs, sfileno filen); +extern char const *stripePath(SwapDir * sd); extern struct _coss_stats coss_stats; diff -ruN squid-2.6.STABLE3/src/fs/coss/store_dir_coss.c squid-2.6.STABLE4/src/fs/coss/store_dir_coss.c --- squid-2.6.STABLE3/src/fs/coss/store_dir_coss.c Tue Aug 15 20:33:23 2006 +++ squid-2.6.STABLE4/src/fs/coss/store_dir_coss.c Sat Sep 23 04:34:41 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.c,v 1.53 2006/08/16 02:33:23 swilton Exp $ + * $Id: store_dir_coss.c,v 1.59 2006/09/23 10:34:41 serassio Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -34,7 +34,9 @@ */ #include "squid.h" +#if HAVE_AIO_H #include +#endif #include "async_io.h" #include "store_coss.h" @@ -123,6 +125,24 @@ struct _coss_stats coss_stats; +char const * +stripePath(SwapDir * sd) +{ + CossInfo *cs = (CossInfo *) sd->fsdata; + char pathtmp[SQUID_MAXPATHLEN]; + struct stat st; + + if (!cs->stripe_path) { + strcpy(pathtmp, sd->path); + if (stat(sd->path, &st) == 0) { + if (S_ISDIR(st.st_mode)) + strcat(pathtmp, "/stripe"); + } + cs->stripe_path = xstrdup(pathtmp); + } + return cs->stripe_path; +} + static char * storeCossDirSwapLogFile(SwapDir * sd, const char *ext) { @@ -196,9 +216,9 @@ #else a_file_setupqueue(&cs->aq); #endif - cs->fd = file_open(sd->path, O_RDWR | O_CREAT | O_BINARY); + cs->fd = file_open(stripePath(sd), O_RDWR | O_CREAT | O_BINARY); if (cs->fd < 0) { - debug(79, 1) ("%s: %s\n", sd->path, xstrerror()); + debug(79, 1) ("%s: %s\n", stripePath(sd), xstrerror()); fatal("storeCossDirInit: Failed to open a COSS file."); } storeCossDirOpenSwapLog(sd); @@ -261,7 +281,7 @@ store_dirs_rebuilding--; storeCossDirCloseTmpSwapLog(SD); storeRebuildComplete(&rb->counts); - debug(47, 1) ("COSS: %s: Rebuild Completed\n", SD->path); + debug(47, 1) ("COSS: %s: Rebuild Completed\n", stripePath(SD)); cs->rebuild.rebuilding = 0; debug(47, 1) (" %d objects scanned, %d objects relocated, %d objects fresher, %d objects ignored\n", rb->counts.scancount, rb->cosscounts.reloc, rb->cosscounts.fresher, rb->cosscounts.unknown); @@ -282,7 +302,7 @@ rb->flags.clean = (unsigned int) clean; fp = storeCossDirOpenTmpSwapLog(sd, &clean, &zero); fclose(fp); - debug(20, 1) ("Rebuilding COSS storage in %s (DIRTY)\n", sd->path); + debug(20, 1) ("Rebuilding COSS storage in %s (DIRTY)\n", stripePath(sd)); store_dirs_rebuilding++; storeDirCoss_StartDiskRebuild(rb); } @@ -487,7 +507,7 @@ storeCossDirCloseSwapLog(sd); /* rename */ if (state->fd >= 0) { -#ifdef _SQUID_OS2_ +#if defined(_SQUID_OS2_) || defined(_SQUID_WIN32_) file_close(state->fd); state->fd = -1; #endif @@ -545,7 +565,7 @@ static void storeCossDirNewfs(SwapDir * sd) { - debug(47, 3) ("Creating swap space in %s\n", sd->path); + debug(47, 3) ("Creating swap space in %s\n", stripePath(sd)); } /* we are shutting down, flush all membufs to disk */ @@ -553,7 +573,7 @@ storeCossDirShutdown(SwapDir * SD) { CossInfo *cs = (CossInfo *) SD->fsdata; - debug(47, 1) ("COSS: %s: syncing\n", SD->path); + debug(47, 1) ("COSS: %s: syncing\n", stripePath(SD)); #if USE_AUFSOPS aioSync(SD); @@ -564,6 +584,7 @@ #endif file_close(cs->fd); cs->fd = -1; + xfree((void *) cs->stripe_path); if (cs->swaplog_fd > -1) { file_close(cs->swaplog_fd); @@ -787,7 +808,7 @@ * signed integer, as defined in structs.h. */ max_offset = (off_t) 0xFFFFFF << cs->blksz_bits; - if ((sd->max_size + cs->nummemstripes) > (unsigned long) (max_offset >> 10)) { + if ((sd->max_size + (cs->nummemstripes * (COSS_MEMBUF_SZ >> 10))) > (unsigned long) (max_offset >> 10)) { debug(47, 0) ("COSS block-size = %d bytes\n", 1 << cs->blksz_bits); debug(47, 0) ("COSS largest file offset = %lu KB\n", (unsigned long) max_offset >> 10); debug(47, 0) ("COSS cache_dir size = %d KB\n", sd->max_size); @@ -1110,10 +1131,10 @@ xmemcpy(cs->rebuild.buf, buf, r_len); #endif - debug(47, 2) ("COSS: %s: stripe %d, read %d bytes, status %d\n", SD->path, cs->rebuild.curstripe, r_len, r_errflag); + debug(47, 2) ("COSS: %s: stripe %d, read %d bytes, status %d\n", stripePath(SD), cs->rebuild.curstripe, r_len, r_errflag); cs->rebuild.reading = 0; if (r_errflag != DISK_OK) { - debug(47, 2) ("COSS: %s: stripe %d: error! Ignoring objects in this stripe.\n", SD->path, cs->rebuild.curstripe); + debug(47, 2) ("COSS: %s: stripe %d: error! Ignoring objects in this stripe.\n", stripePath(SD), cs->rebuild.curstripe); goto nextstripe; } cs->rebuild.buflen = r_len; @@ -1130,7 +1151,7 @@ cs->rebuild.curstripe++; if (cs->rebuild.curstripe >= cs->numstripes) { /* Completed the rebuild - move onto the next phase */ - debug(47, 2) ("COSS: %s: completed reading the stripes.\n", SD->path); + debug(47, 2) ("COSS: %s: completed reading the stripes.\n", stripePath(SD)); storeCossRebuildComplete(rb); return; } else { @@ -1148,9 +1169,9 @@ assert(cs->rebuild.reading == 0); cs->rebuild.reading = 1; /* Use POSIX AIO for now */ - debug(47, 2) ("COSS: %s: reading stripe %d\n", SD->path, cs->rebuild.curstripe); + debug(47, 2) ("COSS: %s: reading stripe %d\n", stripePath(SD), cs->rebuild.curstripe); if (cs->rebuild.curstripe > rb->report_current) { - debug(47, 1) ("COSS: %s: Rebuilding (%d %% completed - %d/%d stripes)\n", SD->path, + debug(47, 1) ("COSS: %s: Rebuilding (%d %% completed - %d/%d stripes)\n", stripePath(SD), cs->rebuild.curstripe * 100 / cs->numstripes, cs->rebuild.curstripe, cs->numstripes); rb->report_current += rb->report_interval; } @@ -1176,7 +1197,7 @@ cs->rebuild.buf = xmalloc(COSS_MEMBUF_SZ); rb->report_interval = cs->numstripes / COSS_REPORT_INTERVAL; rb->report_current = 0; - debug(47, 2) ("COSS: %s: Beginning disk rebuild.\n", SD->path); + debug(47, 2) ("COSS: %s: Beginning disk rebuild.\n", stripePath(SD)); storeDirCoss_ReadStripe(rb); } @@ -1203,7 +1224,7 @@ assert(cs->rebuild.buf != NULL); if (cs->rebuild.buflen == 0) { - debug(47, 3) ("COSS: %s: stripe %d: read 0 bytes, skipping stripe\n", SD->path, cs->rebuild.curstripe); + debug(47, 3) ("COSS: %s: stripe %d: read 0 bytes, skipping stripe\n", stripePath(SD), cs->rebuild.curstripe); return; } while (j < cs->rebuild.buflen) { @@ -1212,15 +1233,15 @@ /* XXX there's no bounds checking on the buffer being passed into storeSwapMetaUnpack! */ tlv_list = storeSwapMetaUnpack(cs->rebuild.buf + j, &bl); if (tlv_list == NULL) { - debug(47, 3) ("COSS: %s: stripe %d: offset %d gives NULL swapmeta data; end of stripe\n", SD->path, cs->rebuild.curstripe, j); + debug(47, 3) ("COSS: %s: stripe %d: offset %d gives NULL swapmeta data; end of stripe\n", stripePath(SD), cs->rebuild.curstripe, j); return; } filen = (off_t) j / (off_t) blocksize + (off_t) ((off_t) cs->rebuild.curstripe * (off_t) COSS_MEMBUF_SZ / (off_t) blocksize); - debug(47, 3) ("COSS: %s: stripe %d: filen %d: header size %d\n", SD->path, cs->rebuild.curstripe, filen, bl); + debug(47, 3) ("COSS: %s: stripe %d: filen %d: header size %d\n", stripePath(SD), cs->rebuild.curstripe, filen, bl); /* COSS objects will have an object size written into the metadata */ - bzero(&tmpe, sizeof(tmpe)); - bzero(key, sizeof(key)); + memset(&tmpe, 0, sizeof(tmpe)); + memset(key, 0, sizeof(key)); for (t = tlv_list; t; t = t->next) { switch (t->type) { case STORE_META_URL: @@ -1271,7 +1292,7 @@ } /* Make sure we have an object; if we don't then it may be an indication of trouble */ if (l == NULL) { - debug(47, 3) ("COSS: %s: stripe %d: Object with no size; end of stripe\n", SD->path, cs->rebuild.curstripe); + debug(47, 3) ("COSS: %s: stripe %d: Object with no size; end of stripe\n", stripePath(SD), cs->rebuild.curstripe); storeSwapTLVFree(tlv_list); return; } @@ -1279,14 +1300,14 @@ /* Finally, make sure there's enough data left in this stripe to satisfy the object * we've just been informed about */ - if (cs->rebuild.buflen - j < len) { - debug(47, 3) ("COSS: %s: stripe %d: Not enough data in this stripe for this object, bye bye.\n", SD->path, cs->rebuild.curstripe); + if ((cs->rebuild.buflen - j) < (len + bl)) { + debug(47, 3) ("COSS: %s: stripe %d: Not enough data in this stripe for this object, bye bye.\n", stripePath(SD), cs->rebuild.curstripe); storeSwapTLVFree(tlv_list); return; } /* Houston, we have an object */ if (storeKeyNull(key)) { - debug(47, 3) ("COSS: %s: stripe %d: null data, next!\n", SD->path, cs->rebuild.curstripe); + debug(47, 3) ("COSS: %s: stripe %d: null data, next!\n", stripePath(SD), cs->rebuild.curstripe); goto nextobject; } rb->counts.scancount++; @@ -1296,17 +1317,19 @@ tmpe.swap_file_sz = len + bl; } if (tmpe.swap_file_sz != (len + bl)) { - debug(47, 3) ("COSS: %s: stripe %d: file size mismatch (%" PRINTF_OFF_T " != %" PRINTF_OFF_T ")\n", SD->path, cs->rebuild.curstripe, tmpe.swap_file_sz, len); + debug(47, 3) ("COSS: %s: stripe %d: file size mismatch (%" PRINTF_OFF_T " != %" PRINTF_OFF_T ")\n", stripePath(SD), cs->rebuild.curstripe, tmpe.swap_file_sz, len); goto nextobject; } if (EBIT_TEST(tmpe.flags, KEY_PRIVATE)) { - debug(47, 3) ("COSS: %s: stripe %d: private key flag set, ignoring.\n", SD->path, cs->rebuild.curstripe); + debug(47, 3) ("COSS: %s: stripe %d: private key flag set, ignoring.\n", stripePath(SD), cs->rebuild.curstripe); rb->counts.badflags++; goto nextobject; } /* Time to consider the object! */ tmpe.swap_filen = filen; tmpe.swap_dirn = SD->index; + + debug(47, 3) ("COSS: %s Considering filneumber %d\n", stripePath(SD), tmpe.swap_filen); storeCoss_ConsiderStoreEntry(rb, key, &tmpe); nextobject: @@ -1392,6 +1415,7 @@ oe = storeGet(key); if (oe == NULL) { rb->cosscounts.new++; + debug(47, 3) ("COSS: Adding filen %d\n", e->swap_filen); /* no clash! woo, can add and forget */ storeCoss_AddStoreEntry(rb, key, e); return; diff -ruN squid-2.6.STABLE3/src/fs/coss/store_io_coss.c squid-2.6.STABLE4/src/fs/coss/store_io_coss.c --- squid-2.6.STABLE3/src/fs/coss/store_io_coss.c Tue Aug 15 20:33:23 2006 +++ squid-2.6.STABLE4/src/fs/coss/store_io_coss.c Sat Sep 23 04:34:41 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_io_coss.c,v 1.28 2006/08/16 02:33:23 swilton Exp $ + * $Id: store_io_coss.c,v 1.34 2006/09/23 10:34:41 serassio Exp $ * * DEBUG: section 79 Storage Manager COSS Interface * AUTHOR: Eric Stern @@ -34,7 +34,9 @@ */ #include "squid.h" +#if HAVE_AIO_H #include +#endif #include "async_io.h" #include "store_coss.h" #if USE_AUFSOPS @@ -122,7 +124,7 @@ cs->current_memonly_offset = ((cs->current_memonly_offset + cs->blksz_mask) >> cs->blksz_bits) << cs->blksz_bits; f = storeCossDiskOffsetToFileno(retofs, cs); assert(f >= 0 && f <= 0xffffff); - debug(79, 3) ("storeCossMemOnlyAllocate: offset %lld, filen: %d\n", (long long int) retofs, f); + debug(79, 3) ("storeCossMemOnlyAllocate: offset %" PRId64 ", filen: %d\n", (int64_t) retofs, f); return f; } @@ -164,7 +166,7 @@ /* Check to see if we need to allocate a membuf to start */ if (cs->current_membuf == NULL) { - if (cs->curstripe < cs->numstripes) + if (cs->curstripe < (cs->numstripes - 1)) newmb = storeCossCreateMemBuf(SD, cs->curstripe + 1, checkf, &coll); else newmb = storeCossCreateMemBuf(SD, 0, checkf, &coll); @@ -189,7 +191,7 @@ storeCossMaybeWriteMemBuf(SD, cs->current_membuf); /* cs->current_membuf may be invalid at this point */ cs->current_offset = 0; /* wrap back to beginning */ - debug(79, 2) ("storeCossAllocate: %s: wrap to 0\n", SD->path); + debug(79, 2) ("storeCossAllocate: %s: wrap to 0\n", stripePath(SD)); newmb = storeCossCreateMemBuf(SD, 0, checkf, &coll); cs->current_membuf = newmb; @@ -208,8 +210,8 @@ cs->current_offset = cs->current_membuf->diskend; storeCossMaybeWriteMemBuf(SD, cs->current_membuf); /* cs->current_membuf may be invalid at this point */ - debug(79, 3) ("storeCossAllocate: %s: New offset - %lld\n", SD->path, - (long long int) cs->current_offset); + debug(79, 3) ("storeCossAllocate: %s: New offset - %" PRId64 "\n", stripePath(SD), + (int64_t) cs->current_offset); assert(cs->curstripe < (cs->numstripes - 1)); newmb = storeCossCreateMemBuf(SD, cs->curstripe + 1, checkf, &coll); cs->current_membuf = newmb; @@ -227,7 +229,7 @@ cs->current_offset = ((cs->current_offset + cs->blksz_mask) >> cs->blksz_bits) << cs->blksz_bits; f = storeCossDiskOffsetToFileno(retofs, cs); assert(f >= 0 && f <= 0xffffff); - debug(79, 3) ("storeCossAllocate: offset %lld, filen: %d\n", (long long int) retofs, f); + debug(79, 3) ("storeCossAllocate: offset %" PRId64 ", filen: %d\n", (int64_t) retofs, f); /* * Keep track of the largest object we can accept based on the @@ -243,7 +245,7 @@ cs->sizerange_max = SD->max_objsize; coss_stats.alloc.collisions++; - debug(79, 3) ("storeCossAllocate: %s: Collision\n", SD->path); + debug(79, 3) ("storeCossAllocate: %s: Collision\n", stripePath(SD)); return -1; } } @@ -251,7 +253,7 @@ void storeCossUnlink(SwapDir * SD, StoreEntry * e) { - debug(79, 3) ("storeCossUnlink: %s: offset %d\n", SD->path, e->swap_filen); + debug(79, 3) ("storeCossUnlink: %s: offset %d\n", stripePath(SD), e->swap_filen); coss_stats.unlink.ops++; coss_stats.unlink.success++; storeCossRemove(SD, e); @@ -260,8 +262,25 @@ void storeCossRecycle(SwapDir * SD, StoreEntry * e) { - debug(79, 3) ("storeCossRecycle: %s: offset %d\n", SD->path, e->swap_filen); - storeCossUnlink(SD, e); + debug(79, 3) ("storeCossRecycle: %s: offset %d\n", stripePath(SD), e->swap_filen); + + /* Expire the object */ + storeExpireNow(e); + storeReleaseRequest(e); + + /* If there is a valid filen remove from COSS linked list */ + if (e->swap_filen > -1) { + storeCossUnlink(SD, e); + + /* + * Set filen and dirn to -1. + * This makes storeRelease() treat the entry differently + */ + e->swap_filen = -1; + e->swap_dirn = -1; + } + /* Finally make the store layer forget about this object */ + storeRelease(e); } static int @@ -372,7 +391,7 @@ // This seems to cause a crash: either the membuf pointer is set wrong or the membuf // is deallocated from underneath us. storeCossMemBufLock(SD, sio); - debug(79, 3) ("storeCossOpen: %s: memory hit!\n", SD->path); + debug(79, 3) ("storeCossOpen: %s: memory hit!\n", stripePath(SD)); } else { /* Do the allocation */ /* this is the first time we've been called on a new sio @@ -390,13 +409,13 @@ /* If the object is allocated too recently, make a memory-only copy */ if (storeCossRelocateRequired(cs, sio->swap_filen)) { - debug(79, 3) ("storeCossOpen: %s: memory miss - doing reallocation (Current stripe : %d Object in stripe : %d)\n", SD->path, cs->curstripe, storeCossFilenoToStripe(cs, sio->swap_filen)); + debug(79, 3) ("storeCossOpen: %s: memory miss - doing reallocation (Current stripe : %d Object in stripe : %d)\n", stripePath(SD), cs->curstripe, storeCossFilenoToStripe(cs, sio->swap_filen)); nf = storeCossAllocate(SD, e, COSS_ALLOC_REALLOC); } else { - debug(79, 3) ("storeCossOpen: %s memory miss - not reallocating (Current stripe : %d Object in stripe : %d)\n", SD->path, cs->curstripe, storeCossFilenoToStripe(cs, sio->swap_filen)); + debug(79, 3) ("storeCossOpen: %s memory miss - not reallocating (Current stripe : %d Object in stripe : %d)\n", stripePath(SD), cs->curstripe, storeCossFilenoToStripe(cs, sio->swap_filen)); nf = storeCossMemOnlyAllocate(SD, e); if (nf == -1) { - debug(79, 3) ("storeCossOpen: %s memory miss - reallocating because all membufs are in use\n", SD->path); + debug(79, 3) ("storeCossOpen: %s memory miss - reallocating because all membufs are in use\n", stripePath(SD)); nf = storeCossAllocate(SD, e, COSS_ALLOC_REALLOC); } } @@ -475,7 +494,7 @@ assert(sio->read.callback_data == NULL); sio->read.callback = callback; sio->read.callback_data = callback_data; - debug(79, 3) ("storeCossRead: %s: file number %d offset %ld\n", SD->path, sio->swap_filen, (long int) offset); + debug(79, 3) ("storeCossRead: %s: file number %d offset %ld\n", stripePath(SD), sio->swap_filen, (long int) offset); sio->offset = offset; cstate->flags.reading = 1; if ((offset + size) > sio->st_size) @@ -503,7 +522,10 @@ assert(sio->e->mem_obj->object_sz != -1); coss_stats.write.ops++; - debug(79, 3) ("storeCossWrite: %s: offset %ld, len %lu\n", SD->path, + if (sio->offset != offset) { + debug(79, 1) ("storeCossWrite: Possible data corruption on fileno %d, offsets do not match (Current:%" PRINTF_OFF_T " Want:%" PRINTF_OFF_T ")\n", sio->swap_filen, sio->offset, offset); + } + debug(79, 3) ("storeCossWrite: %s: offset %ld, len %lu\n", stripePath(SD), (long int) sio->offset, (unsigned long int) size); diskoffset = storeCossFilenoToDiskOffset(sio->swap_filen, SD->fsdata) + sio->offset; dest = storeCossMemPointerFromDiskOffset(SD->fsdata, diskoffset, &membuf); @@ -702,7 +724,7 @@ coss_stats.stripe_write.ops++; assert(t->stripe < cs->numstripes); if (cs->stripes[t->stripe].pending_relocs > 0) { - debug(79, 1) ("WARNING: %s: One or more pending relocate (reads) from stripe %d are queued - and I'm now writing over that part of the disk. This may result in object data corruption!\n", SD->path, t->stripe); + debug(79, 1) ("WARNING: %s: One or more pending relocate (reads) from stripe %d are queued - and I'm now writing over that part of the disk. This may result in object data corruption!\n", stripePath(SD), t->stripe); } /* Update load stats */ cs->loadcalc[cur_load_interval] += 1; @@ -718,11 +740,11 @@ /* XXX The last stripe, for now, ain't the coss stripe size for some reason */ /* XXX This may cause problems later on; worry about figuring it out later on */ //assert(t->diskend - t->diskstart == COSS_MEMBUF_SZ); - debug(79, 3) ("aioWrite: FD %d: disk start: %llu, size %llu\n", cs->fd, (long long int) t->diskstart, (long long int) t->diskend - t->diskstart); - aioWrite(cs->fd, t->diskstart, &(t->buffer[0]), t->diskend - t->diskstart, storeCossWriteMemBufDone, t, NULL); + debug(79, 3) ("aioWrite: FD %d: disk start: %" PRIu64 ", size %" PRIu64 "\n", cs->fd, (uint64_t) t->diskstart, (uint64_t) t->diskend - t->diskstart); + aioWrite(cs->fd, t->diskstart, &(t->buffer[0]), COSS_MEMBUF_SZ, storeCossWriteMemBufDone, t, NULL); #else a_file_write(&cs->aq, cs->fd, t->diskstart, &t->buffer, - t->diskend - t->diskstart, storeCossWriteMemBufDone, t, NULL); + COSS_MEMBUF_SZ, storeCossWriteMemBufDone, t, NULL); #endif } else { /* No need to write, just mark as written and free */ @@ -821,7 +843,7 @@ coss_stats.stripe_write.success++; } assert(cs->stripes[t->stripe].membuf == t); - debug(79, 2) ("storeCossWriteMemBufDone: %s: stripe %d: numobjs written: %d, lockcount %d\n", t->SD->path, t->stripe, t->numobjs, t->lockcount); + debug(79, 2) ("storeCossWriteMemBufDone: %s: stripe %d: numobjs written: %d, lockcount %d\n", stripePath(t->SD), t->stripe, t->numobjs, t->lockcount); cs->stripes[t->stripe].numdiskobjs = t->numobjs; cs->stripes[t->stripe].membuf = NULL; t->flags.written = 1; @@ -845,7 +867,7 @@ } if (stripe >= cs->nummemstripes) { if (last_warn + 15 < squid_curtime) { - debug(79, 1) ("storeCossCreateMemOnlyBuf: no free membufs. You may need to increase the value of membufs on the %s cache_dir\n", SD->path); + debug(79, 1) ("storeCossCreateMemOnlyBuf: no free membufs. You may need to increase the value of membufs on the %s cache_dir\n", stripePath(SD)); last_warn = squid_curtime; } return NULL; @@ -892,7 +914,7 @@ if (cs->numfullstripes >= cs->maxfullstripes) { if (last_warn + 15 < squid_curtime) { - debug(79, 1) ("storeCossCreateMemBuf: Maximum number of full buffers reached on %s. You may need to increase the maxfullbuffers option for this cache_dir\n", SD->path); + debug(79, 1) ("storeCossCreateMemBuf: Maximum number of full buffers reached on %s. You may need to increase the maxfullbuffers option for this cache_dir\n", stripePath(SD)); last_warn = squid_curtime; } return NULL; @@ -906,7 +928,7 @@ cs->stripes[stripe].membuf = newmb; newmb->diskstart = start; newmb->stripe = stripe; - debug(79, 2) ("storeCossCreateMemBuf: %s: creating new membuf at stripe %d, %lld (%p)\n", SD->path, stripe, (long long int) newmb->diskstart, newmb); + debug(79, 2) ("storeCossCreateMemBuf: %s: creating new membuf at stripe %d, %" PRId64 " (%p)\n", stripePath(SD), stripe, (int64_t) newmb->diskstart, newmb); newmb->diskend = newmb->diskstart + COSS_MEMBUF_SZ; newmb->flags.full = 0; newmb->flags.writing = 0; @@ -919,7 +941,7 @@ assert(newmb->diskend >= 0); /* Print out the list of membufs */ - debug(79, 3) ("storeCossCreateMemBuf: %s: membuflist:\n", SD->path); + debug(79, 3) ("storeCossCreateMemBuf: %s: membuflist:\n", stripePath(SD)); for (m = cs->membufs.head; m; m = m->next) { t = m->data; membuf_describe(t, 3, __LINE__); @@ -936,7 +958,7 @@ if (curfn > -1 && curfn == e->swap_filen) *collision = 1; /* Mark an object alloc collision */ assert((o >= newmb->diskstart) && (o < newmb->diskend)); - debug(79, 3) ("COSS: %s: stripe %d, releasing filen %d (offset %" PRINTF_OFF_T ")\n", SD->path, stripe, e->swap_filen, (squid_off_t) o); + debug(79, 3) ("COSS: %s: stripe %d, releasing filen %d (offset %" PRINTF_OFF_T ")\n", stripePath(SD), stripe, e->swap_filen, (squid_off_t) o); storeRelease(e); numreleased++; m = n; @@ -1063,10 +1085,10 @@ storeCossMemBufLockPending(pr, membuf); disk_offset = storeCossFilenoToDiskOffset(original_filen, cs); - debug(79, 3) ("COSS Pending Relocate: size %" PRINTF_OFF_T ", disk_offset %llu\n", (squid_off_t) sio->e->swap_file_sz, (long long int) disk_offset); + debug(79, 3) ("COSS Pending Relocate: size %" PRINTF_OFF_T ", disk_offset %" PRIu64 "\n", (squid_off_t) sio->e->swap_file_sz, (int64_t) disk_offset); #if USE_AUFSOPS /* NOTE: the damned buffer isn't passed into aioRead! */ - debug(79, 3) ("COSS: aioRead: FD %d, from %d -> %d, offset %llu, len: %ld\n", cs->fd, pr->original_filen, pr->new_filen, (long long int) disk_offset, (long int) pr->len); + debug(79, 3) ("COSS: aioRead: FD %d, from %d -> %d, offset %" PRIu64 ", len: %ld\n", cs->fd, pr->original_filen, pr->new_filen, (int64_t) disk_offset, (long int) pr->len); aioRead(cs->fd, (off_t) disk_offset, pr->len, storeCossCompletePendingReloc, pr); #else a_file_read(&cs->aq, cs->fd, @@ -1189,7 +1211,7 @@ /* Create entry */ op = memPoolAlloc(coss_op_pool); - debug(79, 3) ("COSS: Creating Read operation: %p: filen %d, offset %lld, size %lld\n", op, sio->swap_filen, (long long int) cstate->requestoffset, (long long int) cstate->requestlen); + debug(79, 3) ("COSS: Creating Read operation: %p: filen %d, offset %" PRId64 ", size %" PRId64 "\n", op, sio->swap_filen, (int64_t) cstate->requestoffset, (int64_t) cstate->requestlen); /* Fill in details */ op->type = COSS_OP_READ; diff -ruN squid-2.6.STABLE3/src/fs/diskd/store_dir_diskd.c squid-2.6.STABLE4/src/fs/diskd/store_dir_diskd.c --- squid-2.6.STABLE3/src/fs/diskd/store_dir_diskd.c Wed Aug 2 20:31:12 2006 +++ squid-2.6.STABLE4/src/fs/diskd/store_dir_diskd.c Thu Sep 21 18:51:43 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.c,v 1.83 2006/08/03 02:31:12 adrian Exp $ + * $Id: store_dir_diskd.c,v 1.85 2006/09/22 00:51:43 adrian Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -375,7 +375,7 @@ storeDiskdDirInit(SwapDir * sd) { static int started_clean_event = 0; - int x; + pid_t pid; int i; int ikey; const char *args[5]; @@ -426,13 +426,14 @@ args[2] = skey2; args[3] = skey3; args[4] = NULL; - x = ipcCreate(IPC_STREAM, + pid = ipcCreate(IPC_STREAM, Config.Program.diskd, args, "diskd", &diskdinfo->rfd, - &diskdinfo->wfd); - if (x < 0) + &diskdinfo->wfd, + &diskdinfo->hIpc); + if (pid < 0) fatalf("execl: %s", Config.Program.diskd); fd_note(diskdinfo->rfd, "diskd -> squid health monitor"); fd_note(diskdinfo->wfd, "squid -> diskd health monitor"); @@ -1810,7 +1811,7 @@ { diskdinfo_t *diskdinfo = SD->fsdata; /* Calculate the storedir load relative to magic2 on a scale of 0 .. 1000 */ - /* the parse function guarantees magic2 is positivie */ + /* the parse function guarantees magic2 is positive */ if (diskdinfo->away >= diskdinfo->magic1) return -1; return DISKD_LOAD_BASE + (diskdinfo->away * DISKD_LOAD_QUEUE_WEIGHT / diskdinfo->magic2); diff -ruN squid-2.6.STABLE3/src/fs/diskd/store_diskd.h squid-2.6.STABLE4/src/fs/diskd/store_diskd.h --- squid-2.6.STABLE3/src/fs/diskd/store_diskd.h Sun Jul 30 17:47:14 2006 +++ squid-2.6.STABLE4/src/fs/diskd/store_diskd.h Fri Sep 8 13:41:25 2006 @@ -25,6 +25,7 @@ int rmsgid; int rfd; int wfd; + void *hIpc; int away; struct { char *buf; diff -ruN squid-2.6.STABLE3/src/ftp.c squid-2.6.STABLE4/src/ftp.c --- squid-2.6.STABLE3/src/ftp.c Mon Jun 5 16:47:01 2006 +++ squid-2.6.STABLE4/src/ftp.c Mon Sep 18 17:03:36 2006 @@ -1,6 +1,6 @@ /* - * $Id: ftp.c,v 1.337 2006/06/05 22:47:01 hno Exp $ + * $Id: ftp.c,v 1.340 2006/09/18 23:03:36 hno Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -311,6 +311,7 @@ stringClean(&ftpState->title_url); stringClean(&ftpState->base_href); safe_free(ftpState->filepath); + safe_free(ftpState->dirpath); safe_free(ftpState->data.host); } @@ -1733,7 +1734,7 @@ int fd; struct sockaddr_in addr; socklen_t addr_len; - if (ftpState->request->method == METHOD_HEAD) { + if (ftpState->request->method == METHOD_HEAD && (ftpState->flags.isdir || ftpState->size != -1)) { /* Terminate here for HEAD requests */ ftpAppendSuccessHeader(ftpState); storeTimestampsSet(ftpState->entry); @@ -2456,30 +2457,30 @@ case SENT_PASS: if (ftpState->ctrl.replycode > 500) if (ftpState->password_url) - err = errorCon(ERR_FTP_FORBIDDEN, HTTP_FORBIDDEN); + err = errorCon(ERR_FTP_FORBIDDEN, HTTP_FORBIDDEN, ftpState->fwd->request); else - err = errorCon(ERR_FTP_FORBIDDEN, HTTP_UNAUTHORIZED); + err = errorCon(ERR_FTP_FORBIDDEN, HTTP_UNAUTHORIZED, ftpState->fwd->request); else if (ftpState->ctrl.replycode == 421) - err = errorCon(ERR_FTP_UNAVAILABLE, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_FTP_UNAVAILABLE, HTTP_SERVICE_UNAVAILABLE, ftpState->fwd->request); break; case SENT_CWD: case SENT_RETR: if (ftpState->ctrl.replycode == 550) - err = errorCon(ERR_FTP_NOT_FOUND, HTTP_NOT_FOUND); + err = errorCon(ERR_FTP_NOT_FOUND, HTTP_NOT_FOUND, ftpState->fwd->request); break; default: break; } break; case ERR_READ_TIMEOUT: - err = errorCon(error, HTTP_GATEWAY_TIMEOUT); + err = errorCon(error, HTTP_GATEWAY_TIMEOUT, ftpState->fwd->request); break; default: - err = errorCon(error, HTTP_BAD_GATEWAY); + err = errorCon(error, HTTP_BAD_GATEWAY, ftpState->fwd->request); break; } if (err == NULL) - err = errorCon(ERR_FTP_FAILURE, HTTP_BAD_GATEWAY); + err = errorCon(ERR_FTP_FAILURE, HTTP_BAD_GATEWAY, ftpState->fwd->request); err->xerrno = errno; err->ftp.server_msg = ftpState->ctrl.message; ftpState->ctrl.message = NULL; @@ -2521,8 +2522,7 @@ err_code = ERR_FTP_PUT_ERROR; http_code = HTTP_INTERNAL_SERVER_ERROR; } - err = errorCon(err_code, http_code); - err->request = requestLink(ftpState->request); + err = errorCon(err_code, http_code, ftpState->request); if (ftpState->old_request) err->ftp.request = xstrdup(ftpState->old_request); else @@ -2611,9 +2611,8 @@ static HttpReply * ftpAuthRequired(request_t * request, const char *realm) { - ErrorState *err = errorCon(ERR_CACHE_ACCESS_DENIED, HTTP_UNAUTHORIZED); + ErrorState *err = errorCon(ERR_CACHE_ACCESS_DENIED, HTTP_UNAUTHORIZED, request); HttpReply *rep; - err->request = requestLink(request); rep = errorBuildReply(err); errorStateFree(err); /* add Authenticate header */ diff -ruN squid-2.6.STABLE3/src/gopher.c squid-2.6.STABLE4/src/gopher.c --- squid-2.6.STABLE3/src/gopher.c Mon May 15 17:43:07 2006 +++ squid-2.6.STABLE4/src/gopher.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: gopher.c,v 1.177 2006/05/15 23:43:07 hno Exp $ + * $Id: gopher.c,v 1.178 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -604,7 +604,7 @@ StoreEntry *entry = gopherState->entry; debug(10, 4) ("gopherTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); fwdFail(gopherState->fwdState, - errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); + errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT, gopherState->fwdState->request)); comm_close(fd); } @@ -658,13 +658,13 @@ commSetSelect(fd, COMM_SELECT_READ, gopherReadReply, data, 0); } else { ErrorState *err; - err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR); + err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR, gopherState->fwdState->request); err->xerrno = errno; fwdFail(gopherState->fwdState, err); comm_close(fd); } } else if (len == 0 && entry->mem_obj->inmem_hi == 0) { - fwdFail(gopherState->fwdState, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE)); + fwdFail(gopherState->fwdState, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE, gopherState->fwdState->request)); comm_close(fd); } else if (len == 0) { /* Connection closed; retrieval done. */ @@ -706,7 +706,7 @@ } if (errflag) { ErrorState *err; - err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY); + err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY, gopherState->fwdState->request); err->xerrno = errno; err->url = xstrdup(storeUrl(entry)); fwdFail(gopherState->fwdState, err); diff -ruN squid-2.6.STABLE3/src/helper.c squid-2.6.STABLE4/src/helper.c --- squid-2.6.STABLE3/src/helper.c Sun Jul 9 09:44:32 2006 +++ squid-2.6.STABLE4/src/helper.c Fri Sep 8 13:41:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: helper.c,v 1.61 2006/07/09 15:44:32 serassio Exp $ + * $Id: helper.c,v 1.62 2006/09/08 19:41:24 serassio Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Harvest Derived? @@ -66,10 +66,12 @@ helper_server *srv; int nargs = 0; int k; - int x; + pid_t pid; int rfd; int wfd; wordlist *w; + void *hIpc; + if (hlp->cmdline == NULL) return; progname = hlp->cmdline->key; @@ -89,20 +91,22 @@ for (k = 0; k < hlp->n_to_start; k++) { getCurrentTime(); rfd = wfd = -1; - x = ipcCreate(hlp->ipc_type, + pid = ipcCreate(hlp->ipc_type, progname, args, shortname, &rfd, - &wfd); - if (x < 0) { + &wfd, + &hIpc); + if (pid < 0) { debug(84, 1) ("WARNING: Cannot run '%s' process.\n", progname); continue; } hlp->n_running++; hlp->n_active++; srv = cbdataAlloc(helper_server); - srv->pid = x; + srv->hIpc = hIpc; + srv->pid = pid; srv->index = k; srv->rfd = rfd; srv->wfd = wfd; @@ -145,10 +149,12 @@ helper_stateful_server *srv; int nargs = 0; int k; - int x; + pid_t pid; int rfd; int wfd; wordlist *w; + void *hIpc; + if (hlp->cmdline == NULL) return; progname = hlp->cmdline->key; @@ -168,20 +174,22 @@ for (k = 0; k < hlp->n_to_start; k++) { getCurrentTime(); rfd = wfd = -1; - x = ipcCreate(hlp->ipc_type, + pid = ipcCreate(hlp->ipc_type, progname, args, shortname, &rfd, - &wfd); - if (x < 0) { + &wfd, + &hIpc); + if (pid < 0) { debug(84, 1) ("WARNING: Cannot run '%s' process.\n", progname); continue; } hlp->n_running++; hlp->n_active++; srv = cbdataAlloc(helper_stateful_server); - srv->pid = x; + srv->hIpc = hIpc; + srv->pid = pid; srv->flags.reserved = 0; srv->stats.submits = 0; srv->index = k; @@ -439,6 +447,11 @@ helperShutdown(helper * hlp) { dlink_node *link = hlp->servers.head; +#ifdef _SQUID_MSWIN_ + HANDLE hIpc; + pid_t pid; + int no; +#endif while (link) { int wfd; helper_server *srv; @@ -468,9 +481,26 @@ continue; } srv->flags.closing = 1; +#ifdef _SQUID_MSWIN_ + hIpc = srv->hIpc; + pid = srv->pid; + no = srv->index + 1; + shutdown(srv->wfd, SD_BOTH); +#endif wfd = srv->wfd; srv->wfd = -1; comm_close(wfd); +#ifdef _SQUID_MSWIN_ + if (hIpc) { + if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { + getCurrentTime(); + debug(84, 1) ("helperShutdown: WARNING: %s #%d (%s,%ld) " + "didn't exit in 5 seconds\n", + hlp->id_name, no, hlp->cmdline->key, (long int) pid); + } + CloseHandle(hIpc); + } +#endif } } @@ -479,6 +509,11 @@ { dlink_node *link = hlp->servers.head; helper_stateful_server *srv; +#ifdef _SQUID_MSWIN_ + HANDLE hIpc; + pid_t pid; + int no; +#endif int wfd; while (link) { srv = link->data; @@ -507,9 +542,26 @@ continue; } srv->flags.closing = 1; +#ifdef _SQUID_MSWIN_ + hIpc = srv->hIpc; + pid = srv->pid; + no = srv->index + 1; + shutdown(srv->wfd, SD_BOTH); +#endif wfd = srv->wfd; srv->wfd = -1; comm_close(wfd); +#ifdef _SQUID_MSWIN_ + if (hIpc) { + if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { + getCurrentTime(); + debug(84, 1) ("helperShutdown: WARNING: %s #%d (%s,%ld) " + "didn't exit in 5 seconds\n", + hlp->id_name, no, hlp->cmdline->key, (long int) pid); + } + CloseHandle(hIpc); + } +#endif } } diff -ruN squid-2.6.STABLE3/src/http.c squid-2.6.STABLE4/src/http.c --- squid-2.6.STABLE3/src/http.c Wed Jul 26 14:09:33 2006 +++ squid-2.6.STABLE4/src/http.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.416 2006/07/26 20:09:33 hno Exp $ + * $Id: http.c,v 1.417 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -101,7 +101,7 @@ debug(11, 4) ("httpTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); if (entry->store_status == STORE_PENDING) { fwdFail(httpState->fwd, - errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); + errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT, httpState->fwd->request)); } comm_close(fd); } @@ -681,13 +681,13 @@ commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0); } else { ErrorState *err; - err = errorCon(ERR_READ_ERROR, HTTP_BAD_GATEWAY); + err = errorCon(ERR_READ_ERROR, HTTP_BAD_GATEWAY, httpState->fwd->request); err->xerrno = errno; fwdFail(httpState->fwd, err); comm_close(fd); } } else if (len == 0 && entry->mem_obj->inmem_hi == 0) { - fwdFail(httpState->fwd, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_BAD_GATEWAY)); + fwdFail(httpState->fwd, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_BAD_GATEWAY, httpState->fwd->request)); httpState->eof = 1; comm_close(fd); } else if (len == 0) { @@ -703,11 +703,11 @@ httpProcessReplyHeader(httpState, buf, len); if (entry->mem_obj->reply->sline.status == HTTP_HEADER_TOO_LARGE) { storeEntryReset(entry); - fwdFail(httpState->fwd, errorCon(ERR_TOO_BIG, HTTP_BAD_GATEWAY)); + fwdFail(httpState->fwd, errorCon(ERR_TOO_BIG, HTTP_BAD_GATEWAY, httpState->fwd->request)); httpState->fwd->flags.dont_retry = 1; } else if (entry->mem_obj->reply->sline.status == HTTP_INVALID_HEADER && !(entry->mem_obj->reply->sline.version.major == 0 && entry->mem_obj->reply->sline.version.minor == 9)) { storeEntryReset(entry); - fwdFail(httpState->fwd, errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY)); + fwdFail(httpState->fwd, errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY, httpState->fwd->request)); httpState->fwd->flags.dont_retry = 1; } else { fwdComplete(httpState->fwd); @@ -722,14 +722,14 @@ if (s == HTTP_HEADER_TOO_LARGE) { debug(11, 1) ("WARNING: %s:%d: HTTP header too large\n", __FILE__, __LINE__); storeEntryReset(entry); - fwdFail(httpState->fwd, errorCon(ERR_TOO_BIG, HTTP_BAD_GATEWAY)); + fwdFail(httpState->fwd, errorCon(ERR_TOO_BIG, HTTP_BAD_GATEWAY, httpState->fwd->request)); httpState->fwd->flags.dont_retry = 1; comm_close(fd); return; } if (s == HTTP_INVALID_HEADER && !(entry->mem_obj->reply->sline.version.major == 0 && entry->mem_obj->reply->sline.version.minor == 9)) { storeEntryReset(entry); - fwdFail(httpState->fwd, errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY)); + fwdFail(httpState->fwd, errorCon(ERR_INVALID_RESP, HTTP_BAD_GATEWAY, httpState->fwd->request)); httpState->fwd->flags.dont_retry = 1; comm_close(fd); return; @@ -882,7 +882,7 @@ return; if (errflag) { ErrorState *err; - err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY); + err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY, httpState->fwd->request); err->xerrno = errno; fwdFail(httpState->fwd, err); comm_close(fd); @@ -1455,7 +1455,7 @@ return; if (errflag) { ErrorState *err; - err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY); + err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY, httpState->fwd->request); err->xerrno = errno; fwdFail(httpState->fwd, err); comm_close(fd); diff -ruN squid-2.6.STABLE3/src/icmp.c squid-2.6.STABLE4/src/icmp.c --- squid-2.6.STABLE3/src/icmp.c Mon May 22 13:01:32 2006 +++ squid-2.6.STABLE4/src/icmp.c Fri Sep 8 13:41:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: icmp.c,v 1.80 2006/05/22 19:01:32 serassio Exp $ + * $Id: icmp.c,v 1.81 2006/09/08 19:41:24 serassio Exp $ * * DEBUG: section 37 ICMP Routines * AUTHOR: Duane Wessels @@ -50,6 +50,9 @@ static void icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf); #endif +static void *hIpc; +static pid_t pid; + static void icmpSendEcho(struct in_addr to, int opcode, const char *payload, int len) { @@ -183,18 +186,18 @@ { #if USE_ICMP const char *args[2]; - int x; int rfd; int wfd; args[0] = "(pinger)"; args[1] = NULL; - x = ipcCreate(IPC_DGRAM, + pid = ipcCreate(IPC_DGRAM, Config.Program.pinger, args, "Pinger Socket", &rfd, - &wfd); - if (x < 0) + &wfd, + &hIpc); + if (pid < 0) return; assert(rfd == wfd); icmp_sock = rfd; @@ -212,7 +215,21 @@ if (icmp_sock < 0) return; debug(37, 1) ("Closing Pinger socket on FD %d\n", icmp_sock); +#ifdef _SQUID_MSWIN_ + send(icmp_sock, "$shutdown\n", 10, 0); +#endif comm_close(icmp_sock); +#ifdef _SQUID_MSWIN_ + if (hIpc) { + if (WaitForSingleObject(hIpc, 12000) != WAIT_OBJECT_0) { + getCurrentTime(); + debug(37, 1) + ("icmpClose: WARNING: (pinger,%ld) didn't exit in 12 seconds\n", + (long int) pid); + } + CloseHandle(hIpc); + } +#endif icmp_sock = -1; #endif } diff -ruN squid-2.6.STABLE3/src/internal.c squid-2.6.STABLE4/src/internal.c --- squid-2.6.STABLE3/src/internal.c Sun May 28 16:24:51 2006 +++ squid-2.6.STABLE4/src/internal.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: internal.c,v 1.31 2006/05/28 22:24:51 hno Exp $ + * $Id: internal.c,v 1.32 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -70,8 +70,7 @@ } else { debugObj(76, 1, "internalStart: unknown request:\n", request, (ObjPackMethod) & httpRequestPackDebug); - err = errorCon(ERR_INVALID_REQ, HTTP_NOT_FOUND); - err->request = requestLink(request); + err = errorCon(ERR_INVALID_REQ, HTTP_NOT_FOUND, request); errorAppendEntry(entry, err); } } diff -ruN squid-2.6.STABLE3/src/ipc.c squid-2.6.STABLE4/src/ipc.c --- squid-2.6.STABLE3/src/ipc.c Sun Jul 30 17:27:03 2006 +++ squid-2.6.STABLE4/src/ipc.c Fri Sep 8 13:41:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: ipc.c,v 1.38 2006/07/30 23:27:03 hno Exp $ + * $Id: ipc.c,v 1.39 2006/09/08 19:41:24 serassio Exp $ * * DEBUG: section 54 Interprocess Communication * AUTHOR: Duane Wessels @@ -55,8 +55,8 @@ return -1; } -int -ipcCreate(int type, const char *prog, const char *const args[], const char *name, int *rfd, int *wfd) +pid_t +ipcCreate(int type, const char *prog, const char *const args[], const char *name, int *rfd, int *wfd, void **hIpc) { pid_t pid; struct sockaddr_in CS; @@ -84,6 +84,9 @@ *rfd = -1; if (wfd) *wfd = -1; + if (hIpc) + *hIpc = NULL; + if (type == IPC_TCP_SOCKET) { crfd = cwfd = comm_open(SOCK_STREAM, IPPROTO_TCP, diff -ruN squid-2.6.STABLE3/src/ipc_win32.c squid-2.6.STABLE4/src/ipc_win32.c --- squid-2.6.STABLE3/src/ipc_win32.c Wed Dec 31 17:00:00 1969 +++ squid-2.6.STABLE4/src/ipc_win32.c Sat Sep 9 09:41:45 2006 @@ -0,0 +1,747 @@ + +/* + * $Id: ipc_win32.c,v 1.3 2006/09/09 15:41:45 serassio Exp $ + * + * DEBUG: section 54 Windows Interprocess Communication + * AUTHOR: Andrey Shorin + * AUTHOR: Guido Serassio + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#include "squid.h" + +#ifndef _MSWSOCK_ +#include +#endif +#include + +struct ipc_params { + int type; + int crfd; + int cwfd; + struct sockaddr_in PS; + const char *prog; + char **args; +}; + +struct thread_params { + int type; + int rfd; + int send_fd; + const char *prog; + pid_t pid; +}; + +static unsigned int __stdcall ipc_thread_1(void *params); +static unsigned int __stdcall ipc_thread_2(void *params); + +static const char *ok_string = "OK\n"; +static const char *err_string = "ERR\n"; +static const char *shutdown_string = "$shutdown\n"; + +static const char *hello_string = "hi there\n"; +#define HELLO_BUF_SZ 32 +static char hello_buf[HELLO_BUF_SZ]; + +static int +ipcCloseAllFD(int prfd, int pwfd, int crfd, int cwfd) +{ + if (prfd >= 0) + comm_close(prfd); + if (prfd != pwfd) + if (pwfd >= 0) + comm_close(pwfd); + if (crfd >= 0) + comm_close(crfd); + if (crfd != cwfd) + if (cwfd >= 0) + comm_close(cwfd); + return -1; +} + +pid_t +ipcCreate(int type, const char *prog, const char *const args[], const char *name, int *rfd, int *wfd, void **hIpc) +{ + unsigned long thread; + struct ipc_params params; + int opt; + int optlen = sizeof(opt); + DWORD ecode = 0; + pid_t pid; + struct sockaddr_in CS; + struct sockaddr_in PS; + int crfd = -1; + int prfd = -1; + int cwfd = -1; + int pwfd = -1; + socklen_t len; + int x; + + requirePathnameExists(name, prog); + + if (rfd) + *rfd = -1; + if (wfd) + *wfd = -1; + if (hIpc) + *hIpc = NULL; + + if (WIN32_OS_version != _WIN_OS_WINNT) { + getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, &optlen); + opt = opt & ~(SO_SYNCHRONOUS_NONALERT | SO_SYNCHRONOUS_ALERT); + setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, sizeof(opt)); + } + if (type == IPC_TCP_SOCKET) { + crfd = cwfd = comm_open(SOCK_STREAM, + IPPROTO_TCP, + local_addr, + 0, + COMM_NOCLOEXEC, + name); + prfd = pwfd = comm_open(SOCK_STREAM, + IPPROTO_TCP, /* protocol */ + local_addr, + 0, /* port */ + 0, /* blocking */ + name); + } else if (type == IPC_UDP_SOCKET) { + crfd = cwfd = comm_open(SOCK_DGRAM, + IPPROTO_UDP, + local_addr, + 0, + COMM_NOCLOEXEC, + name); + prfd = pwfd = comm_open(SOCK_DGRAM, + IPPROTO_UDP, + local_addr, + 0, + 0, + name); + } else if (type == IPC_FIFO) { + debug(54, 0) + ("ipcCreate: %s: use IPC_TCP_SOCKET instead of IP_FIFO on Windows\n", + prog); + assert(0); + } else { + assert(IPC_NONE); + } + debug(54, 3) ("ipcCreate: prfd FD %d\n", prfd); + debug(54, 3) ("ipcCreate: pwfd FD %d\n", pwfd); + debug(54, 3) ("ipcCreate: crfd FD %d\n", crfd); + debug(54, 3) ("ipcCreate: cwfd FD %d\n", cwfd); + + if (WIN32_OS_version != _WIN_OS_WINNT) { + getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, &optlen); + opt = opt | SO_SYNCHRONOUS_NONALERT; + setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, optlen); + } + if (crfd < 0) { + debug(54, 0) ("ipcCreate: Failed to create child FD.\n"); + return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); + } + if (pwfd < 0) { + debug(54, 0) ("ipcCreate: Failed to create server FD.\n"); + return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); + } + if (type == IPC_TCP_SOCKET || type == IPC_UDP_SOCKET) { + len = sizeof(PS); + memset(&PS, '\0', len); + if (getsockname(pwfd, (struct sockaddr *) &PS, &len) < 0) { + debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror()); + return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); + } + debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n", + pwfd, inet_ntoa(PS.sin_addr), ntohs(PS.sin_port)); + len = sizeof(CS); + memset(&CS, '\0', len); + if (getsockname(crfd, (struct sockaddr *) &CS, &len) < 0) { + debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror()); + return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); + } + debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n", + crfd, inet_ntoa(CS.sin_addr), ntohs(CS.sin_port)); + } + if (type == IPC_TCP_SOCKET) { + if (listen(crfd, 1) < 0) { + debug(54, 1) ("ipcCreate: listen FD %d: %s\n", crfd, xstrerror()); + return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); + } + debug(54, 3) ("ipcCreate: FD %d listening...\n", crfd); + } + /* flush or else we get dup data if unbuffered_logs is set */ + logsFlush(); + params.type = type; + params.crfd = crfd; + params.cwfd = cwfd; + params.PS = PS; + params.prog = prog; + params.args = (char **) args; + + thread = _beginthreadex(NULL, 0, ipc_thread_1, ¶ms, 0, NULL); + + if (thread == 0) { + debug(54, 1) ("ipcCreate: _beginthread: %s\n", xstrerror()); + return ipcCloseAllFD(prfd, pwfd, crfd, cwfd); + } + if (comm_connect_addr(pwfd, &CS) == COMM_ERROR) { + CloseHandle((HANDLE) thread); + return ipcCloseAllFD(prfd, pwfd, -1, -1); + } + memset(hello_buf, '\0', HELLO_BUF_SZ); + x = recv(prfd, hello_buf, HELLO_BUF_SZ - 1, 0); + + if (x < 0) { + debug(54, 0) ("ipcCreate: PARENT: hello read test failed\n"); + debug(54, 0) ("--> read: %s\n", xstrerror()); + CloseHandle((HANDLE) thread); + return ipcCloseAllFD(prfd, pwfd, -1, -1); + } else if (strcmp(hello_buf, hello_string)) { + debug(54, 0) ("ipcCreate: PARENT: hello read test failed\n"); + debug(54, 0) ("--> read returned %d\n", x); + debug(54, 0) ("--> got '%s'\n", rfc1738_escape(hello_buf)); + CloseHandle((HANDLE) thread); + return ipcCloseAllFD(prfd, pwfd, -1, -1); + } + x = send(pwfd, ok_string, strlen(ok_string), 0); + + if (x < 0) { + debug(54, 0) ("ipcCreate: PARENT: OK write test failed\n"); + debug(54, 0) ("--> read: %s\n", xstrerror()); + CloseHandle((HANDLE) thread); + return ipcCloseAllFD(prfd, pwfd, -1, -1); + } + memset(hello_buf, '\0', HELLO_BUF_SZ); + x = recv(prfd, hello_buf, HELLO_BUF_SZ - 1, 0); + + if (x < 0) { + debug(54, 0) ("ipcCreate: PARENT: OK read test failed\n"); + debug(54, 0) ("--> read: %s\n", xstrerror()); + CloseHandle((HANDLE) thread); + return ipcCloseAllFD(prfd, pwfd, -1, -1); + } else if (!strcmp(hello_buf, err_string)) { + debug(54, 0) ("ipcCreate: PARENT: OK read test failed\n"); + debug(54, 0) ("--> read returned %d\n", x); + debug(54, 0) ("--> got '%s'\n", rfc1738_escape(hello_buf)); + CloseHandle((HANDLE) thread); + return ipcCloseAllFD(prfd, pwfd, -1, -1); + } + hello_buf[x] = '\0'; + pid = atol(hello_buf); + commSetTimeout(prfd, -1, NULL, NULL); + commSetNonBlocking(prfd); + commSetNonBlocking(pwfd); + commSetCloseOnExec(prfd); + commSetCloseOnExec(pwfd); + + if (rfd) + *rfd = prfd; + if (wfd) + *wfd = pwfd; + + fd_table[prfd].flags.ipc = 1; + fd_table[pwfd].flags.ipc = 1; + fd_table[crfd].flags.ipc = 1; + fd_table[cwfd].flags.ipc = 1; + + if (Config.sleep_after_fork) { + /* XXX emulation of usleep() */ + DWORD sl; + sl = Config.sleep_after_fork / 1000; + if (sl == 0) + sl = 1; + Sleep(sl); + } + if (GetExitCodeThread((HANDLE) thread, &ecode) && ecode == STILL_ACTIVE) { + if (hIpc) + *hIpc = (HANDLE) thread; + return pid; + } else { + CloseHandle((HANDLE) thread); + return ipcCloseAllFD(prfd, pwfd, -1, -1); + } +} + +static int +ipcSend(int cwfd, const char *buf, int len) +{ + int x; + + x = send(cwfd, buf, len, 0); + + if (x < 0) { + debug(54, 0) ("sendto FD %d: %s\n", cwfd, xstrerror()); + debug(54, 0) ("ipcCreate: CHILD: hello write test failed\n"); + } + return x; +} + +static unsigned int __stdcall +ipc_thread_1(void *in_params) +{ + int t1, t2, t3, retval = -1; + int p2c[2] = + {-1, -1}; + int c2p[2] = + {-1, -1}; + HANDLE hProcess = NULL, thread = NULL; + pid_t pid = -1; + struct thread_params thread_params; + int x, tmp_s, fd = -1; + char *str; +#if HAVE_PUTENV + char *env_str = NULL; +#endif + STARTUPINFO si; + PROCESS_INFORMATION pi; + long F; + int prfd_ipc = -1, pwfd_ipc = -1, crfd_ipc = -1, cwfd_ipc = -1; + char *prog = NULL, *buf1 = NULL; + struct sockaddr_in CS_ipc, PS_ipc; + + struct ipc_params *params = (struct ipc_params *) in_params; + int type = params->type; + int crfd = params->crfd; + int cwfd = params->cwfd; + char **args = params->args; + struct sockaddr_in PS = params->PS; + + + buf1 = xcalloc(1, 8192); + strcpy(buf1, params->prog); + prog = strtok(buf1, w_space); + + if ((str = strrchr(prog, '/'))) + prog = ++str; + if ((str = strrchr(prog, '\\'))) + prog = ++str; + + prog = xstrdup(prog); + + if (type == IPC_TCP_SOCKET) { + debug(54, 3) ("ipcCreate: calling accept on FD %d\n", crfd); + if ((fd = accept(crfd, NULL, NULL)) < 0) { + debug(54, 0) ("ipcCreate: FD %d accept: %s\n", crfd, xstrerror()); + goto cleanup; + } + debug(54, 3) ("ipcCreate: CHILD accepted new FD %d\n", fd); + comm_close(crfd); + snprintf(buf1, 8191, "%s CHILD socket", prog); + fd_open(fd, FD_SOCKET, buf1); + fd_table[fd].flags.ipc = 1; + cwfd = crfd = fd; + } else if (type == IPC_UDP_SOCKET) { + if (comm_connect_addr(crfd, &PS) == COMM_ERROR) + goto cleanup; + } + x = send(cwfd, hello_string, strlen(hello_string) + 1, 0); + + if (x < 0) { + debug(54, 0) ("sendto FD %d: %s\n", cwfd, xstrerror()); + debug(54, 0) ("ipcCreate: CHILD: hello write test failed\n"); + goto cleanup; + } +#if HAVE_PUTENV + env_str = xcalloc((tmp_s = strlen(Config.debugOptions) + 32), 1); + snprintf(env_str, tmp_s, "SQUID_DEBUG=%s", Config.debugOptions); + putenv(env_str); +#endif + memset(buf1, '\0', sizeof(buf1)); + x = recv(crfd, buf1, 8191, 0); + + if (x < 0) { + debug(54, 0) ("ipcCreate: CHILD: OK read test failed\n"); + debug(54, 0) ("--> read: %s\n", xstrerror()); + goto cleanup; + } else if (strcmp(buf1, ok_string)) { + debug(54, 0) ("ipcCreate: CHILD: OK read test failed\n"); + debug(54, 0) ("--> read returned %d\n", x); + debug(54, 0) ("--> got '%s'\n", rfc1738_escape(hello_buf)); + goto cleanup; + } + /* assign file descriptors to child process */ + if (_pipe(p2c, 1024, _O_BINARY | _O_NOINHERIT) < 0) { + debug(54, 0) ("ipcCreate: CHILD: pipe: %s\n", xstrerror()); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + if (_pipe(c2p, 1024, _O_BINARY | _O_NOINHERIT) < 0) { + debug(54, 0) ("ipcCreate: CHILD: pipe: %s\n", xstrerror()); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + if (type == IPC_UDP_SOCKET) { + snprintf(buf1, 8192, "%s(%ld) <-> ipc CHILD socket", prog, -1L); + crfd_ipc = cwfd_ipc = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, 0, buf1); + + if (crfd_ipc < 0) { + debug(54, 0) ("ipcCreate: CHILD: Failed to create child FD for %s.\n", + prog); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + snprintf(buf1, 8192, "%s(%ld) <-> ipc PARENT socket", prog, -1L); + prfd_ipc = pwfd_ipc = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, 0, buf1); + if (pwfd_ipc < 0) { + debug(54, 0) ("ipcCreate: CHILD: Failed to create server FD for %s.\n", + prog); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + tmp_s = sizeof(PS_ipc); + memset(&PS_ipc, '\0', tmp_s); + if (getsockname(pwfd_ipc, (struct sockaddr *) &PS_ipc, &tmp_s) < 0) { + debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror()); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n", + pwfd_ipc, inet_ntoa(PS_ipc.sin_addr), ntohs(PS_ipc.sin_port)); + tmp_s = sizeof(CS_ipc); + memset(&CS_ipc, '\0', tmp_s); + if (getsockname(crfd_ipc, (struct sockaddr *) &CS_ipc, &tmp_s) < 0) { + debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror()); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n", + crfd_ipc, inet_ntoa(CS_ipc.sin_addr), ntohs(CS_ipc.sin_port)); + + if (comm_connect_addr(pwfd_ipc, &CS_ipc) == COMM_ERROR) { + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + fd = crfd; + + if (comm_connect_addr(crfd_ipc, &PS_ipc) == COMM_ERROR) { + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + } /* IPC_UDP_SOCKET */ + t1 = dup(0); + t2 = dup(1); + t3 = dup(2); + dup2(c2p[0], 0); + dup2(p2c[1], 1); + dup2(fileno(debug_log), 2); + close(c2p[0]); + close(p2c[1]); + + commUnsetNonBlocking(fd); + + memset(&si, 0, sizeof(STARTUPINFO)); + si.cb = sizeof(STARTUPINFO); + si.hStdInput = (HANDLE) _get_osfhandle(0); + si.hStdOutput = (HANDLE) _get_osfhandle(1); + si.hStdError = (HANDLE) _get_osfhandle(2); + si.dwFlags = STARTF_USESTDHANDLES; + + /* Make sure all other valid handles are not inerithable */ + for (x = 3; x < Squid_MaxFD; x++) { + if ((F = _get_osfhandle(x)) == -1) + continue; + SetHandleInformation((HANDLE) F, HANDLE_FLAG_INHERIT, 0); + } + + *buf1 = '\0'; + strcpy(buf1 + 4096, params->prog); + str = strtok(buf1 + 4096, w_space); + + do { + strcat(buf1, str); + strcat(buf1, " "); + } while ((str = strtok(NULL, w_space))); + + x = 1; + + while (args[x]) { + strcat(buf1, args[x++]); + strcat(buf1, " "); + } + + if (CreateProcess(buf1 + 4096, buf1, NULL, NULL, TRUE, CREATE_NO_WINDOW, + NULL, NULL, &si, &pi)) { + pid = pi.dwProcessId; + hProcess = pi.hProcess; + } else { + pid = -1; + WIN32_maperror(GetLastError()); + x = errno; + } + + dup2(t1, 0); + dup2(t2, 1); + dup2(t3, 2); + close(t1); + close(t2); + close(t3); + + if (pid == -1) { + errno = x; + debug(54, 0) ("ipcCreate: CHILD: %s: %s\n", params->prog, xstrerror()); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + if (type == IPC_UDP_SOCKET) { + WSAPROTOCOL_INFO wpi; + + memset(&wpi, 0, sizeof(wpi)); + if (SOCKET_ERROR == WSADuplicateSocket(crfd_ipc, pid, &wpi)) { + debug(54, 0) ("ipcCreate: CHILD: WSADuplicateSocket: %s\n", + xstrerror()); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + x = write(c2p[1], (const char *) &wpi, sizeof(wpi)); + if (x < sizeof(wpi)) { + debug(54, 0) ("ipcCreate: CHILD: write FD %d: %s\n", c2p[1], + xstrerror()); + debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n", + prog); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + x = read(p2c[0], buf1, 8192); + if (x < 0) { + debug(54, 0) ("ipcCreate: CHILD: read FD %d: %s\n", p2c[0], + xstrerror()); + debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n", + prog); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } else if (strncmp(buf1, ok_string, strlen(ok_string))) { + debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n", + prog); + debug(54, 0) ("--> read returned %d\n", x); + buf1[x] = '\0'; + debug(54, 0) ("--> got '%s'\n", rfc1738_escape(buf1)); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + x = write(c2p[1], (const char *) &PS_ipc, sizeof(PS_ipc)); + if (x < sizeof(PS_ipc)) { + debug(54, 0) ("ipcCreate: CHILD: write FD %d: %s\n", c2p[1], + xstrerror()); + debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n", + prog); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + x = read(p2c[0], buf1, 8192); + if (x < 0) { + debug(54, 0) ("ipcCreate: CHILD: read FD %d: %s\n", p2c[0], + xstrerror()); + debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n", + prog); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } else if (strncmp(buf1, ok_string, strlen(ok_string))) { + debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n", + prog); + debug(54, 0) ("--> read returned %d\n", x); + buf1[x] = '\0'; + debug(54, 0) ("--> got '%s'\n", rfc1738_escape(buf1)); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + x = send(pwfd_ipc, ok_string, strlen(ok_string), 0); + x = recv(prfd_ipc, buf1 + 200, 8191 - 200, 0); + assert((size_t) x == strlen(ok_string) + && !strncmp(ok_string, buf1 + 200, strlen(ok_string))); + } /* IPC_UDP_SOCKET */ + snprintf(buf1, 8191, "%s(%ld) CHILD socket", prog, (long int) pid); + fd_note(fd, buf1); + + if (prfd_ipc != -1) { + snprintf(buf1, 8191, "%s(%ld) <-> ipc CHILD socket", prog, (long int) pid); + fd_note(crfd_ipc, buf1); + snprintf(buf1, 8191, "%s(%ld) <-> ipc PARENT socket", prog, (long int) pid); + fd_note(prfd_ipc, buf1); + } + /* else { IPC_TCP_SOCKET */ + /* commSetNoLinger(fd); */ + /* } */ + thread_params.prog = prog; + thread_params.send_fd = cwfd; + thread_params.pid = pid; + + if ((thread_params.type = type) == IPC_TCP_SOCKET) + thread_params.rfd = p2c[0]; + else + thread_params.rfd = prfd_ipc; + + thread = + (HANDLE) _beginthreadex(NULL, 0, ipc_thread_2, &thread_params, 0, NULL); + + if (!thread) { + debug(54, 0) ("ipcCreate: CHILD: _beginthreadex: %s\n", xstrerror()); + ipcSend(cwfd, err_string, strlen(err_string)); + goto cleanup; + } + snprintf(buf1, 8191, "%ld\n", (long int) pid); + + if (-1 == ipcSend(cwfd, buf1, strlen(buf1))) + goto cleanup; + + debug(54, 2) ("ipc(%s,%ld): started successfully\n", prog, (long int) pid); + + /* cycle */ + for (;;) { + x = recv(crfd, buf1, 8192, 0); + if (x <= 0) { + debug(54, 3) ("ipc(%s,%d): %d bytes received from parent. Exiting...\n", + prog, pid, x); + break; + } + buf1[x] = '\0'; + if (type == IPC_UDP_SOCKET && !strcmp(buf1, shutdown_string)) { + debug(54, 3) + ("ipc(%s,%d): request for shutdown received from parent. Exiting...\n", + prog, pid); + TerminateProcess(hProcess, 0); + break; + } + debug(54, 5) ("ipc(%s,%d): received from parent: %s\n", prog, pid, + rfc1738_escape_unescaped(buf1)); + if (type == IPC_TCP_SOCKET) + x = write(c2p[1], buf1, x); + else + x = send(pwfd_ipc, buf1, x, 0); + if (x <= 0) { + debug(54, 3) ("ipc(%s,%d): %d bytes written to %s. Exiting...\n", + prog, pid, x, prog); + break; + } + } + + retval = 0; + + cleanup: + if (c2p[1] != -1) + close(c2p[1]); + + if (fd_table[crfd].flags.open) + ipcCloseAllFD(-1, -1, crfd, cwfd); + + if (prfd_ipc != -1) { + send(crfd_ipc, shutdown_string, strlen(shutdown_string), 0); + shutdown(crfd_ipc, SD_BOTH); + shutdown(prfd_ipc, SD_BOTH); + } + ipcCloseAllFD(prfd_ipc, pwfd_ipc, crfd_ipc, cwfd_ipc); + + if (hProcess && WAIT_OBJECT_0 != + WaitForSingleObject(hProcess, type == IPC_UDP_SOCKET ? 12000 : 5000)) { + + getCurrentTime(); + debug(54, 0) ("ipc(%s,%d): WARNING: %s didn't exit in %d seconds.\n", + prog, pid, prog, type == IPC_UDP_SOCKET ? 12 : 5); + } + if (thread && WAIT_OBJECT_0 != WaitForSingleObject(thread, 3000)) { + getCurrentTime(); + debug(54, 0) + ("ipc(%s,%d): WARNING: ipc_thread_2 didn't exit in 3 seconds.\n", + prog, pid); + } + getCurrentTime(); + + if (!retval) + debug(54, 2) ("ipc(%s,%d): normal exit\n", prog, pid); + + if (buf1) + xfree(buf1); + + if (prog) + xfree(prog); + + if (env_str) + xfree(env_str); + + if (thread) + CloseHandle(thread); + + if (hProcess) + CloseHandle(hProcess); + + if (p2c[0] != -1) + close(p2c[0]); + + return retval; +} + +static unsigned int __stdcall +ipc_thread_2(void *in_params) +{ + int x; + struct thread_params *params = (struct thread_params *) in_params; + int type = params->type; + int rfd = params->rfd; + int send_fd = params->send_fd; + char *prog = xstrdup(params->prog); + pid_t pid = params->pid; + char *buf2 = xcalloc(1, 8192); + + for (;;) { + if (type == IPC_TCP_SOCKET) + x = read(rfd, buf2, 8192); + else + x = recv(rfd, buf2, 8192, 0); + if ((x <= 0 && type == IPC_TCP_SOCKET) || + (x < 0 && type == IPC_UDP_SOCKET)) { + debug(54, 3) ("ipc(%s,%d): %d bytes read from %s. Exiting...\n", + prog, pid, x, prog); + break; + } + buf2[x] = '\0'; + if (type == IPC_UDP_SOCKET && !strcmp(buf2, shutdown_string)) { + debug(54, 3) ("ipc(%s,%d): request for shutdown received. Exiting...\n", + prog, pid); + break; + } + if (x >= 2) { + if ((buf2[x - 1] == '\n') && (buf2[x - 2] == '\r')) { + buf2[x - 2] = '\n'; + buf2[x - 1] = '\0'; + x--; + } + } + debug(54, 5) ("ipc(%s,%d): received from child : %s\n", prog, pid, + rfc1738_escape_unescaped(buf2)); + x = send(send_fd, buf2, x, 0); + if ((x <= 0 && type == IPC_TCP_SOCKET) || + (x < 0 && type == IPC_UDP_SOCKET)) { + debug(54, 3) ("ipc(%s,%d): %d bytes sent to parent. Exiting...\n", + prog, pid, x); + break; + } + } + + xfree(prog); + xfree(buf2); + return 0; +} diff -ruN squid-2.6.STABLE3/src/logfile.c squid-2.6.STABLE4/src/logfile.c --- squid-2.6.STABLE3/src/logfile.c Tue Jul 18 16:29:07 2006 +++ squid-2.6.STABLE4/src/logfile.c Sat Sep 2 08:08:42 2006 @@ -1,5 +1,5 @@ /* - * $Id: logfile.c,v 1.17 2006/07/18 22:29:07 hno Exp $ + * $Id: logfile.c,v 1.20 2006/09/02 14:08:42 hno Exp $ * * DEBUG: section 50 Log file handling * AUTHOR: Duane Wessels diff -ruN squid-2.6.STABLE3/src/main.c squid-2.6.STABLE4/src/main.c --- squid-2.6.STABLE3/src/main.c Tue Aug 15 13:27:28 2006 +++ squid-2.6.STABLE4/src/main.c Sat Sep 2 08:16:10 2006 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.388 2006/08/15 19:27:28 hno Exp $ + * $Id: main.c,v 1.391 2006/09/02 14:16:10 hno Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -434,6 +434,13 @@ neighbors_init(); storeDirOpenSwapLogs(); mimeInit(Config.mimeTablePathname); + if (Config.onoff.announce) { + if (!eventFind(start_announce, NULL)) + eventAdd("start_announce", start_announce, NULL, 3600.0, 1); + } else { + if (eventFind(start_announce, NULL)) + eventDelete(start_announce, NULL); + } eventCleanup(); writePidFile(); /* write PID file */ debug(1, 1) ("Ready to serve requests.\n"); @@ -827,6 +834,8 @@ eventRun(); if ((loop_delay = eventNextTime()) < 0) loop_delay = 0; + if (debug_log_flush() && loop_delay > 1000) + loop_delay = 1000; switch (comm_select(loop_delay)) { case COMM_OK: errcount = 0; /* reset if successful */ @@ -987,9 +996,9 @@ * 1.1.3. execvp had a bit overflow error in a loop.. */ /* Connect stdio to /dev/null in daemon mode */ - nullfd = open("/dev/null", O_RDWR | O_TEXT); + nullfd = open(_PATH_DEVNULL, O_RDWR | O_TEXT); if (nullfd < 0) - fatalf("/dev/null: %s\n", xstrerror()); + fatalf(_PATH_DEVNULL " %s\n", xstrerror()); dup2(nullfd, 0); if (opt_debug_stderr < 0) { dup2(nullfd, 1); diff -ruN squid-2.6.STABLE3/src/mib.txt squid-2.6.STABLE4/src/mib.txt --- squid-2.6.STABLE3/src/mib.txt Mon May 15 19:08:28 2006 +++ squid-2.6.STABLE4/src/mib.txt Thu Sep 21 20:49:24 2006 @@ -2,7 +2,7 @@ SQUID-MIB DEFINITIONS ::= BEGIN -- --- $Id: mib.txt,v 1.29 2006/05/16 01:08:28 hno Exp $ +-- $Id: mib.txt,v 1.30 2006/09/22 02:49:24 hno Exp $ -- IMPORTS @@ -260,6 +260,21 @@ " Reserved number of file descriptors " ::= { cacheSysPerf 11 } + cacheCurrentFileDescrCnt OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + " Number of file descriptors in use " + ::= { cacheSysPerf 12 } + + cacheCurrentFileDescrMax OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + " Highest file descriptors in use " + ::= { cacheSysPerf 13 } -- -- cacheProtoStats -- @@ -423,7 +438,8 @@ cacheIcpReplySvcTime Integer32, cacheDnsSvcTime Integer32, cacheRequestHitRatio Integer32, - cacheRequestByteRatio Integer32 + cacheRequestByteRatio Integer32, + cacheHttpNhSvcTime Integer32 } cacheMedianTime OBJECT-TYPE @@ -455,7 +471,7 @@ MAX-ACCESS read-only STATUS current DESCRIPTION - " HTTP near miss service time " + " HTTP hit not-modified service time " ::= { cacheMedianSvcEntry 4 } cacheHttpHitSvcTime OBJECT-TYPE @@ -505,6 +521,14 @@ DESCRIPTION " Byte Hit Ratios " ::= { cacheMedianSvcEntry 10 } + + cacheHttpNhSvcTime OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + " HTTP refresh hit service time " + ::= { cacheMedianSvcEntry 11 } -- -- cacheNetwork group diff -ruN squid-2.6.STABLE3/src/protos.h squid-2.6.STABLE4/src/protos.h --- squid-2.6.STABLE3/src/protos.h Tue Aug 15 18:54:16 2006 +++ squid-2.6.STABLE4/src/protos.h Fri Sep 22 04:44:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.510 2006/08/16 00:54:16 hno Exp $ + * $Id: protos.h,v 1.518 2006/09/22 10:44:24 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -95,6 +95,8 @@ extern void allocate_new_swapdir(cacheSwap *); extern void self_destruct(void); extern int GetInteger(void); +extern int xatoi(const char *); +extern unsigned short xatos(const char *); /* extra functions from cache_cf.c useful for lib modules */ extern void parse_int(int *var); @@ -221,6 +223,7 @@ #else extern void _db_print(); #endif +extern int debug_log_flush(void); extern void xassert(const char *, const char *, int); /* packs, then prints an object using debug() */ @@ -861,7 +864,7 @@ extern void memFreeBuf(size_t size, void *); extern FREE *memFreeBufFunc(size_t size); extern int memInUse(mem_type); -extern int memTotalAllocated(void); +extern size_t memTotalAllocated(void); extern void memDataInit(mem_type, const char *, size_t, int); extern void memCheckInit(void); @@ -1155,7 +1158,7 @@ extern void errorAppendEntry(StoreEntry *, ErrorState *); extern void errorStateFree(ErrorState * err); extern int errorReservePageId(const char *page_name); -extern ErrorState *errorCon(err_type type, http_status); +extern ErrorState *errorCon(err_type type, http_status, request_t * request); extern int errorPageId(const char *page_name); extern void pconnPush(int, const char *host, u_short port, const char *domain, struct in_addr *client_address, u_short client_port); @@ -1226,12 +1229,13 @@ /* * ipc.c */ -extern int ipcCreate(int type, +extern pid_t ipcCreate(int type, const char *prog, const char *const args[], const char *name, int *rfd, - int *wfd); + int *wfd, + void **hIpc); /* CacheDigest */ extern CacheDigest *cacheDigestCreate(int capacity, int bpe); @@ -1353,7 +1357,7 @@ */ extern StatCounters *snmpStatGet(int); -/* CygWin & Windows NT Port */ +/* Cygwin & native Windows Port */ /* win32.c */ #ifdef _SQUID_WIN32_ extern int WIN32_Subsystem_Init(int *, char ***); diff -ruN squid-2.6.STABLE3/src/repl/Makefile.in squid-2.6.STABLE4/src/repl/Makefile.in --- squid-2.6.STABLE3/src/repl/Makefile.in Mon Jun 12 00:10:12 2006 +++ squid-2.6.STABLE4/src/repl/Makefile.in Fri Sep 22 03:09:50 2006 @@ -16,7 +16,7 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.in,v 1.32 2006/06/12 06:10:12 hno Exp $ +# $Id: Makefile.in,v 1.35 2006/09/22 09:09:50 hno Exp $ # srcdir = @srcdir@ @@ -109,6 +109,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -149,6 +151,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -186,6 +190,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -203,6 +209,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ diff -ruN squid-2.6.STABLE3/src/snmp_agent.c squid-2.6.STABLE4/src/snmp_agent.c --- squid-2.6.STABLE3/src/snmp_agent.c Mon May 15 19:08:30 2006 +++ squid-2.6.STABLE4/src/snmp_agent.c Thu Sep 21 20:49:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: snmp_agent.c,v 1.86 2006/05/16 01:08:30 hno Exp $ + * $Id: snmp_agent.c,v 1.88 2006/09/22 02:49:24 hno Exp $ * * DEBUG: section 49 SNMP Interface * AUTHOR: Kostas Anagnostakis @@ -108,7 +108,7 @@ break; case CONF_ST_SWMAXSZ: Answer = snmp_var_new_integer(Var->name, Var->name_length, - (snint) Config.Swap.maxSize >> 10, + (snint) (Config.Swap.maxSize >> 10), ASN_INTEGER); break; case CONF_ST_SWHIWM: @@ -292,7 +292,7 @@ break; case PERF_SYS_MEMUSAGE: Answer = snmp_var_new_integer(Var->name, Var->name_length, - (snint) statMemoryAccounted() >> 10, + (snint) (statMemoryAccounted() >> 10), ASN_INTEGER); break; case PERF_SYS_CPUTIME: @@ -326,7 +326,7 @@ break; case PERF_SYS_CURUNUSED_FD: Answer = snmp_var_new_integer(Var->name, Var->name_length, - (snint) Squid_MaxFD - Number_FD, + (snint) fdNFree(), SMI_GAUGE32); break; case PERF_SYS_CURRESERVED_FD: @@ -334,6 +334,16 @@ (snint) RESERVED_FD, SMI_GAUGE32); break; + case PERF_SYS_CURUSED_FD: + Answer = snmp_var_new_integer(Var->name, Var->name_length, + (snint) Number_FD, + SMI_GAUGE32); + break; + case PERF_SYS_CURMAX_FD: + Answer = snmp_var_new_integer(Var->name, Var->name_length, + (snint) Biggest_FD, + SMI_GAUGE32); + break; case PERF_SYS_NUMOBJCNT: Answer = snmp_var_new_integer(Var->name, Var->name_length, (snint) memInUse(MEM_STOREENTRY), @@ -485,6 +495,10 @@ break; case PERF_MEDIAN_BHR: x = statByteHitRatio(minutes); + break; + case PERF_MEDIAN_HTTP_NH: + x = statHistDeltaMedian(&l->client_http.nh_svc_time, + &f->client_http.nm_svc_time); break; default: *ErrP = SNMP_ERR_NOSUCHNAME; diff -ruN squid-2.6.STABLE3/src/snmp_core.c squid-2.6.STABLE4/src/snmp_core.c --- squid-2.6.STABLE3/src/snmp_core.c Sat Jul 29 14:38:59 2006 +++ squid-2.6.STABLE4/src/snmp_core.c Thu Sep 21 20:49:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.c,v 1.60 2006/07/29 20:38:59 serassio Exp $ + * $Id: snmp_core.c,v 1.62 2006/09/22 02:49:24 hno Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -146,7 +146,7 @@ snmpAddNode(snmpCreateOid(LEN_SQ_PRF, SQ_PRF), LEN_SQ_PRF, NULL, NULL, 2, snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 1, SQ_PRF, PERF_SYS), - LEN_SQ_PRF + 1, NULL, NULL, 11, + LEN_SQ_PRF + 1, NULL, NULL, 13, snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 2, SQ_PRF, PERF_SYS, 1), LEN_SQ_PRF + 2, snmp_prfSysFn, static_Inst, 0), snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 2, SQ_PRF, PERF_SYS, 2), @@ -168,6 +168,10 @@ snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 2, SQ_PRF, PERF_SYS, 10), LEN_SQ_PRF + 2, snmp_prfSysFn, static_Inst, 0), snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 2, SQ_PRF, PERF_SYS, 11), + LEN_SQ_PRF + 2, snmp_prfSysFn, static_Inst, 0), + snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 2, SQ_PRF, PERF_SYS, 12), + LEN_SQ_PRF + 2, snmp_prfSysFn, static_Inst, 0), + snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 2, SQ_PRF, PERF_SYS, 13), LEN_SQ_PRF + 2, snmp_prfSysFn, static_Inst, 0)), snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 1, SQ_PRF, PERF_PROTO), LEN_SQ_PRF + 1, NULL, NULL, 2, @@ -206,7 +210,7 @@ snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 2, SQ_PRF, PERF_PROTO, 2), LEN_SQ_PRF + 2, NULL, NULL, 1, snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 3, SQ_PRF, PERF_PROTO, 2, 1), - LEN_SQ_PRF + 3, NULL, NULL, 10, + LEN_SQ_PRF + 3, NULL, NULL, 11, snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 4, SQ_PRF, PERF_PROTO, 2, 1, 1), LEN_SQ_PRF + 4, snmp_prfProtoFn, time_Inst, 0), snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 4, SQ_PRF, PERF_PROTO, 2, 1, 2), @@ -226,6 +230,8 @@ snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 4, SQ_PRF, PERF_PROTO, 2, 1, 9), LEN_SQ_PRF + 4, snmp_prfProtoFn, time_Inst, 0), snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 4, SQ_PRF, PERF_PROTO, 2, 1, 10), + LEN_SQ_PRF + 4, snmp_prfProtoFn, time_Inst, 0), + snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 4, SQ_PRF, PERF_PROTO, 2, 1, 11), LEN_SQ_PRF + 4, snmp_prfProtoFn, time_Inst, 0))))), snmpAddNode(snmpCreateOid(LEN_SQ_NET, SQ_NET), LEN_SQ_NET, NULL, NULL, 3, @@ -620,11 +626,13 @@ Answer->errstat = SNMP_ERR_NOSUCHNAME; debug(49, 5) ("snmpAgentResponse: No such oid.\n"); } else { + int *errstatTmp; if (get_next) { VarPtr = snmp_var_new(NextOidName, NextOidNameLen); xfree(NextOidName); } - VarNew = (*ParseFn) (VarPtr, (snint *) & (Answer->errstat)); + errstatTmp = &(Answer->errstat); + VarNew = (*ParseFn) (VarPtr, (snint *) errstatTmp); if (get_next) snmp_var_free(VarPtr); } diff -ruN squid-2.6.STABLE3/src/squid.h squid-2.6.STABLE4/src/squid.h --- squid-2.6.STABLE3/src/squid.h Thu Jun 8 06:53:20 2006 +++ squid-2.6.STABLE4/src/squid.h Fri Sep 8 13:41:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.242 2006/06/08 12:53:20 hno Exp $ + * $Id: squid.h,v 1.244 2006/09/08 19:41:24 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -154,6 +154,9 @@ #endif #include #endif +#if HAVE_PATHS_H +#include +#endif #if HAVE_PWD_H #include #endif @@ -501,6 +504,17 @@ #ifndef IPPROTO_TCP #define IPPROTO_TCP 0 #endif + + +#if defined(_SQUID_MSWIN_) +/* Windows lacks getpagesize() prototype */ +#ifndef getpagesize +extern size_t getpagesize(void); +#endif +#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ +#define strtoll WIN32_strtoll +#endif +#endif /* _SQUID_MSWIN_ */ /* * Trap attempts to build large file cache support without support for diff -ruN squid-2.6.STABLE3/src/ssl.c squid-2.6.STABLE4/src/ssl.c --- squid-2.6.STABLE3/src/ssl.c Sun Jul 23 15:27:07 2006 +++ squid-2.6.STABLE4/src/ssl.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: ssl.c,v 1.133 2006/07/23 21:27:07 hno Exp $ + * $Id: ssl.c,v 1.134 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -424,19 +424,17 @@ if (status == COMM_ERR_DNS) { debug(26, 4) ("sslConnect: Unknown host: %s\n", sslState->host); comm_close(fd); - err = errorCon(ERR_DNS_FAIL, HTTP_NOT_FOUND); + err = errorCon(ERR_DNS_FAIL, HTTP_NOT_FOUND, request); *sslState->status_ptr = HTTP_NOT_FOUND; - err->request = requestLink(request); err->dnsserver_msg = xstrdup(dns_error_message); err->callback = sslErrorComplete; err->callback_data = sslState; errorSend(sslState->client.fd, err); } else if (status != COMM_OK) { comm_close(fd); - err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE, request); *sslState->status_ptr = HTTP_SERVICE_UNAVAILABLE; err->xerrno = errno; - err->request = requestLink(request); err->callback = sslErrorComplete; err->callback_data = sslState; errorSend(sslState->client.fd, err); @@ -472,10 +470,9 @@ hierarchyNote(&sslState->request->hier, sslState->servers->code, sslState->host); comm_close(fd); - err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE, request); *sslState->status_ptr = HTTP_SERVICE_UNAVAILABLE; err->xerrno = ETIMEDOUT; - err->request = requestLink(request); err->callback = sslErrorComplete; err->callback_data = sslState; errorSend(sslState->client.fd, err); @@ -510,10 +507,8 @@ ch.request = request; answer = aclCheckFast(Config.accessList.miss, &ch); if (answer == 0) { - err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN); + err = errorCon(ERR_FORWARDING_DENIED, HTTP_FORBIDDEN, request); *status_ptr = HTTP_FORBIDDEN; - err->request = requestLink(request); - err->src_addr = request->client_addr; errorSend(fd, err); return; } @@ -532,10 +527,9 @@ url); if (sock == COMM_ERROR) { debug(26, 4) ("sslStart: Failed because we're out of sockets.\n"); - err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR); + err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR, request); *status_ptr = HTTP_INTERNAL_SERVER_ERROR; err->xerrno = errno; - err->request = requestLink(request); errorSend(fd, err); return; } @@ -618,9 +612,8 @@ peer *g = NULL; if (fs == NULL) { ErrorState *err; - err = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE, sslState->request); *sslState->status_ptr = HTTP_SERVICE_UNAVAILABLE; - err->request = requestLink(sslState->request); err->callback = sslErrorComplete; err->callback_data = sslState; errorSend(sslState->client.fd, err); diff -ruN squid-2.6.STABLE3/src/ssl_support.h squid-2.6.STABLE4/src/ssl_support.h --- squid-2.6.STABLE3/src/ssl_support.h Wed May 17 17:17:05 2006 +++ squid-2.6.STABLE4/src/ssl_support.h Fri Sep 8 13:41:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: ssl_support.h,v 1.5 2006/05/17 23:17:05 hno Exp $ + * $Id: ssl_support.h,v 1.6 2006/09/08 19:41:24 serassio Exp $ * * AUTHOR: Benno Rice * @@ -58,5 +58,11 @@ const char *sslGetCAAttribute(SSL * ssl, const char *attribute); const char *sslGetUserCertificatePEM(SSL * ssl); const char *sslGetUserCertificateChainPEM(SSL * ssl); + +#ifdef _SQUID_MSWIN_ + +#define SSL_set_fd(s,f) (SSL_set_fd(s,fd_table[fd].win32.handle)) + +#endif /* _SQUID_MSWIN_ */ #endif /* SQUID_SSL_SUPPORT_H */ diff -ruN squid-2.6.STABLE3/src/stat.c squid-2.6.STABLE4/src/stat.c --- squid-2.6.STABLE3/src/stat.c Tue Aug 15 13:27:28 2006 +++ squid-2.6.STABLE4/src/stat.c Mon Sep 18 16:54:39 2006 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.374 2006/08/15 19:27:28 hno Exp $ + * $Id: stat.c,v 1.376 2006/09/18 22:54:39 hno Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -440,21 +440,37 @@ int i; fde *f; storeAppendPrintf(sentry, "Active file descriptors:\n"); +#ifdef _SQUID_MSWIN_ + storeAppendPrintf(sentry, "%-4s %-10s %-6s %-4s %-7s* %-7s* %-21s %s\n", + "File", + "Handle", +#else storeAppendPrintf(sentry, "%-4s %-6s %-4s %-7s* %-7s* %-21s %s\n", "File", +#endif "Type", "Tout", "Nread", "Nwrite", "Remote Address", "Description"); +#ifdef _SQUID_MSWIN_ + storeAppendPrintf(sentry, "---- ---------- ------ ---- -------- -------- --------------------- ------------------------------\n"); +#else storeAppendPrintf(sentry, "---- ------ ---- -------- -------- --------------------- ------------------------------\n"); +#endif for (i = 0; i < Squid_MaxFD; i++) { f = &fd_table[i]; if (!f->flags.open) continue; +#ifdef _SQUID_MSWIN_ + storeAppendPrintf(sentry, "%4d 0x%-8lX %-6.6s %4d %7" PRINTF_OFF_T "%c %7" PRINTF_OFF_T "%c %-21s %s\n", + i, + f->win32.handle, +#else storeAppendPrintf(sentry, "%4d %-6.6s %4d %7" PRINTF_OFF_T "%c %7" PRINTF_OFF_T "%c %-21s %s\n", i, +#endif fdTypeStr[f->type], f->timeout_handler ? (int) (f->timeout - squid_curtime) / 60 : 0, f->bytes_read, @@ -595,34 +611,34 @@ storeAppendPrintf(sentry, "Memory usage for %s via mstats():\n", appname); storeAppendPrintf(sentry, "\tTotal space in arena: %6d KB\n", - ms.bytes_total >> 10); + (int) (ms.bytes_total >> 10)); storeAppendPrintf(sentry, "\tTotal free: %6d KB %d%%\n", - ms.bytes_free >> 10, percent(ms.bytes_free, ms.bytes_total)); + (int) (ms.bytes_free >> 10), percent(ms.bytes_free, ms.bytes_total)); #elif HAVE_MALLINFO && HAVE_STRUCT_MALLINFO mp = mallinfo(); storeAppendPrintf(sentry, "Memory usage for %s via mallinfo():\n", appname); storeAppendPrintf(sentry, "\tTotal space in arena: %6ld KB\n", - (long int) mp.arena >> 10); + (long int) (mp.arena >> 10)); storeAppendPrintf(sentry, "\tOrdinary blocks: %6ld KB %6ld blks\n", - (long int) mp.uordblks >> 10, (long int) mp.ordblks); + (long int) (mp.uordblks >> 10), (long int) mp.ordblks); storeAppendPrintf(sentry, "\tSmall blocks: %6ld KB %6ld blks\n", - (long int) mp.usmblks >> 10, (long int) mp.smblks); + (long int) (mp.usmblks >> 10), (long int) mp.smblks); storeAppendPrintf(sentry, "\tHolding blocks: %6ld KB %6ld blks\n", - (long int) mp.hblkhd >> 10, (long int) mp.hblks); + (long int) (mp.hblkhd >> 10), (long int) mp.hblks); storeAppendPrintf(sentry, "\tFree Small blocks: %6ld KB\n", - (long int) mp.fsmblks >> 10); + (long int) (mp.fsmblks >> 10)); storeAppendPrintf(sentry, "\tFree Ordinary blocks: %6ld KB\n", - (long int) mp.fordblks >> 10); - t = mp.uordblks + mp.usmblks + mp.hblkhd; + (long int) (mp.fordblks >> 10)); + t = (mp.uordblks + mp.usmblks + mp.hblkhd) >> 10; storeAppendPrintf(sentry, "\tTotal in use: %6d KB %d%%\n", - t >> 10, percent(t, mp.arena + mp.hblkhd)); - t = mp.fsmblks + mp.fordblks; + t, percent(t, (mp.arena + mp.hblkhd) >> 10)); + t = (mp.fsmblks + mp.fordblks) >> 10; storeAppendPrintf(sentry, "\tTotal free: %6d KB %d%%\n", - t >> 10, percent(t, mp.arena + mp.hblkhd)); - t = mp.arena + mp.hblkhd; + t, percent(t, (mp.arena + mp.hblkhd) >> 10)); + t = (mp.arena + mp.hblkhd) >> 10; storeAppendPrintf(sentry, "\tTotal size: %6d KB\n", - t >> 10); + t); #if HAVE_EXT_MALLINFO storeAppendPrintf(sentry, "\tmax size of small blocks:\t%d\n", mp.mxfast); storeAppendPrintf(sentry, "\tnumber of small blocks in a holding block:\t%d\n", @@ -638,7 +654,7 @@ #endif /* HAVE_MALLINFO */ storeAppendPrintf(sentry, "Memory accounted for:\n"); storeAppendPrintf(sentry, "\tTotal accounted: %6d KB\n", - statMemoryAccounted() >> 10); + (int) (statMemoryAccounted() >> 10)); storeAppendPrintf(sentry, "\tmemPoolAlloc calls: %u\n", mem_pool_alloc_calls); storeAppendPrintf(sentry, "\tmemPoolFree calls: %u\n", @@ -1595,7 +1611,7 @@ #endif /* STAT_GRAPHS */ -int +size_t statMemoryAccounted(void) { return memTotalAllocated(); diff -ruN squid-2.6.STABLE3/src/store_dir.c squid-2.6.STABLE4/src/store_dir.c --- squid-2.6.STABLE3/src/store_dir.c Sun Jul 30 17:27:03 2006 +++ squid-2.6.STABLE4/src/store_dir.c Mon Sep 18 16:54:39 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.c,v 1.142 2006/07/30 23:27:03 hno Exp $ + * $Id: store_dir.c,v 1.143 2006/09/18 22:54:39 hno Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -297,8 +297,8 @@ void storeDirUpdateSwapSize(SwapDir * SD, squid_off_t size, int sign) { - int blks = (size + SD->fs.blksize - 1) / SD->fs.blksize; - int k = (blks * SD->fs.blksize >> 10) * sign; + squid_off_t blks = (size + SD->fs.blksize - 1) / SD->fs.blksize; + int k = ((blks * (squid_off_t) SD->fs.blksize) >> 10) * sign; SD->cur_size += k; store_swap_size += k; if (sign > 0) diff -ruN squid-2.6.STABLE3/src/store_log.c squid-2.6.STABLE4/src/store_log.c --- squid-2.6.STABLE3/src/store_log.c Tue May 17 10:56:38 2005 +++ squid-2.6.STABLE4/src/store_log.c Sat Sep 2 08:08:42 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_log.c,v 1.24 2005/05/17 16:56:38 hno Exp $ + * $Id: store_log.c,v 1.26 2006/09/02 14:08:42 hno Exp $ * * DEBUG: section 20 Storage Manager Logging Functions * AUTHOR: Duane Wessels diff -ruN squid-2.6.STABLE3/src/store_swapout.c squid-2.6.STABLE4/src/store_swapout.c --- squid-2.6.STABLE3/src/store_swapout.c Mon Aug 7 09:03:28 2006 +++ squid-2.6.STABLE4/src/store_swapout.c Thu Sep 21 21:15:20 2006 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.c,v 1.95 2006/08/07 15:03:28 hno Exp $ + * $Id: store_swapout.c,v 1.96 2006/09/22 03:15:20 hno Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -238,7 +238,7 @@ return; } /* Ok, we have stuff to swap out. Is there a swapout.sio open? */ - if (e->swap_status == SWAPOUT_NONE) { + if (e->swap_status == SWAPOUT_NONE && !EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT)) { assert(mem->swapout.sio == NULL); assert(mem->inmem_lo == 0); if (storeCheckCachable(e)) diff -ruN squid-2.6.STABLE3/src/structs.h squid-2.6.STABLE4/src/structs.h --- squid-2.6.STABLE3/src/structs.h Sat Aug 12 07:33:45 2006 +++ squid-2.6.STABLE4/src/structs.h Wed Sep 20 22:14:46 2006 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.497 2006/08/12 13:33:45 adrian Exp $ + * $Id: structs.h,v 1.502 2006/09/21 04:14:46 swilton Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -507,6 +507,8 @@ struct in_addr address; int forwarding_method; int return_method; + int assignment_method; + int weight; int rebuildwait; void *info; } Wccp2; @@ -914,6 +916,11 @@ #if USE_SSL SSL *ssl; #endif +#ifdef _SQUID_MSWIN_ + struct { + long handle; + } win32; +#endif }; struct _fileMap { @@ -2327,6 +2334,7 @@ int uses; unsigned int pending; } stats; + void *hIpc; }; @@ -2356,6 +2364,7 @@ int releases; } stats; void *data; /* State data used by the calling routines */ + void *hIpc; }; /* diff -ruN squid-2.6.STABLE3/src/tools.c squid-2.6.STABLE4/src/tools.c --- squid-2.6.STABLE3/src/tools.c Mon Jul 17 18:22:20 2006 +++ squid-2.6.STABLE4/src/tools.c Fri Sep 22 04:47:42 2006 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.244 2006/07/18 00:22:20 hno Exp $ + * $Id: tools.c,v 1.248 2006/09/22 10:47:42 hno Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -33,6 +33,11 @@ * */ +/* On native Windows, squid_mswin.h needs to know when we are compiling + * tools.c for the correct handling of FD<=>socket magic + */ +#define TOOLS_C + #include "squid.h" #if LINUX_TPROXY @@ -149,23 +154,23 @@ mp = mallinfo(); fprintf(debug_log, "Memory usage for %s via mallinfo():\n", appname); fprintf(debug_log, "\ttotal space in arena: %6ld KB\n", - (long int) mp.arena >> 10); + (long int) (mp.arena >> 10)); fprintf(debug_log, "\tOrdinary blocks: %6ld KB %6ld blks\n", - (long int) mp.uordblks >> 10, (long int) mp.ordblks); + (long int) (mp.uordblks >> 10), (long int) mp.ordblks); fprintf(debug_log, "\tSmall blocks: %6ld KB %6ld blks\n", - (long int) mp.usmblks >> 10, (long int) mp.smblks); + (long int) (mp.usmblks >> 10), (long int) mp.smblks); fprintf(debug_log, "\tHolding blocks: %6ld KB %6ld blks\n", - (long int) mp.hblkhd >> 10, (long int) mp.hblks); + (long int) (mp.hblkhd >> 10), (long int) mp.hblks); fprintf(debug_log, "\tFree Small blocks: %6ld KB\n", - (long int) mp.fsmblks >> 10); + (long int) (mp.fsmblks >> 10)); fprintf(debug_log, "\tFree Ordinary blocks: %6ld KB\n", - (long int) mp.fordblks >> 10); - t = mp.uordblks + mp.usmblks + mp.hblkhd; + (long int) (mp.fordblks >> 10)); + t = (mp.uordblks + mp.usmblks + mp.hblkhd) >> 10; fprintf(debug_log, "\tTotal in use: %6d KB %d%%\n", - t >> 10, percent(t, mp.arena)); - t = mp.fsmblks + mp.fordblks; + t, percent(t, (mp.arena + mp.hblkhd) >> 10)); + t = (mp.fsmblks + mp.fordblks) >> 10; fprintf(debug_log, "\tTotal free: %6d KB %d%%\n", - t >> 10, percent(t, mp.arena)); + t, percent(t, (mp.arena + mp.hblkhd) >> 10)); #if HAVE_EXT_MALLINFO fprintf(debug_log, "\tmax size of small blocks:\t%d\n", mp.mxfast); @@ -357,37 +362,30 @@ fprintf(debug_log, "Squid Cache (Version %s): Terminated abnormally.\n", version_string); fflush(debug_log); + if (!shutting_down) { + PrintRusage(); + dumpMallocStats(); #ifdef PRINT_STACK_TRACE #ifdef _SQUID_HPUX_ - { extern void U_STACK_TRACE(void); /* link with -lcl */ fflush(debug_log); dup2(fileno(debug_log), 2); U_STACK_TRACE(); - } #endif /* _SQUID_HPUX_ */ #ifdef _SQUID_SOLARIS_ - { /* get ftp://opcom.sun.ca/pub/tars/opcom_stack.tar.gz and */ extern void opcom_stack_trace(void); /* link with -lopcom_stack */ fflush(debug_log); dup2(fileno(debug_log), fileno(stdout)); opcom_stack_trace(); fflush(stdout); - } #endif /* _SQUID_SOLARIS_ */ #if HAVE_BACKTRACE_SYMBOLS_FD - { static void *(callarray[8192]); int n; n = backtrace(callarray, 8192); backtrace_symbols_fd(callarray, n, fileno(debug_log)); - } #endif #endif /* PRINT_STACK_TRACE */ - - if (!shutting_down) { - PrintRusage(); - dumpMallocStats(); } } @@ -856,6 +854,34 @@ if (sigaction(sig, &sa, NULL) < 0) debug(50, 0) ("sigaction: sig=%d func=%p: %s\n", sig, func, xstrerror()); #else +#ifdef _SQUID_MSWIN_ +/* + * On Windows, only SIGINT, SIGILL, SIGFPE, SIGTERM, SIGBREAK, SIGABRT and SIGSEGV + * signals are supported, so we must care of don't call signal() for other value. + * The SIGILL, SIGSEGV, and SIGTERM signals are not generated under Windows. They + * are defined only for ANSI compatibility, so both SIGSEGV and SIGBUS are emulated + * with an Exception Handler. + */ + switch (sig) { + case SIGINT: + case SIGILL: + case SIGFPE: + case SIGTERM: + case SIGBREAK: + case SIGABRT: + break; + case SIGSEGV: + WIN32_ExceptionHandlerInit(); + break; + case SIGBUS: + WIN32_ExceptionHandlerInit(); + return; + break; /* Not reached */ + default: + return; + break; /* Not reached */ + } +#endif /* _SQUID_MSWIN_ */ signal(sig, func); #endif } diff -ruN squid-2.6.STABLE3/src/typedefs.h squid-2.6.STABLE4/src/typedefs.h --- squid-2.6.STABLE3/src/typedefs.h Sun Jul 30 17:27:03 2006 +++ squid-2.6.STABLE4/src/typedefs.h Sat Sep 2 08:08:42 2006 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.149 2006/07/30 23:27:03 hno Exp $ + * $Id: typedefs.h,v 1.151 2006/09/02 14:08:42 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ diff -ruN squid-2.6.STABLE3/src/unlinkd.c squid-2.6.STABLE4/src/unlinkd.c --- squid-2.6.STABLE3/src/unlinkd.c Fri Jun 9 08:22:38 2006 +++ squid-2.6.STABLE4/src/unlinkd.c Fri Sep 8 13:41:24 2006 @@ -1,6 +1,6 @@ /* - * $Id: unlinkd.c,v 1.51 2006/06/09 14:22:38 hno Exp $ + * $Id: unlinkd.c,v 1.53 2006/09/08 19:41:24 serassio Exp $ * * DEBUG: section 2 Unlink Daemon * AUTHOR: Duane Wessels @@ -50,7 +50,7 @@ setbuf(stdin, NULL); setbuf(stdout, NULL); close(2); - open("/dev/null", O_RDWR); + open(_PATH_DEVNULL, O_RDWR); while (fgets(buf, UNLINK_BUF_LEN, stdin)) { if ((t = strchr(buf, '\n'))) *t = '\0'; @@ -74,6 +74,9 @@ static int unlinkd_wfd = -1; static int unlinkd_rfd = -1; +static void *hIpc; +static pid_t pid; + #define UNLINKD_QUEUE_LIMIT 20 void @@ -106,7 +109,11 @@ int x; int i; char rbuf[512]; +#ifdef _SQUID_MSWIN_ + x = recv(unlinkd_rfd, rbuf, 511, 0); +#else x = read(unlinkd_rfd, rbuf, 511); +#endif if (x > 0) { rbuf[x] = '\0'; for (i = 0; i < x; i++) @@ -119,7 +126,11 @@ assert(l < MAXPATHLEN); xstrncpy(buf, path, MAXPATHLEN); buf[l++] = '\n'; +#ifdef _SQUID_MSWIN_ + x = send(unlinkd_wfd, buf, l, 0); +#else x = write(unlinkd_wfd, buf, l); +#endif if (x < 0) { debug(2, 1) ("unlinkdUnlink: write FD %d failed: %s\n", unlinkd_wfd, xstrerror()); @@ -139,6 +150,28 @@ void unlinkdClose(void) { +#ifdef _SQUID_MSWIN_ + if (unlinkd_wfd > -1) { + debug(2, 1) ("Closing unlinkd pipe on FD %d\n", unlinkd_wfd); + shutdown(unlinkd_wfd, SD_BOTH); + comm_close(unlinkd_wfd); + if (unlinkd_wfd != unlinkd_rfd) + comm_close(unlinkd_rfd); + unlinkd_wfd = -1; + unlinkd_rfd = -1; + } else + debug(2, 0) ("unlinkdClose: WARNING: unlinkd_wfd is %d\n", + unlinkd_wfd); + if (hIpc) { + if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { + getCurrentTime(); + debug(2, 1) + ("unlinkdClose: WARNING: (unlinkd,%ld) didn't exit in 5 seconds\n", + pid); + } + CloseHandle(hIpc); + } +#else if (unlinkd_wfd < 0) return; debug(2, 1) ("Closing unlinkd pipe on FD %d\n", unlinkd_wfd); @@ -147,29 +180,31 @@ file_close(unlinkd_rfd); unlinkd_wfd = -1; unlinkd_rfd = -1; +#endif } void unlinkdInit(void) { - int x; const char *args[2]; struct timeval slp; args[0] = "(unlinkd)"; args[1] = NULL; -#if HAVE_POLL && defined(_SQUID_OSF_) +#if (HAVE_POLL && defined(_SQUID_OSF_)) || defined(_SQUID_MSWIN_) /* pipes and poll() don't get along on DUNIX -DW */ - x = ipcCreate(IPC_STREAM, + /* On Windows select() will fail on a pipe */ + pid = ipcCreate(IPC_STREAM, #else /* We currently need to use FIFO.. see below */ - x = ipcCreate(IPC_FIFO, + pid = ipcCreate(IPC_FIFO, #endif Config.Program.unlinkd, args, "unlinkd", &unlinkd_rfd, - &unlinkd_wfd); - if (x < 0) + &unlinkd_wfd, + &hIpc); + if (pid < 0) fatal("Failed to create unlinkd subprocess"); slp.tv_sec = 0; slp.tv_usec = 250000; diff -ruN squid-2.6.STABLE3/src/urn.c squid-2.6.STABLE4/src/urn.c --- squid-2.6.STABLE3/src/urn.c Sun Jun 25 09:32:31 2006 +++ squid-2.6.STABLE4/src/urn.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: urn.c,v 1.79 2006/06/25 15:32:31 serassio Exp $ + * $Id: urn.c,v 1.80 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -130,9 +130,8 @@ urlres_r = urlParse(METHOD_GET, urlres); if (urlres_r == NULL) { debug(52, 3) ("urnStart: Bad uri-res URL %s\n", urlres); - err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND); + err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND, r); err->url = xstrdup(urlres); - err->request = requestLink(r); errorAppendEntry(e, err); return; } @@ -225,8 +224,7 @@ urlres_e->mem_obj->reply->sline.status); if (urlres_e->mem_obj->reply->sline.status != HTTP_OK) { debug(52, 3) ("urnHandleReply: failed.\n"); - err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND); - err->request = requestLink(urnState->request); + err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND, urnState->request); err->url = xstrdup(storeUrl(e)); errorAppendEntry(e, err); return; @@ -239,8 +237,7 @@ debug(52, 3) ("urnHandleReply: Counted %d URLs\n", i); if (urls == NULL) { /* unkown URN error */ debug(52, 3) ("urnHandleReply: unknown URN %s\n", storeUrl(e)); - err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND); - err->request = requestLink(urnState->request); + err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND, urnState->request); err->url = xstrdup(storeUrl(e)); errorAppendEntry(e, err); return; diff -ruN squid-2.6.STABLE3/src/wais.c squid-2.6.STABLE4/src/wais.c --- squid-2.6.STABLE3/src/wais.c Sun Oct 23 09:20:55 2005 +++ squid-2.6.STABLE4/src/wais.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: wais.c,v 1.141 2005/10/23 15:20:55 hno Exp $ + * $Id: wais.c,v 1.142 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -71,7 +71,7 @@ debug(24, 4) ("waisTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); if (entry->store_status == STORE_PENDING) { fwdFail(waisState->fwd, - errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); + errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT, waisState->fwd->request)); } comm_close(fd); } @@ -128,13 +128,13 @@ waisReadReply, waisState, 0); } else { ErrorState *err; - err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR); + err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR, waisState->fwd->request); err->xerrno = errno; fwdFail(waisState->fwd, err); comm_close(fd); } } else if (len == 0 && entry->mem_obj->inmem_hi == 0) { - fwdFail(waisState->fwd, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE)); + fwdFail(waisState->fwd, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE, waisState->fwd->request)); comm_close(fd); } else if (len == 0) { /* Connection closed; retrieval done. */ @@ -168,7 +168,7 @@ return; if (errflag) { ErrorState *err; - err = errorCon(ERR_WRITE_ERROR, HTTP_SERVICE_UNAVAILABLE); + err = errorCon(ERR_WRITE_ERROR, HTTP_SERVICE_UNAVAILABLE, waisState->fwd->request); err->xerrno = errno; fwdFail(waisState->fwd, err); comm_close(fd); diff -ruN squid-2.6.STABLE3/src/wccp2.c squid-2.6.STABLE4/src/wccp2.c --- squid-2.6.STABLE3/src/wccp2.c Sun Jul 30 16:15:30 2006 +++ squid-2.6.STABLE4/src/wccp2.c Wed Sep 20 22:14:46 2006 @@ -1,6 +1,6 @@ /* - * $Id: wccp2.c,v 1.23 2006/07/30 22:15:30 hno Exp $ + * $Id: wccp2.c,v 1.26 2006/09/21 04:14:46 swilton Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Steven WIlton @@ -67,7 +67,7 @@ #define WCCP2_SERVICE_SRC_IP_HASH 0x1 #define WCCP2_SERVICE_DST_IP_HASH 0x2 -#define WCCP2_SERVICE_SOURCE_PORT_HASH 0x4 +#define WCCP2_SERVICE_SRC_PORT_HASH 0x4 #define WCCP2_SERVICE_DST_PORT_HASH 0x8 #define WCCP2_SERVICE_PORTS_DEFINED 0x10 #define WCCP2_SERVICE_PORTS_SOURCE 0x20 @@ -90,6 +90,12 @@ #define WCCP2_CAPABILITY_INFO 8 +#define WCCP2_ALT_ASSIGNMENT 13 + +#define WCCP2_ASSIGN_MAP 14 + +#define WCCP2_COMMAND_EXTENSION 15 + #define WCCP2_CAPABILITY_FORWARDING_METHOD 0x01 #define WCCP2_CAPABILITY_ASSIGNMENT_METHOD 0x02 #define WCCP2_CAPABILITY_RETURN_METHOD 0x03 @@ -103,6 +109,9 @@ #define WCCP2_PACKET_RETURN_METHOD_GRE 0x00000001 #define WCCP2_PACKET_RETURN_METHOD_L2 0x00000002 +#define WCCP2_HASH_ASSIGNMENT 0x00 +#define WCCP2_MASK_ASSIGNMENT 0x01 + #define WCCP2_NONE_SECURITY_LEN 0 #define WCCP2_MD5_SECURITY_LEN 16 @@ -170,6 +179,27 @@ static struct wccp2_identity_info_t wccp2_identity_info; +struct wccp2_cache_mask_identity_info_t { + struct in_addr addr; + uint32_t num1; + uint32_t num2; + uint32_t source_ip_mask; + uint32_t dest_ip_mask; + uint16_t source_port_mask; + uint16_t dest_port_mask; + uint32_t num3; + uint32_t num4; +}; + +/* Web Cache identity info */ +struct wccp2_mask_identity_info_t { + uint16_t cache_identity_type; + uint16_t cache_identity_length; + struct wccp2_cache_mask_identity_info_t cache_identity; +}; + +static struct wccp2_mask_identity_info_t wccp2_mask_identity_info; + /* View header */ struct wccp2_cache_view_header_t { uint16_t cache_view_type; @@ -218,6 +248,23 @@ static struct wccp2_capability_element_t wccp2_capability_element; +/* Mask Element */ +struct wccp2_mask_element_t { + uint32_t source_ip_mask; + uint32_t dest_ip_mask; + uint16_t source_port_mask; + uint16_t dest_port_mask; + uint32_t number_values; +}; + +/* Value Element */ +struct wccp2_value_element_t { + uint32_t source_ip_value; + uint32_t dest_ip_value; + uint16_t source_port_value; + uint16_t dest_port_value; + struct in_addr cache_ip; +}; /* RECEIVED PACKET STRUCTURE */ struct wccp2_i_see_you_t { @@ -250,6 +297,14 @@ uint32_t number_caches; }; +/* The received packet for a mask assignment is unusual */ +struct cache_mask_info_t { + struct in_addr addr; + uint32_t num1; + uint32_t num2; + uint32_t num3; +}; + /* assigment key */ struct assignment_key_t { struct in_addr master_ip; @@ -263,10 +318,10 @@ struct assignment_key_t assignment_key; }; - /* Lists used to keep track of caches, routers and services */ struct wccp2_cache_list_t { struct in_addr cache_ip; + int weight; struct wccp2_cache_list_t *next; }; @@ -288,7 +343,7 @@ struct wccp2_router_list_t router_list_head; int lowest_ip; uint32_t change_num; - struct wccp2_identity_info_t *wccp2_identity_info_ptr; + char *wccp2_identity_info_ptr; struct wccp2_security_md5_t *security_info; struct wccp2_service_info_t *service_info; char wccp_packet[WCCP_RESPONSE_SIZE]; @@ -359,7 +414,7 @@ wccp2_update_service(wccp2_service_list_ptr, service, service_id, service_priority, service_proto, service_flags, ports); wccp2_service_list_ptr->wccp2_security_type = security_type; - bzero(wccp2_service_list_ptr->wccp_password, WCCP2_PASSWORD_LEN + 1); + memset(wccp2_service_list_ptr->wccp_password, 0, WCCP2_PASSWORD_LEN + 1); strncpy(wccp2_service_list_ptr->wccp_password, password, WCCP2_PASSWORD_LEN); /* add to linked list - XXX this should use the Squid dlink* routines! */ wccp2_service_list_ptr->next = wccp2_service_list_head; @@ -397,7 +452,7 @@ debug(80, 5) ("wccp2_update_md5_security: called\n"); /* The password field, for the MD5 hash, needs to be 8 bytes and NUL padded. */ - bzero(pwd, sizeof(pwd)); + memset(pwd, 0, sizeof(pwd)); strncpy(pwd, password, sizeof(pwd)); ws = (struct wccp2_security_md5_t *) ptr; assert(ntohs(ws->security_type) == WCCP2_SECURITY_INFO); @@ -413,7 +468,7 @@ * area should be zero'ed before calculating the MD5 hash. */ /* XXX eventually we should be able to kill md5_digest and blit it directly in */ - bzero(ws->security_implementation, sizeof(ws->security_implementation)); + memset(ws->security_implementation, 0, sizeof(ws->security_implementation)); MD5Init(&M); MD5Update(&M, pwd, 8); MD5Update(&M, packet, len); @@ -450,12 +505,12 @@ /* If execution makes it here then we have an MD5 security */ /* The password field, for the MD5 hash, needs to be 8 bytes and NUL padded. */ - bzero(pwd, sizeof(pwd)); + memset(pwd, 0, sizeof(pwd)); strncpy(pwd, srv->wccp_password, sizeof(pwd)); /* Take a copy of the challenge: we need to NUL it before comparing */ memcpy(md5_challenge, ws->security_implementation, 16); - bzero(ws->security_implementation, sizeof(ws->security_implementation)); + memset(ws->security_implementation, 0, sizeof(ws->security_implementation)); MD5Init(&M); MD5Update(&M, pwd, 8); MD5Update(&M, packet, len); @@ -470,6 +525,7 @@ { sockaddr_in_list *s; char *ptr; + uint32_t service_flags; struct wccp2_service_list_t *service_list_ptr; struct wccp2_router_list_t *router_list_ptr; struct wccp2_security_md5_t wccp2_security_md5; @@ -536,19 +592,64 @@ ptr += sizeof(struct wccp2_service_info_t); /* Add the cache identity section */ - wccp2_here_i_am_header.length += sizeof(struct wccp2_identity_info_t); - assert(wccp2_here_i_am_header.length <= WCCP_RESPONSE_SIZE); - wccp2_identity_info.cache_identity_type = htons(WCCP2_WC_ID_INFO); - wccp2_identity_info.cache_identity_length = htons(sizeof(wccp2_identity_info.cache_identity)); - memset(&wccp2_identity_info.cache_identity.addr, '\0', sizeof(wccp2_identity_info.cache_identity.addr)); - memset(&wccp2_identity_info.cache_identity.hash_revision, '\0', sizeof(wccp2_identity_info.cache_identity.hash_revision)); - memset(&wccp2_identity_info.cache_identity.bits, '\0', sizeof(wccp2_identity_info.cache_identity.bits)); - memset(&wccp2_identity_info.cache_identity.buckets, '\0', sizeof(wccp2_identity_info.cache_identity.buckets)); - wccp2_identity_info.cache_identity.weight = htons(10000); - memset(&wccp2_identity_info.cache_identity.status, '\0', sizeof(wccp2_identity_info.cache_identity.status)); - xmemcpy(ptr, &wccp2_identity_info, sizeof(struct wccp2_identity_info_t)); - service_list_ptr->wccp2_identity_info_ptr = (struct wccp2_identity_info_t *) ptr; - ptr += sizeof(struct wccp2_identity_info_t); + switch (Config.Wccp2.assignment_method) { + case WCCP2_ASSIGNMENT_METHOD_HASH: + wccp2_here_i_am_header.length += sizeof(struct wccp2_identity_info_t); + assert(wccp2_here_i_am_header.length <= WCCP_RESPONSE_SIZE); + wccp2_identity_info.cache_identity_type = htons(WCCP2_WC_ID_INFO); + wccp2_identity_info.cache_identity_length = htons(sizeof(wccp2_identity_info.cache_identity)); + memset(&wccp2_identity_info.cache_identity.addr, '\0', sizeof(wccp2_identity_info.cache_identity.addr)); + memset(&wccp2_identity_info.cache_identity.hash_revision, '\0', sizeof(wccp2_identity_info.cache_identity.hash_revision)); + memset(&wccp2_identity_info.cache_identity.bits, '\0', sizeof(wccp2_identity_info.cache_identity.bits)); + memset(&wccp2_identity_info.cache_identity.buckets, '\0', sizeof(wccp2_identity_info.cache_identity.buckets)); + wccp2_identity_info.cache_identity.weight = htons(Config.Wccp2.weight); + memset(&wccp2_identity_info.cache_identity.status, '\0', sizeof(wccp2_identity_info.cache_identity.status)); + xmemcpy(ptr, &wccp2_identity_info, sizeof(struct wccp2_identity_info_t)); + service_list_ptr->wccp2_identity_info_ptr = ptr; + ptr += sizeof(struct wccp2_identity_info_t); + break; + case WCCP2_ASSIGNMENT_METHOD_MASK: + wccp2_here_i_am_header.length += sizeof(struct wccp2_mask_identity_info_t); + assert(wccp2_here_i_am_header.length <= WCCP_RESPONSE_SIZE); + wccp2_mask_identity_info.cache_identity_type = htons(WCCP2_WC_ID_INFO); + wccp2_mask_identity_info.cache_identity_length = htons(sizeof(wccp2_mask_identity_info.cache_identity)); + memset(&wccp2_mask_identity_info.cache_identity.addr, '\0', sizeof(wccp2_mask_identity_info.cache_identity.addr)); + wccp2_mask_identity_info.cache_identity.num1 = htonl(2); + wccp2_mask_identity_info.cache_identity.num2 = htonl(1); + service_flags = ntohl(service_list_ptr->service_info->service_flags); + if ((service_flags & WCCP2_SERVICE_SRC_IP_HASH) || (service_flags & WCCP2_SERVICE_SRC_IP_ALT_HASH)) { + wccp2_mask_identity_info.cache_identity.source_ip_mask = htonl(0x00001741); + wccp2_mask_identity_info.cache_identity.dest_ip_mask = 0; + wccp2_mask_identity_info.cache_identity.source_port_mask = 0; + wccp2_mask_identity_info.cache_identity.dest_port_mask = 0; + } else if ((service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) { + wccp2_mask_identity_info.cache_identity.source_ip_mask = 0; + wccp2_mask_identity_info.cache_identity.dest_ip_mask = htonl(0x00001741); + wccp2_mask_identity_info.cache_identity.source_port_mask = 0; + wccp2_mask_identity_info.cache_identity.dest_port_mask = 0; + } else if ((service_flags & WCCP2_SERVICE_SRC_PORT_HASH) || (service_flags & WCCP2_SERVICE_SRC_PORT_ALT_HASH)) { + wccp2_mask_identity_info.cache_identity.source_ip_mask = 0; + wccp2_mask_identity_info.cache_identity.dest_ip_mask = 0; + wccp2_mask_identity_info.cache_identity.source_port_mask = htons(0x1741); + wccp2_mask_identity_info.cache_identity.dest_port_mask = 0; + } else if ((service_flags & WCCP2_SERVICE_DST_PORT_HASH) || (service_flags & WCCP2_SERVICE_DST_PORT_ALT_HASH)) { + wccp2_mask_identity_info.cache_identity.source_ip_mask = 0; + wccp2_mask_identity_info.cache_identity.dest_ip_mask = 0; + wccp2_mask_identity_info.cache_identity.source_port_mask = 0; + wccp2_mask_identity_info.cache_identity.dest_port_mask = htons(0x1741); + } else { + fatalf("Unknown service hash method\n"); + } + wccp2_mask_identity_info.cache_identity.num3 = 0; + wccp2_mask_identity_info.cache_identity.num4 = 0; + + xmemcpy(ptr, &wccp2_mask_identity_info, sizeof(struct wccp2_mask_identity_info_t)); + service_list_ptr->wccp2_identity_info_ptr = ptr; + ptr += sizeof(struct wccp2_mask_identity_info_t); + break; + default: + fatalf("Unknown Wccp2 assignment method\n"); + } /* Add the cache view section */ wccp2_here_i_am_header.length += sizeof(wccp2_cache_view_header); @@ -621,7 +722,7 @@ assert(wccp2_here_i_am_header.length <= WCCP_RESPONSE_SIZE); wccp2_capability_element.capability_type = htons(WCCP2_CAPABILITY_ASSIGNMENT_METHOD); wccp2_capability_element.capability_length = htons(sizeof(wccp2_capability_element.capability_value)); - wccp2_capability_element.capability_value = htonl(WCCP2_ASSIGNMENT_METHOD_HASH); + wccp2_capability_element.capability_value = htonl(Config.Wccp2.assignment_method); xmemcpy(ptr, &wccp2_capability_element, sizeof(wccp2_capability_element)); ptr += sizeof(wccp2_capability_element); @@ -783,6 +884,8 @@ struct router_identity_info_t *router_identity_info = NULL; struct router_view_t *router_view_header = NULL; struct wccp2_cache_identity_info_t *cache_identity = NULL; + struct wccp2_cache_mask_identity_info_t *cache_mask_identity = NULL; + struct cache_mask_info_t *cache_mask_info = NULL; struct wccp2_capability_info_header_t *router_capability_header = NULL; struct wccp2_capability_element_t *router_capability_element; @@ -867,6 +970,9 @@ } router_capability_header = (struct wccp2_capability_info_header_t *) &wccp2_i_see_you.data[offset]; break; + /* Nothing to do for the types below */ + case WCCP2_ASSIGN_MAP: + break; default: debug(80, 1) ("Unknown record type in WCCPv2 Packet (%d).\n", ntohs(header->type)); @@ -945,8 +1051,8 @@ } break; case WCCP2_CAPABILITY_ASSIGNMENT_METHOD: - if (!(ntohl(router_capability_element->capability_value) & WCCP2_ASSIGNMENT_METHOD_HASH)) { - debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router has specified a different assignment method %d, expected %d\n", ntohl(router_capability_element->capability_value), WCCP2_ASSIGNMENT_METHOD_HASH); + if (!(ntohl(router_capability_element->capability_value) & Config.Wccp2.assignment_method)) { + debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router has specified a different assignment method %d, expected %d\n", ntohl(router_capability_element->capability_value), Config.Wccp2.assignment_method); wccp2ConnectionClose(); return; } @@ -999,9 +1105,32 @@ /* search through the list of received-from ip addresses */ for (num_caches = 0; num_caches < ntohl(tmp); num_caches++) { /* Get a copy of the ip */ - cache_identity = (struct wccp2_cache_identity_info_t *) ptr; - ptr += sizeof(struct wccp2_cache_identity_info_t); - memcpy(&cache_address, &cache_identity->addr, sizeof(struct in_addr)); + switch (Config.Wccp2.assignment_method) { + case WCCP2_ASSIGNMENT_METHOD_HASH: + cache_identity = (struct wccp2_cache_identity_info_t *) ptr; + ptr += sizeof(struct wccp2_cache_identity_info_t); + memcpy(&cache_address, &cache_identity->addr, sizeof(struct in_addr)); + + cache_list_ptr->weight = ntohs(cache_identity->weight); + break; + case WCCP2_ASSIGNMENT_METHOD_MASK: + cache_mask_info = (struct cache_mask_info_t *) ptr; + + /* The mask assignment has an undocumented variable length entry here */ + if (ntohl(cache_mask_info->num1) == 3) { + cache_mask_identity = (struct wccp2_cache_mask_identity_info_t *) ptr; + ptr += sizeof(struct wccp2_cache_mask_identity_info_t); + memcpy(&cache_address, &cache_mask_identity->addr, sizeof(struct in_addr)); + } else { + ptr += sizeof(struct cache_mask_info_t); + memcpy(&cache_address, &cache_mask_info->addr, sizeof(struct in_addr)); + } + + cache_list_ptr->weight = 0; + break; + default: + fatalf("Unknown Wccp2 assignment method\n"); + } /* Update the cache list */ cache_list_ptr->cache_ip = cache_address; @@ -1019,6 +1148,7 @@ } } } else { + debug(80, 5) ("Adding ourselves as the only cache\n"); /* Update the cache list */ cache_list_ptr->cache_ip = router_list_ptr->local_ip; @@ -1026,7 +1156,7 @@ cache_list_ptr = cache_list_ptr->next; cache_list_ptr->next = NULL; - service_list_ptr->lowest_ip = 0; + service_list_ptr->lowest_ip = 1; found = 1; num_caches = 1; } @@ -1038,8 +1168,11 @@ router_list_ptr->member_change = ntohl(router_view_header->change_number); eventDelete(wccp2AssignBuckets, NULL); eventAdd("wccp2AssignBuckets", wccp2AssignBuckets, NULL, 15.0, 1); + } else { + debug(80, 5) ("Change not detected (%d = %d)\n", ntohl(router_view_header->change_number), router_list_ptr->member_change); } } else { + eventDelete(wccp2AssignBuckets, NULL); debug(80, 5) ("I am not the lowest ip cache - not assigning buckets\n"); } } @@ -1049,6 +1182,8 @@ { struct wccp2_service_list_t *service_list_ptr; struct wccp2_router_list_t *router_list_ptr; + struct wccp2_identity_info_t *wccp2_identity_info_ptr; + struct wccp2_mask_identity_info_t *wccp2_mask_identity_info_ptr; struct sockaddr_in router; int router_len; u_short port = WCCP_PORT; @@ -1076,7 +1211,19 @@ router.sin_addr = router_list_ptr->router_sendto_address; /* Set the cache id (ip) */ - service_list_ptr->wccp2_identity_info_ptr->cache_identity.addr = router_list_ptr->local_ip; + switch (Config.Wccp2.assignment_method) { + case WCCP2_ASSIGNMENT_METHOD_HASH: + wccp2_identity_info_ptr = (struct wccp2_identity_info_t *) service_list_ptr->wccp2_identity_info_ptr; + wccp2_identity_info_ptr->cache_identity.addr = router_list_ptr->local_ip; + break; + case WCCP2_ASSIGNMENT_METHOD_MASK: + wccp2_mask_identity_info_ptr = (struct wccp2_mask_identity_info_t *) service_list_ptr->wccp2_identity_info_ptr; + wccp2_mask_identity_info_ptr->cache_identity.addr = router_list_ptr->local_ip; + break; + default: + fatalf("Unknown Wccp2 assignment method\n"); + } + /* Security update, if needed */ if (service_list_ptr->wccp2_security_type == WCCP2_MD5_SECURITY) { wccp2_update_md5_security(service_list_ptr->wccp_password, (char *) service_list_ptr->security_info, service_list_ptr->wccp_packet, service_list_ptr->wccp_packet_size); @@ -1110,10 +1257,11 @@ struct wccp2_router_list_t *router_list_ptr; struct wccp2_cache_list_t *cache_list_ptr; char wccp_packet[WCCP_RESPONSE_SIZE]; - short int offset, saved_offset; + short int offset, saved_offset, assignment_offset, alt_assignment_offset; struct sockaddr_in router; int router_len; int bucket_counter; + uint32_t service_flags; u_short port = WCCP_PORT; /* Packet segments */ @@ -1121,13 +1269,21 @@ struct wccp2_security_md5_t *security = NULL; /* service from service struct */ struct wccp2_item_header_t *assignment_header; + struct wccp2_item_header_t *alt_assignment_type_header = NULL; struct assignment_key_t *assignment_key; /* number of routers */ struct wccp2_router_assign_element_t *router_assign; /* number of caches */ struct in_addr *cache_address; + /* Alternative assignement mask/values */ + int num_maskval; + struct wccp2_mask_element_t *mask_element; + struct wccp2_value_element_t *value_element; + int valuecounter, value; char *buckets; + assignment_offset = alt_assignment_offset = 0; + router_len = sizeof(router); memset(&router, '\0', router_len); router.sin_family = AF_INET; @@ -1176,8 +1332,27 @@ /* assignment header - fill in length later */ assignment_header = (struct wccp2_item_header_t *) &wccp_packet[offset]; - assignment_header->type = htons(WCCP2_REDIRECT_ASSIGNMENT); - offset += sizeof(struct wccp2_item_header_t); + switch (Config.Wccp2.assignment_method) { + case WCCP2_ASSIGNMENT_METHOD_HASH: + assignment_header->type = htons(WCCP2_REDIRECT_ASSIGNMENT); + offset += sizeof(struct wccp2_item_header_t); + assignment_offset = offset; + break; + case WCCP2_ASSIGNMENT_METHOD_MASK: + assignment_header->type = htons(WCCP2_ALT_ASSIGNMENT); + offset += sizeof(struct wccp2_item_header_t); + assignment_offset = offset; + + /* The alternative assignment has an extra header, fill in length later */ + alt_assignment_type_header = (struct wccp2_item_header_t *) &wccp_packet[offset]; + alt_assignment_type_header->type = htons(WCCP2_MASK_ASSIGNMENT); + offset += sizeof(struct wccp2_item_header_t); + alt_assignment_offset = offset; + + break; + default: + fatalf("Unknown Wccp2 assignment method\n"); + } /* Assignment key - fill in master ip later */ assignment_key = (struct assignment_key_t *) &wccp_packet[offset]; @@ -1200,35 +1375,150 @@ saved_offset = offset; for (router_list_ptr = &service_list_ptr->router_list_head; router_list_ptr->next != NULL; router_list_ptr = router_list_ptr->next) { + unsigned long *weight = xcalloc(sizeof(*weight), ntohl(router_list_ptr->num_caches)); + unsigned long total_weight = 0; + int num_caches = ntohl(router_list_ptr->num_caches); offset = saved_offset; - /* Number of caches */ - xmemcpy(&wccp_packet[offset], &router_list_ptr->num_caches, sizeof(router_list_ptr->num_caches)); - offset += sizeof(router_list_ptr->num_caches); - - if (ntohl(router_list_ptr->num_caches)) { - for (cache_list_ptr = &router_list_ptr->cache_list_head; cache_list_ptr->next; cache_list_ptr = cache_list_ptr->next) { - /* add caches */ - cache_address = (struct in_addr *) &wccp_packet[offset]; - xmemcpy(cache_address, &cache_list_ptr->cache_ip, sizeof(struct in_addr)); - offset += sizeof(struct in_addr); + switch (Config.Wccp2.assignment_method) { + case WCCP2_ASSIGNMENT_METHOD_HASH: + /* Number of caches */ + xmemcpy(&wccp_packet[offset], &router_list_ptr->num_caches, sizeof(router_list_ptr->num_caches)); + offset += sizeof(router_list_ptr->num_caches); + + if (num_caches) { + int cache; + for (cache = 0, cache_list_ptr = &router_list_ptr->cache_list_head; cache_list_ptr->next; cache_list_ptr = cache_list_ptr->next, cache++) { + /* add caches */ + cache_address = (struct in_addr *) &wccp_packet[offset]; + xmemcpy(cache_address, &cache_list_ptr->cache_ip, sizeof(struct in_addr)); + total_weight += cache_list_ptr->weight << 12; + weight[cache] = cache_list_ptr->weight << 12; + offset += sizeof(struct in_addr); + } } - } - /* Add buckets */ - buckets = (char *) &wccp_packet[offset]; - memset(buckets, '\0', WCCP_BUCKETS); - if (ntohl(router_list_ptr->num_caches) != 0) { - for (bucket_counter = 0; bucket_counter < WCCP_BUCKETS; bucket_counter++) { - buckets[bucket_counter] = (char) (bucket_counter % ntohl(router_list_ptr->num_caches)); + /* Add buckets */ + buckets = (char *) &wccp_packet[offset]; + memset(buckets, '\0', WCCP_BUCKETS); + if (num_caches != 0) { + if (total_weight == 0) { + for (bucket_counter = 0; bucket_counter < WCCP_BUCKETS; bucket_counter++) { + buckets[bucket_counter] = (char) (bucket_counter % num_caches); + } + } else { + unsigned long *assigned = xcalloc(sizeof(*assigned), num_caches); + unsigned long done = 0; + int cache = -1; + unsigned long per_bucket = total_weight / WCCP_BUCKETS; + for (bucket_counter = 0; bucket_counter < WCCP_BUCKETS; bucket_counter++) { + int n; + unsigned long step; + for (n = num_caches; n; n--) { + cache++; + if (cache >= num_caches) + cache = 0; + if (!weight[cache]) { + n++; + continue; + } + if (assigned[cache] <= done) + break; + } + buckets[bucket_counter] = (char) cache; + step = per_bucket * total_weight / weight[cache]; + assigned[cache] += step; + done += per_bucket; + } + safe_free(assigned); + } } - } - offset += (WCCP_BUCKETS * sizeof(char)); + offset += (WCCP_BUCKETS * sizeof(char)); + safe_free(weight); + break; + case WCCP2_ASSIGNMENT_METHOD_MASK: + num_maskval = htonl(1); + xmemcpy(&wccp_packet[offset], &num_maskval, sizeof(int)); + offset += sizeof(int); + + mask_element = (struct wccp2_mask_element_t *) &wccp_packet[offset]; + service_flags = ntohl(service_list_ptr->service_info->service_flags); + if ((service_flags & WCCP2_SERVICE_SRC_IP_HASH) || (service_flags & WCCP2_SERVICE_SRC_IP_ALT_HASH)) { + mask_element->source_ip_mask = htonl(0x00001741); + mask_element->dest_ip_mask = 0; + mask_element->source_port_mask = 0; + mask_element->dest_port_mask = 0; + } else if ((service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) { + mask_element->source_ip_mask = 0; + mask_element->dest_ip_mask = htonl(0x00001741); + mask_element->source_port_mask = 0; + mask_element->dest_port_mask = 0; + } else if ((service_flags & WCCP2_SERVICE_SRC_PORT_HASH) || (service_flags & WCCP2_SERVICE_SRC_PORT_ALT_HASH)) { + mask_element->source_ip_mask = 0; + mask_element->dest_ip_mask = 0; + mask_element->source_port_mask = htons(0x1741); + mask_element->dest_port_mask = 0; + } else if ((service_flags & WCCP2_SERVICE_DST_PORT_HASH) || (service_flags & WCCP2_SERVICE_DST_PORT_ALT_HASH)) { + mask_element->source_ip_mask = 0; + mask_element->dest_ip_mask = 0; + mask_element->source_port_mask = 0; + mask_element->dest_port_mask = htons(0x1741); + } else { + fatalf("Unknown service hash method\n"); + } + mask_element->number_values = htonl(64); + offset += sizeof(struct wccp2_mask_element_t); + + cache_list_ptr = &router_list_ptr->cache_list_head; + value = 0; + for (valuecounter = 0; valuecounter < 64; valuecounter++) { + value_element = (struct wccp2_value_element_t *) &wccp_packet[offset]; + + if ((service_flags & WCCP2_SERVICE_SRC_IP_HASH) || (service_flags & WCCP2_SERVICE_SRC_IP_ALT_HASH)) { + value_element->source_ip_value = htonl(value); + value_element->dest_ip_value = 0; + value_element->source_port_value = 0; + value_element->dest_port_value = 0; + } else if ((service_flags & WCCP2_SERVICE_DST_IP_HASH) || (service_flags & WCCP2_SERVICE_DST_IP_ALT_HASH)) { + value_element->source_ip_value = 0; + value_element->dest_ip_value = htonl(value); + value_element->source_port_value = 0; + value_element->dest_port_value = 0; + } else if ((service_flags & WCCP2_SERVICE_SRC_PORT_HASH) || (service_flags & WCCP2_SERVICE_SRC_PORT_ALT_HASH)) { + value_element->source_ip_value = 0; + value_element->dest_ip_value = 0; + value_element->source_port_value = htons(value); + value_element->dest_port_value = 0; + } else if ((service_flags & WCCP2_SERVICE_DST_PORT_HASH) || (service_flags & WCCP2_SERVICE_DST_PORT_ALT_HASH)) { + value_element->source_ip_value = 0; + value_element->dest_ip_value = 0; + value_element->source_port_value = 0; + value_element->dest_port_value = htons(value); + } else { + fatalf("Unknown service hash method\n"); + } + value_element->cache_ip = cache_list_ptr->cache_ip; + offset += sizeof(struct wccp2_value_element_t); + + /* Update the value according the the "correct" formula */ + for (value++; (value & 0x1741) != value; value++) { + assert(value <= 0x1741); + } + + /* Assign the next value to the next cache */ + if ((cache_list_ptr->next) && (cache_list_ptr->next->next)) + cache_list_ptr = cache_list_ptr->next; + else + cache_list_ptr = &router_list_ptr->cache_list_head; + } + /* Fill in length */ + alt_assignment_type_header->length = htons(offset - alt_assignment_offset); + break; + default: + fatalf("Unknown Wccp2 assignment method\n"); + } /* Fill in length */ - assignment_header->length = htons(sizeof(struct assignment_key_t) + sizeof(service_list_ptr->num_routers) + - (ntohl(service_list_ptr->num_routers) * sizeof(struct wccp2_router_assign_element_t)) + - sizeof (router_list_ptr->num_caches) + (ntohl(router_list_ptr->num_caches) * sizeof(struct in_addr)) + - (WCCP_BUCKETS * sizeof(char))); + assignment_header->length = htons(offset - assignment_offset); /* Fill in assignment key */ assignment_key->master_ip = router_list_ptr->local_ip; @@ -1383,7 +1673,7 @@ } else if (strcmp(flag, "dst_ip_hash") == 0) { retflag |= WCCP2_SERVICE_DST_IP_HASH; } else if (strcmp(flag, "source_port_hash") == 0) { - retflag |= WCCP2_SERVICE_SOURCE_PORT_HASH; + retflag |= WCCP2_SERVICE_SRC_PORT_HASH; } else if (strcmp(flag, "dst_port_hash") == 0) { retflag |= WCCP2_SERVICE_DST_PORT_HASH; } else if (strcmp(flag, "ports_source") == 0) { @@ -1451,7 +1741,7 @@ return; } debug(80, 5) ("parse_wccp2_service_info: called\n"); - bzero(portlist, sizeof(portlist)); + memset(portlist, 0, sizeof(portlist)); /* First argument: id */ service_id = GetInteger(); if (service_id < 0 || service_id > 255) { @@ -1539,7 +1829,7 @@ storeAppendPrintf(e, "%sdst_ip_hash", comma ? "," : ""); comma = 1; } - if (flags & WCCP2_SERVICE_SOURCE_PORT_HASH) { + if (flags & WCCP2_SERVICE_SRC_PORT_HASH) { storeAppendPrintf(e, "%ssource_port_hash", comma ? "," : ""); comma = 1; } diff -ruN squid-2.6.STABLE3/src/whois.c squid-2.6.STABLE4/src/whois.c --- squid-2.6.STABLE3/src/whois.c Wed May 24 21:44:02 2006 +++ squid-2.6.STABLE4/src/whois.c Fri Aug 25 06:26:07 2006 @@ -1,6 +1,6 @@ /* - * $Id: whois.c,v 1.21 2006/05/25 03:44:02 hno Exp $ + * $Id: whois.c,v 1.22 2006/08/25 12:26:07 serassio Exp $ * * DEBUG: section 75 WHOIS protocol * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -118,7 +118,7 @@ commSetSelect(fd, COMM_SELECT_READ, whoisReadReply, p, Config.Timeout.read); } else { ErrorState *err; - err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR); + err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR, p->fwd->request); err->xerrno = errno; fwdFail(p->fwd, err); comm_close(fd); diff -ruN squid-2.6.STABLE3/src/win32.c squid-2.6.STABLE4/src/win32.c --- squid-2.6.STABLE3/src/win32.c Sat Jun 24 03:35:40 2006 +++ squid-2.6.STABLE4/src/win32.c Sat Sep 23 04:42:44 2006 @@ -1,11 +1,10 @@ /* - * $Id: win32.c,v 1.11 2006/06/24 09:35:40 serassio Exp $ + * $Id: win32.c,v 1.16 2006/09/23 10:42:44 serassio Exp $ * - * * * * * * * * Legal stuff * * * * * * * - * - * (C) 2001 Guido Serassio , - * inspired by previous work by Romeo Anghelache & Eric Stern. + * Windows support + * AUTHOR: Guido Serassio + * inspired by previous work by Romeo Anghelache & Eric Stern. * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -28,21 +27,29 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ -#ifndef WIN32_C #define WIN32_C #include "squid.h" -/* This code compiles only CygWin & Windows NT Port */ +/* This code compiles only Cygwin & native Windows Port */ #ifdef _SQUID_WIN32_ #include +#ifdef _SQUID_MSWIN_ +#if HAVE_WIN32_PSAPI +#include +#endif +#ifndef _MSWSOCK_ +#include +#endif +#include +#endif static unsigned int GetOSVersion(); void WIN32_svcstatusupdate(DWORD, DWORD); @@ -52,6 +59,14 @@ static void WIN32_build_argv(char *); void WINAPI SquidWinSvcMain(DWORD, char **); +#if defined(_SQUID_MSWIN_) +static int Win32SockInit(void); +static void Win32SockCleanup(void); +extern LPCRITICAL_SECTION dbg_mutex; +void WIN32_ExceptionHandlerCleanup(void); +static LPTOP_LEVEL_EXCEPTION_FILTER Win32_Old_ExceptionHandler = NULL; +#endif /* _SQUID_MSWIN_ */ + static SERVICE_STATUS svcStatus; static SERVICE_STATUS_HANDLE svcHandle; static int WIN32_argc; @@ -319,6 +334,9 @@ void WIN32_Exit() { +#ifdef _SQUID_MSWIN_ + Win32SockCleanup(); +#endif #if USE_WIN32_SERVICE if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) { if (!Squid_Aborting) { @@ -327,6 +345,11 @@ } } #endif +#ifdef _SQUID_MSWIN_ + if (dbg_mutex) + DeleteCriticalSection(dbg_mutex); + WIN32_ExceptionHandlerCleanup(); +#endif _exit(0); } @@ -398,8 +421,15 @@ svcStatus.dwCheckPoint = 0; svcStatus.dwWaitHint = 10000; SetServiceStatus(svcHandle, &svcStatus); +#ifdef _SQUID_MSWIN_ + _setmaxstdio(Squid_MaxFD); +#endif } #endif +#ifdef _SQUID_MSWIN_ + if (Win32SockInit() < 0) + return 1; +#endif return 0; } @@ -718,6 +748,197 @@ return 0; } #endif + +#if defined(_SQUID_MSWIN_) +static int s_iInitCount = 0; + +int +WIN32_pipe(int handles[2]) +{ + int new_socket; + fde *F = NULL; + + struct sockaddr_in serv_addr; + int len = sizeof(serv_addr); + u_short handle1_port; + + handles[0] = handles[1] = -1; + + statCounter.syscalls.sock.sockets++; + if ((new_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) + return -1; + + memset((void *) &serv_addr, 0, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(0); + serv_addr.sin_addr = local_addr; + + if (bind(new_socket, (SOCKADDR *) & serv_addr, len) < 0 || + listen(new_socket, 1) < 0 || getsockname(new_socket, (SOCKADDR *) & serv_addr, &len) < 0 || + (handles[1] = socket(PF_INET, SOCK_STREAM, 0)) < 0) { + closesocket(new_socket); + return -1; + } + handle1_port = ntohs(serv_addr.sin_port); + if (connect(handles[1], (SOCKADDR *) & serv_addr, len) < 0 || + (handles[0] = accept(new_socket, (SOCKADDR *) & serv_addr, &len)) < 0) { + closesocket(handles[1]); + handles[1] = -1; + closesocket(new_socket); + return -1; + } + closesocket(new_socket); + + F = &fd_table[handles[0]]; + F->local_addr = local_addr; + F->local_port = ntohs(serv_addr.sin_port); + + F = &fd_table[handles[1]]; + F->local_addr = local_addr; + xstrncpy(F->ipaddr, inet_ntoa(local_addr), 16); + F->remote_port = handle1_port; + + return 0; +} + +int +WIN32_getrusage(int who, struct rusage *usage) +{ +#if HAVE_WIN32_PSAPI + if ((WIN32_OS_version == _WIN_OS_WINNT) || (WIN32_OS_version == _WIN_OS_WIN2K) + || (WIN32_OS_version == _WIN_OS_WINXP) || (WIN32_OS_version == _WIN_OS_WINNET)) { + /* On Windows NT/2000 call PSAPI.DLL for process Memory */ + /* informations -- Guido Serassio */ + HANDLE hProcess; + PROCESS_MEMORY_COUNTERS pmc; + hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | + PROCESS_VM_READ, + FALSE, GetCurrentProcessId()); + { + /* Microsoft CRT doesn't have getrusage function, */ + /* so we get process CPU time information from PSAPI.DLL. */ + FILETIME ftCreate, ftExit, ftKernel, ftUser; + if (GetProcessTimes(hProcess, &ftCreate, &ftExit, &ftKernel, &ftUser)) { + PFILETIME p_ftUser = &ftUser; + PFILETIME p_ftKernel = &ftKernel; + int64_t tUser64 = (*(int64_t *) p_ftUser / 10); + int64_t tKernel64 = (*(int64_t *) p_ftKernel / 10); + usage->ru_utime.tv_sec = (long) (tUser64 / 1000000); + usage->ru_stime.tv_sec = (long) (tKernel64 / 1000000); + usage->ru_utime.tv_usec = (long) (tUser64 % 1000000); + usage->ru_stime.tv_usec = (long) (tKernel64 % 1000000); + } else { + CloseHandle(hProcess); + return -1; + } + } + if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc))) { + usage->ru_maxrss = (DWORD) (pmc.WorkingSetSize / getpagesize()); + usage->ru_majflt = pmc.PageFaultCount; + } else { + CloseHandle(hProcess); + return -1; + } + CloseHandle(hProcess); + } #endif + return 0; +} + +static int +Win32SockInit(void) +{ + int iVersionRequested; + WSADATA wsaData; + int err, opt; + int optlen = sizeof(opt); + + + if (s_iInitCount > 0) { + s_iInitCount++; + return (0); + } else if (s_iInitCount < 0) + return (s_iInitCount); + /* s_iInitCount == 0. Do the initailization */ + iVersionRequested = MAKEWORD(2, 0); + err = WSAStartup((WORD) iVersionRequested, &wsaData); + if (err) { + s_iInitCount = -1; + return (s_iInitCount); + } + if (LOBYTE(wsaData.wVersion) != 2 || + HIBYTE(wsaData.wVersion) != 0) { + s_iInitCount = -2; + WSACleanup(); + return (s_iInitCount); + } + if (WIN32_OS_version != _WIN_OS_WINNT) { + if (getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, &optlen)) { + s_iInitCount = -3; + WSACleanup(); + return (s_iInitCount); + } else { + opt = opt | SO_SYNCHRONOUS_NONALERT; + if (setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, optlen)) { + s_iInitCount = -3; + WSACleanup(); + return (s_iInitCount); + } + } + } + WIN32_Socks_initialized = 1; + s_iInitCount++; + return (s_iInitCount); +} + +static void +Win32SockCleanup(void) +{ + if (--s_iInitCount == 0) + WSACleanup(); + return; +} + +LONG CALLBACK +WIN32_ExceptionHandler(EXCEPTION_POINTERS * ep) +{ + EXCEPTION_RECORD *er; + + er = ep->ExceptionRecord; + + switch (er->ExceptionCode) { + case EXCEPTION_ACCESS_VIOLATION: + raise(SIGSEGV); + break; + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_IN_PAGE_ERROR: + death(SIGBUS); + break; + default: + break; + } + + return EXCEPTION_CONTINUE_SEARCH; +} + + +void +WIN32_ExceptionHandlerInit() +{ +#if !defined(_DEBUG) + if (Win32_Old_ExceptionHandler == NULL) + Win32_Old_ExceptionHandler = SetUnhandledExceptionFilter(WIN32_ExceptionHandler); +#endif +} + +void +WIN32_ExceptionHandlerCleanup() +{ + if (Win32_Old_ExceptionHandler != NULL) + SetUnhandledExceptionFilter(Win32_Old_ExceptionHandler); +} + +#endif /* _SQUID_MSWIN_ */ -#endif /* WIN32_C */ +#endif /* _SQUID_WIN32_ */ diff -ruN squid-2.6.STABLE3/tools/Makefile.am squid-2.6.STABLE4/tools/Makefile.am --- squid-2.6.STABLE3/tools/Makefile.am Thu Jul 6 02:35:32 2006 +++ squid-2.6.STABLE4/tools/Makefile.am Fri Sep 22 03:08:46 2006 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.2 2006/07/06 08:35:32 adrian Exp $ +# $Id: Makefile.am,v 1.3 2006/09/22 09:08:46 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -16,9 +16,15 @@ SUBDIRS = +if NEED_COSSDUMP +COSSDUMP = cossdump +else +COSSDUMP = +endif + bin_PROGRAMS = \ squidclient \ - cossdump + $(COSSDUMP) libexec_PROGRAMS = \ cachemgr$(CGIEXT) diff -ruN squid-2.6.STABLE3/tools/Makefile.in squid-2.6.STABLE4/tools/Makefile.in --- squid-2.6.STABLE3/tools/Makefile.in Thu Jul 6 02:35:32 2006 +++ squid-2.6.STABLE4/tools/Makefile.in Fri Sep 22 03:09:50 2006 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.6 2006/07/06 08:35:32 adrian Exp $ +# $Id: Makefile.in,v 1.9 2006/09/22 09:09:50 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -45,7 +45,7 @@ build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = -bin_PROGRAMS = squidclient$(EXEEXT) cossdump$(EXEEXT) +bin_PROGRAMS = squidclient$(EXEEXT) $(am__EXEEXT_1) libexec_PROGRAMS = cachemgr$(CGIEXT)$(EXEEXT) subdir = tools DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in @@ -57,6 +57,7 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/cfgaux/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/autoconf.h CONFIG_CLEAN_FILES = +@NEED_COSSDUMP_TRUE@am__EXEEXT_1 = cossdump$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) libexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM) @@ -129,6 +130,8 @@ EGREP = @EGREP@ ENABLE_HTCP_FALSE = @ENABLE_HTCP_FALSE@ ENABLE_HTCP_TRUE = @ENABLE_HTCP_TRUE@ +ENABLE_MINGW32SPECIFIC_FALSE = @ENABLE_MINGW32SPECIFIC_FALSE@ +ENABLE_MINGW32SPECIFIC_TRUE = @ENABLE_MINGW32SPECIFIC_TRUE@ ENABLE_PINGER_FALSE = @ENABLE_PINGER_FALSE@ ENABLE_PINGER_TRUE = @ENABLE_PINGER_TRUE@ ENABLE_SSL_FALSE = @ENABLE_SSL_FALSE@ @@ -169,6 +172,8 @@ MAKE_LEAKFINDER_TRUE = @MAKE_LEAKFINDER_TRUE@ MKDIR = @MKDIR@ MV = @MV@ +NEED_COSSDUMP_FALSE = @NEED_COSSDUMP_FALSE@ +NEED_COSSDUMP_TRUE = @NEED_COSSDUMP_TRUE@ NEED_DISKD_FALSE = @NEED_DISKD_FALSE@ NEED_DISKD_TRUE = @NEED_DISKD_TRUE@ NEED_OWN_MD5_FALSE = @NEED_OWN_MD5_FALSE@ @@ -206,6 +211,8 @@ STORE_OBJS = @STORE_OBJS@ STRIP = @STRIP@ TRUE = @TRUE@ +USE_AIOPS_WIN32_FALSE = @USE_AIOPS_WIN32_FALSE@ +USE_AIOPS_WIN32_TRUE = @USE_AIOPS_WIN32_TRUE@ USE_DELAY_POOLS_FALSE = @USE_DELAY_POOLS_FALSE@ USE_DELAY_POOLS_TRUE = @USE_DELAY_POOLS_TRUE@ USE_DNSSERVER_FALSE = @USE_DNSSERVER_FALSE@ @@ -223,6 +230,7 @@ USE_SNMP_FALSE = @USE_SNMP_FALSE@ USE_SNMP_TRUE = @USE_SNMP_TRUE@ VERSION = @VERSION@ +WIN32_PSAPI = @WIN32_PSAPI@ XTRA_LIBS = @XTRA_LIBS@ XTRA_OBJS = @XTRA_OBJS@ ac_ct_CC = @ac_ct_CC@ @@ -268,6 +276,8 @@ INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/lib/libTrie/include TESTS = $(check_PROGRAMS) SUBDIRS = +@NEED_COSSDUMP_FALSE@COSSDUMP = +@NEED_COSSDUMP_TRUE@COSSDUMP = cossdump squidclient_SOURCES = squidclient.c cossdump_SOURCES = cossdump.c cachemgr__CGIEXT__SOURCES = cachemgr.c diff -ruN squid-2.6.STABLE3/tools/cachemgr.c squid-2.6.STABLE4/tools/cachemgr.c --- squid-2.6.STABLE3/tools/cachemgr.c Tue Jun 6 11:38:59 2006 +++ squid-2.6.STABLE4/tools/cachemgr.c Sun Sep 10 14:06:44 2006 @@ -1,6 +1,6 @@ /* - * $Id: cachemgr.c,v 1.4 2006/06/06 17:38:59 hno Exp $ + * $Id: cachemgr.c,v 1.5 2006/09/10 20:06:44 serassio Exp $ * * DEBUG: section 0 CGI Cache Manager * AUTHOR: Duane Wessels @@ -179,11 +179,7 @@ static void error_html(const char *msg); static char *menu_url(cachemgr_request * req, const char *action); static int parse_status_line(const char *sline, const char **statusStr); -#ifdef _SQUID_MSWIN_ -static cachemgr_request *read_request(char *); -#else static cachemgr_request *read_request(void); -#endif static char *read_get_request(void); static char *read_post_request(void); @@ -196,7 +192,8 @@ #ifdef _SQUID_MSWIN_ static int s_iInitCount = 0; -int + +int Win32SockInit(void) { int iVersionRequested; @@ -226,7 +223,7 @@ return (s_iInitCount); } -void +void Win32SockCleanup(void) { if (--s_iInitCount == 0) @@ -527,7 +524,8 @@ char buf[4 * 1024]; #ifdef _SQUID_MSWIN_ int reply; - FILE *fp = tmpfile(); + char *tmpfile = tempnam(NULL, "tmp0000"); + FILE *fp = fopen(tmpfile, "w+"); #else FILE *fp = fdopen(s, "r"); #endif @@ -544,7 +542,14 @@ else if (0 == strcasecmp(req->action, "menu")) parse_menu = 1; if (fp == NULL) { +#ifdef _SQUID_MSWIN_ + perror(tmpfile); + xfree(tmpfile); + closesocket(s); +#else perror("fdopen"); + close(s); +#endif return 1; } #ifdef _SQUID_MSWIN_ @@ -648,7 +653,14 @@ istate = isError; } } +#ifdef _SQUID_MSWIN_ + fclose(fp); + remove(tmpfile); + xfree(tmpfile); + closesocket(s); +#else close(s); +#endif return 0; } @@ -659,9 +671,6 @@ static struct sockaddr_in S; int s; int l; -#ifdef _SQUID_MSWIN_ - int answer; -#endif static char buf[2 * 1024]; if (req == NULL) { auth_html(CACHEMGR_HOSTNAME, CACHE_HTTP_PORT, ""); @@ -722,13 +731,7 @@ write(s, buf, l); #endif debug(1) fprintf(stderr, "wrote request: '%s'\n", buf); -#ifdef _SQUID_MSWIN_ - answer = read_reply(s, req); - closesocket(s); - return answer; -#else return read_reply(s, req); -#endif } int @@ -736,13 +739,11 @@ { char *s; cachemgr_request *req; -#ifdef _SQUID_MSWIN_ - int answer; -#endif safe_inet_addr("255.255.255.255", &no_addr); now = time(NULL); #ifdef _SQUID_MSWIN_ Win32SockInit(); + atexit(Win32SockCleanup); _setmode(_fileno(stdin), _O_BINARY); _setmode(_fileno(stdout), _O_BINARY); _fmode = _O_BINARY; @@ -755,16 +756,10 @@ progname = xstrdup(argv[0]); if ((s = getenv("SCRIPT_NAME")) != NULL) script_name = xstrdup(s); -#ifdef _SQUID_MSWIN_ - req = read_request(NULL); - answer = process_request(req); - Win32SockCleanup(); - return answer; -#else req = read_request(); return process_request(req); -#endif } + static char * read_post_request(void) { @@ -784,6 +779,7 @@ buf[len] = '\0'; return buf; } + static char * read_get_request(void) { @@ -793,16 +789,10 @@ return xstrdup(s); } -#ifdef _SQUID_MSWIN_ -static cachemgr_request * -read_request(char *buf) -{ -#else static cachemgr_request * read_request(void) { char *buf; -#endif cachemgr_request *req; char *s; char *t; diff -ruN squid-2.6.STABLE3/tools/cossdump.c squid-2.6.STABLE4/tools/cossdump.c --- squid-2.6.STABLE3/tools/cossdump.c Sun Aug 6 11:12:56 2006 +++ squid-2.6.STABLE4/tools/cossdump.c Sun Sep 3 19:02:16 2006 @@ -12,7 +12,9 @@ #if HAVE_UNISTD_H #include #endif +#if HAVE_ASSERT_H #include +#endif #if HAVE_STRING_H #include #endif @@ -177,7 +179,7 @@ #define BLKBITS 10 static void -parse_stripe(int stripeid, char *buf, int len) +parse_stripe(int stripeid, char *buf, int len, int blocksize) { int j = 0; int bl = 0; @@ -193,7 +195,7 @@ printf(" Object: NULL\n"); return; } - printf(" Object: (filen %d) hdr size %d\n", j / BLOCKSIZE + (stripeid * STRIPESIZE / BLOCKSIZE), bl); + printf(" Object: (filen %d) hdr size %d\n", j / blocksize + (stripeid * STRIPESIZE / blocksize), bl); for (t = tlv_list; t; t = t->next) { switch (t->type) { case STORE_META_URL: @@ -212,8 +214,8 @@ } j = j + *l + bl; /* And now, the blocksize! */ - tmp = j / BLOCKSIZE; - tmp = (tmp + 1) * BLOCKSIZE; + tmp = j / blocksize; + tmp = (tmp + 1) * blocksize; j = tmp; } } @@ -224,9 +226,12 @@ int fd; char buf[STRIPESIZE]; int i = 0, len; + unsigned int numstripes = 0; + int blocksize = BLOCKSIZE; + int blksize_bits; - if (argc < 2) { - printf("Usage: %s \n", argv[0]); + if (argc < 4) { + printf("Usage: %s \n", argv[0]); exit(1); } fd = open(argv[1], O_RDONLY); @@ -234,10 +239,24 @@ perror("open"); exit(1); } + + blocksize = (unsigned int) atoi(argv[2]); + for(blksize_bits = 0;((blocksize >> blksize_bits) > 0);blksize_bits++) { + if( ((blocksize >> blksize_bits) > 0) && + (((blocksize >> blksize_bits) << blksize_bits) != blocksize)) { + printf("Blocksize bits must be a power of 2\n"); + exit(1); + } + } + + numstripes = (unsigned int) atoi(argv[3]); + while ((len = read(fd, buf, STRIPESIZE)) > 0) { printf("STRIPE: %d (len %d)\n", i, len); - parse_stripe(i, buf, len); + parse_stripe(i, buf, len, blocksize); i++; + if((numstripes > 0) && (i >= numstripes)) + break; } return 0; }