summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorArno Töll <debian@toell.net>2012-01-08 22:53:17 +0100
committerArno Töll <debian@toell.net>2012-01-08 22:53:17 +0100
commite072a2dd866b7cb9f14319b80326a4e7fd16fcdf (patch)
treea49dfc56d94a26011fe157835ff6cbe14edbd8a9 /support
parent0890390c00801651d08d3794e13b31a5dabbf5ef (diff)
downloadapache2-e072a2dd866b7cb9f14319b80326a4e7fd16fcdf.tar.gz
Imported Upstream version 2.3.16-beta
Diffstat (limited to 'support')
-rw-r--r--support/Makefile.in5
-rw-r--r--support/NWGNUab4
-rw-r--r--support/NWGNUhtcacheclean6
-rw-r--r--support/NWGNUhtdbm18
-rw-r--r--support/NWGNUhtdigest20
-rw-r--r--support/NWGNUhtpasswd20
-rw-r--r--support/NWGNUhttxt2dbm18
-rw-r--r--support/NWGNUlogres20
-rw-r--r--support/NWGNUmakefile200
-rw-r--r--support/NWGNUrotlogs22
-rw-r--r--support/README2
-rw-r--r--support/ab.c455
-rw-r--r--support/ab.dep16
-rw-r--r--support/ab.mak317
-rw-r--r--support/abs.dep16
-rw-r--r--support/abs.mak336
-rw-r--r--support/apachectl.in5
-rw-r--r--support/apxs.in89
-rwxr-xr-xsupport/check_forensic4
-rw-r--r--support/config.m415
-rw-r--r--support/fcgistarter.c215
-rw-r--r--support/fcgistarter.dsp106
-rw-r--r--support/htcacheclean.c966
-rw-r--r--support/htcacheclean.dep15
-rw-r--r--support/htcacheclean.mak317
-rw-r--r--support/htdbm.c16
-rw-r--r--support/htdbm.dep14
-rw-r--r--support/htdbm.mak317
-rw-r--r--support/htdigest.dep12
-rw-r--r--support/htdigest.mak317
-rw-r--r--support/htpasswd.c20
-rw-r--r--support/htpasswd.dep13
-rw-r--r--support/htpasswd.mak317
-rw-r--r--support/httxt2dbm.c10
-rw-r--r--support/httxt2dbm.dep12
-rw-r--r--support/httxt2dbm.mak317
-rw-r--r--support/logresolve.c504
-rw-r--r--support/logresolve.dep9
-rw-r--r--support/logresolve.mak317
-rw-r--r--support/rotatelogs.c779
-rw-r--r--support/rotatelogs.dep11
-rw-r--r--support/rotatelogs.mak317
-rw-r--r--support/suexec.c64
-rw-r--r--support/suexec.h12
-rw-r--r--support/win32/ApacheMonitor.c591
-rw-r--r--support/win32/ApacheMonitor.dep17
-rw-r--r--support/win32/ApacheMonitor.h4
-rw-r--r--support/win32/ApacheMonitor.mak309
-rw-r--r--support/win32/ApacheMonitor.manifest10
-rw-r--r--support/win32/ApacheMonitor.rc22
-rw-r--r--support/win32/wintty.dep5
-rw-r--r--support/win32/wintty.mak317
52 files changed, 2585 insertions, 5275 deletions
diff --git a/support/Makefile.in b/support/Makefile.in
index 85aff340..b840118b 100644
--- a/support/Makefile.in
+++ b/support/Makefile.in
@@ -50,7 +50,7 @@ htdbm: $(htdbm_OBJECTS)
$(LINK) $(htdbm_LTFLAGS) $(htdbm_OBJECTS) $(PROGRAM_LDADD) $(CRYPT_LIBS)
ab_OBJECTS = ab.lo
-ab_LDADD = $(PROGRAM_LDADD) $(SSL_LIBS)
+ab_LDADD = $(PROGRAM_LDADD) $(SSL_LIBS) $(MATH_LIBS)
ab: $(ab_OBJECTS)
$(LINK) $(ab_LTFLAGS) $(ab_OBJECTS) $(ab_LDADD)
@@ -70,3 +70,6 @@ httxt2dbm_OBJECTS = httxt2dbm.lo
httxt2dbm: $(httxt2dbm_OBJECTS)
$(LINK) $(httxt2dbm_LTFLAGS) $(httxt2dbm_OBJECTS) $(PROGRAM_LDADD)
+fcgistarter_OBJECTS = fcgistarter.lo
+fcgistarter: $(fcgistarter_OBJECTS)
+ $(LINK) $(fcgistarter_LTFLAGS) $(fcgistarter_OBJECTS) $(PROGRAM_LDADD)
diff --git a/support/NWGNUab b/support/NWGNUab
index 8813b5f0..c22b6c16 100644
--- a/support/NWGNUab
+++ b/support/NWGNUab
@@ -164,7 +164,7 @@ NLM_VERSION =
#
# If this is specified, it will override the default of 64K
#
-NLM_STACK_SIZE =
+NLM_STACK_SIZE = 65536
#
@@ -326,5 +326,5 @@ install :: nlms FORCE
# in this makefile
#
-include $(APBUILD)/NWGNUtail.inc
+include $(AP_WORK)/build/NWGNUtail.inc
diff --git a/support/NWGNUhtcacheclean b/support/NWGNUhtcacheclean
index 99199161..f8135278 100644
--- a/support/NWGNUhtcacheclean
+++ b/support/NWGNUhtcacheclean
@@ -16,11 +16,12 @@ endif
# INCDIRS
#
XINCDIRS += \
- $(NWOS) \
+ $(STDMOD)/cache \
$(APR)/include \
$(APRUTIL)/include \
+ $(AP_WORK)/include \
$(APR)/misc/netware \
- $(APR) \
+ $(NWOS) \
$(EOLIST)
#
@@ -250,4 +251,3 @@ install :: nlms FORCE
include $(APBUILD)/NWGNUtail.inc
-
diff --git a/support/NWGNUhtdbm b/support/NWGNUhtdbm
index f448cc3c..05ee0341 100644
--- a/support/NWGNUhtdbm
+++ b/support/NWGNUhtdbm
@@ -20,7 +20,6 @@ XINCDIRS += \
$(APR)/include \
$(APRUTIL)/include \
$(APR)/misc/netware \
- $(APR) \
$(EOLIST)
#
@@ -56,7 +55,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "noopt"
@@ -70,7 +69,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "release"
@@ -92,7 +91,7 @@ endif
# This is used by the link 'name' directive to name the nlm. If left blank
# TARGET_nlm (see below) will be used.
#
-NLM_NAME = htdbm
+NLM_NAME = htdbm
#
# This is used by the link '-desc ' directive.
@@ -116,7 +115,7 @@ NLM_SCREEN_NAME = htdbm Password Management
# If this is specified, it will override VERSION value in
# $(AP_WORK)/build/NWGNUenvironment.inc
#
-NLM_VERSION =
+NLM_VERSION =
#
# If this is specified, it will override the default of 64K
@@ -142,14 +141,14 @@ NLM_CHECK_SYM =
#
# If these are specified it will be used by the link '-flags' directive
#
-NLM_FLAGS =
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
#
# If this is specified it will be linked in with the XDCData option in the def
# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
# by setting APACHE_UNIPROC in the environment
#
-XDCDATA =
+XDCDATA =
#
# If there is an NLM target, put it here
@@ -177,7 +176,7 @@ FILES_nlm_objs = \
# These will be added as a library command in the link.opt file.
#
FILES_nlm_libs = \
- $(PRELUDE) \
+ $(PRELUDE) \
$(EOLIST)
#
@@ -223,7 +222,7 @@ FILES_nlm_exports = \
# Paths must all use the '/' character
#
FILES_lib_objs = \
- $(EOLIST)
+ $(EOLIST)
#
# implement targets and dependancies (leave this section alone)
@@ -250,4 +249,3 @@ install :: nlms FORCE
include $(APBUILD)/NWGNUtail.inc
-
diff --git a/support/NWGNUhtdigest b/support/NWGNUhtdigest
index 5674d21d..fa5abc11 100644
--- a/support/NWGNUhtdigest
+++ b/support/NWGNUhtdigest
@@ -20,7 +20,6 @@ XINCDIRS += \
$(APR)/include \
$(APRUTIL)/include \
$(APR)/misc/netware \
- $(APR) \
$(EOLIST)
#
@@ -56,7 +55,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "noopt"
@@ -70,7 +69,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "release"
@@ -92,7 +91,7 @@ endif
# This is used by the link 'name' directive to name the nlm. If left blank
# TARGET_nlm (see below) will be used.
#
-NLM_NAME = htdigest
+NLM_NAME = htdigest
#
# This is used by the link '-desc ' directive.
@@ -116,7 +115,7 @@ NLM_SCREEN_NAME = Digest Password Management
# If this is specified, it will override VERSION value in
# $(AP_WORK)/build/NWGNUenvironment.inc
#
-NLM_VERSION =
+NLM_VERSION =
#
# If this is specified, it will override the default of 64K
@@ -142,14 +141,14 @@ NLM_CHECK_SYM =
#
# If these are specified it will be used by the link '-flags' directive
#
-NLM_FLAGS =
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
#
# If this is specified it will be linked in with the XDCData option in the def
# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
# by setting APACHE_UNIPROC in the environment
#
-XDCDATA =
+XDCDATA =
#
# If there is an NLM target, put it here
@@ -177,7 +176,7 @@ FILES_nlm_objs = \
# These will be added as a library command in the link.opt file.
#
FILES_nlm_libs = \
- $(PRELUDE) \
+ $(PRELUDE) \
$(EOLIST)
#
@@ -217,13 +216,13 @@ FILES_nlm_Ximports = \
#
FILES_nlm_exports = \
$(EOLIST)
-
+
#
# These are the OBJ files needed to create the LIB target above.
# Paths must all use the '/' character
#
FILES_lib_objs = \
- $(EOLIST)
+ $(EOLIST)
#
# implement targets and dependancies (leave this section alone)
@@ -250,4 +249,3 @@ install :: nlms FORCE
include $(APBUILD)/NWGNUtail.inc
-
diff --git a/support/NWGNUhtpasswd b/support/NWGNUhtpasswd
index 990cd8e8..66f42474 100644
--- a/support/NWGNUhtpasswd
+++ b/support/NWGNUhtpasswd
@@ -20,7 +20,6 @@ XINCDIRS += \
$(APR)/include \
$(APRUTIL)/include \
$(APR)/misc/netware \
- $(APR) \
$(EOLIST)
#
@@ -56,7 +55,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "noopt"
@@ -70,7 +69,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "release"
@@ -92,7 +91,7 @@ endif
# This is used by the link 'name' directive to name the nlm. If left blank
# TARGET_nlm (see below) will be used.
#
-NLM_NAME = htpasswd
+NLM_NAME = htpasswd
#
# This is used by the link '-desc ' directive.
@@ -116,7 +115,7 @@ NLM_SCREEN_NAME = htpasswd Password Management
# If this is specified, it will override VERSION value in
# $(AP_WORK)/build/NWGNUenvironment.inc
#
-NLM_VERSION =
+NLM_VERSION =
#
# If this is specified, it will override the default of 64K
@@ -142,14 +141,14 @@ NLM_CHECK_SYM =
#
# If these are specified it will be used by the link '-flags' directive
#
-NLM_FLAGS =
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
#
# If this is specified it will be linked in with the XDCData option in the def
# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
# by setting APACHE_UNIPROC in the environment
#
-XDCDATA =
+XDCDATA =
#
# If there is an NLM target, put it here
@@ -177,7 +176,7 @@ FILES_nlm_objs = \
# These will be added as a library command in the link.opt file.
#
FILES_nlm_libs = \
- $(PRELUDE) \
+ $(PRELUDE) \
$(EOLIST)
#
@@ -217,13 +216,13 @@ FILES_nlm_Ximports = \
#
FILES_nlm_exports = \
$(EOLIST)
-
+
#
# These are the OBJ files needed to create the LIB target above.
# Paths must all use the '/' character
#
FILES_lib_objs = \
- $(EOLIST)
+ $(EOLIST)
#
# implement targets and dependancies (leave this section alone)
@@ -250,4 +249,3 @@ install :: nlms FORCE
include $(APBUILD)/NWGNUtail.inc
-
diff --git a/support/NWGNUhttxt2dbm b/support/NWGNUhttxt2dbm
index fc1d6232..c33532dd 100644
--- a/support/NWGNUhttxt2dbm
+++ b/support/NWGNUhttxt2dbm
@@ -20,7 +20,6 @@ XINCDIRS += \
$(APR)/include \
$(APRUTIL)/include \
$(APR)/misc/netware \
- $(APR) \
$(EOLIST)
#
@@ -56,7 +55,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "noopt"
@@ -70,7 +69,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "release"
@@ -92,7 +91,7 @@ endif
# This is used by the link 'name' directive to name the nlm. If left blank
# TARGET_nlm (see below) will be used.
#
-NLM_NAME = httxt2dbm
+NLM_NAME = httxt2dbm
#
# This is used by the link '-desc ' directive.
@@ -116,7 +115,7 @@ NLM_SCREEN_NAME = httxt2dbm Conversion Utility
# If this is specified, it will override VERSION value in
# $(AP_WORK)/build/NWGNUenvironment.inc
#
-NLM_VERSION =
+NLM_VERSION =
#
# If this is specified, it will override the default of 64K
@@ -142,14 +141,14 @@ NLM_CHECK_SYM =
#
# If these are specified it will be used by the link '-flags' directive
#
-NLM_FLAGS =
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
#
# If this is specified it will be linked in with the XDCData option in the def
# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
# by setting APACHE_UNIPROC in the environment
#
-XDCDATA =
+XDCDATA =
#
# If there is an NLM target, put it here
@@ -177,7 +176,7 @@ FILES_nlm_objs = \
# These will be added as a library command in the link.opt file.
#
FILES_nlm_libs = \
- $(PRELUDE) \
+ $(PRELUDE) \
$(EOLIST)
#
@@ -223,7 +222,7 @@ FILES_nlm_exports = \
# Paths must all use the '/' character
#
FILES_lib_objs = \
- $(EOLIST)
+ $(EOLIST)
#
# implement targets and dependancies (leave this section alone)
@@ -250,4 +249,3 @@ install :: nlms FORCE
include $(APBUILD)/NWGNUtail.inc
-
diff --git a/support/NWGNUlogres b/support/NWGNUlogres
index 8597862a..33ccfe0e 100644
--- a/support/NWGNUlogres
+++ b/support/NWGNUlogres
@@ -21,7 +21,6 @@ XINCDIRS += \
$(APR)/include \
$(APRUTIL)/include \
$(APR)/misc/netware \
- $(APR) \
$(EOLIST)
#
@@ -57,7 +56,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "noopt"
@@ -71,7 +70,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "release"
@@ -93,7 +92,7 @@ endif
# This is used by the link 'name' directive to name the nlm. If left blank
# TARGET_nlm (see below) will be used.
#
-NLM_NAME = logres
+NLM_NAME = logres
#
# This is used by the link '-desc ' directive.
@@ -117,7 +116,7 @@ NLM_SCREEN_NAME = Log Resolve
# If this is specified, it will override VERSION value in
# $(AP_WORK)/build/NWGNUenvironment.inc
#
-NLM_VERSION =
+NLM_VERSION =
#
# If this is specified, it will override the default of 64K
@@ -143,14 +142,14 @@ NLM_CHECK_SYM =
#
# If these are specified it will be used by the link '-flags' directive
#
-NLM_FLAGS =
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION
#
# If this is specified it will be linked in with the XDCData option in the def
# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
# by setting APACHE_UNIPROC in the environment
#
-XDCDATA =
+XDCDATA =
#
# If there is an NLM target, put it here
@@ -178,7 +177,7 @@ FILES_nlm_objs = \
# These will be added as a library command in the link.opt file.
#
FILES_nlm_libs = \
- $(PRELUDE) \
+ $(PRELUDE) \
$(EOLIST)
#
@@ -216,7 +215,7 @@ FILES_nlm_Ximports = \
# Don't link with Winsock if standard sockets are being used
ifndef USE_STDSOCKETS
FILES_nlm_Ximports += @ws2nlm.imp \
- $(EOLIST)
+ $(EOLIST)
endif
#
@@ -230,7 +229,7 @@ FILES_nlm_exports = \
# Paths must all use the '/' character
#
FILES_lib_objs = \
- $(EOLIST)
+ $(EOLIST)
#
# implement targets and dependancies (leave this section alone)
@@ -257,4 +256,3 @@ install :: nlms FORCE
include $(APBUILD)/NWGNUtail.inc
-
diff --git a/support/NWGNUmakefile b/support/NWGNUmakefile
index 7d5902d2..9cb5d1df 100644
--- a/support/NWGNUmakefile
+++ b/support/NWGNUmakefile
@@ -1,11 +1,4 @@
#
-# Declare the sub-directories to be built here
-#
-
-SUBDIRS = \
- $(EOLIST)
-
-#
# Get the 'head' of the build environment. This includes default targets and
# paths to tools
#
@@ -16,138 +9,6 @@ include $(AP_WORK)/build/NWGNUhead.inc
# build this level's files
#
-# Make sure all needed macro's are defined
-#
-
-# These directories will be at the beginning of the include list, followed by
-# INCDIRS
-#
-XINCDIRS += \
- $(EOLIST)
-
-#
-# These flags will come after CFLAGS
-#
-XCFLAGS += \
- $(EOLIST)
-
-#
-# These defines will come after DEFINES
-#
-XDEFINES += \
- $(EOLIST)
-
-#
-# These flags will be added to the link.opt file
-#
-XLFLAGS += \
- $(EOLIST)
-
-#
-# These values will be appended to the correct variables based on the value of
-# RELEASE
-#
-ifeq "$(RELEASE)" "debug"
-XINCDIRS += \
- $(EOLIST)
-
-XCFLAGS += \
- $(EOLIST)
-
-XDEFINES += \
- $(EOLIST)
-
-XLFLAGS += \
- $(EOLIST)
-endif
-
-ifeq "$(RELEASE)" "noopt"
-XINCDIRS += \
- $(EOLIST)
-
-XCFLAGS += \
- $(EOLIST)
-
-XDEFINES += \
- $(EOLIST)
-
-XLFLAGS += \
- $(EOLIST)
-endif
-
-ifeq "$(RELEASE)" "release"
-XINCDIRS += \
- $(EOLIST)
-
-XCFLAGS += \
- $(EOLIST)
-
-XDEFINES += \
- $(EOLIST)
-
-XLFLAGS += \
- $(EOLIST)
-endif
-
-#
-# These are used by the link target if an NLM is being generated
-# This is used by the link 'name' directive to name the nlm. If left blank
-# TARGET_nlm (see below) will be used.
-#
-NLM_NAME =
-
-#
-# This is used by the link '-desc ' directive.
-# If left blank, NLM_NAME will be used.
-#
-NLM_DESCRIPTION =
-
-#
-# This is used by the '-threadname' directive. If left blank,
-# NLM_NAME Thread will be used.
-#
-NLM_THREAD_NAME =
-
-#
-# If this is specified, it will override VERSION value in
-# $(AP_WORK)/build/NWGNUenvironment.inc
-#
-NLM_VERSION =
-
-#
-# If this is specified, it will override the default of 64K
-#
-NLM_STACK_SIZE =
-
-
-#
-# If this is specified it will be used by the link '-entry' directive
-#
-NLM_ENTRY_SYM =
-
-#
-# If this is specified it will be used by the link '-exit' directive
-#
-NLM_EXIT_SYM =
-
-#
-# If this is specified it will be used by the link '-check' directive
-#
-NLM_CHECK_SYM =
-
-#
-# If these are specified it will be used by the link '-flags' directive
-#
-NLM_FLAGS =
-
-#
-# If this is specified it will be linked in with the XDCData option in the def
-# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
-# by setting APACHE_UNIPROC in the environment
-#
-XDCDATA =
-
-#
# If there is an NLM target, put it here
#
TARGET_nlm = \
@@ -162,67 +23,6 @@ TARGET_nlm = \
$(EOLIST)
#
-# If there is an LIB target, put it here
-#
-TARGET_lib = \
- $(EOLIST)
-
-#
-# These are the OBJ files needed to create the NLM target above.
-# Paths must all use the '/' character
-#
-FILES_nlm_objs = \
- $(EOLIST)
-
-#
-# These are the LIB files needed to create the NLM target above.
-# These will be added as a library command in the link.opt file.
-#
-FILES_nlm_libs = \
- $(EOLIST)
-
-#
-# These are the modules that the above NLM target depends on to load.
-# These will be added as a module command in the link.opt file.
-#
-FILES_nlm_modules = \
- $(EOLIST)
-
-#
-# If the nlm has a msg file, put it's path here
-#
-FILE_nlm_msg =
-
-#
-# If the nlm has a hlp file put it's path here
-#
-FILE_nlm_hlp =
-
-#
-# If this is specified, it will override $(NWOS)\copyright.txt.
-#
-FILE_nlm_copyright =
-
-#
-# Any additional imports go here
-#
-FILES_nlm_Ximports = \
- $(EOLIST)
-
-#
-# Any symbols exported to here
-#
-FILES_nlm_exports = \
- $(EOLIST)
-
-#
-# These are the OBJ files needed to create the LIB target above.
-# Paths must all use the '/' character
-#
-FILES_lib_objs = \
- $(EOLIST)
-
-#
# implement targets and dependancies (leave this section alone)
#
diff --git a/support/NWGNUrotlogs b/support/NWGNUrotlogs
index 37f3bd86..fb9e3ae3 100644
--- a/support/NWGNUrotlogs
+++ b/support/NWGNUrotlogs
@@ -19,7 +19,6 @@ XINCDIRS += \
$(NWOS) \
$(APR)/include \
$(APR)/misc/netware \
- $(APR) \
$(EOLIST)
#
@@ -55,7 +54,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "noopt"
@@ -69,7 +68,7 @@ XDEFINES += \
$(EOLIST)
XLFLAGS += \
- $(EOLIST)
+ $(EOLIST)
endif
ifeq "$(RELEASE)" "release"
@@ -91,7 +90,7 @@ endif
# This is used by the link 'name' directive to name the nlm. If left blank
# TARGET_nlm (see below) will be used.
#
-NLM_NAME = rotlogs
+NLM_NAME = rotlogs
#
# This is used by the link '-desc ' directive.
@@ -109,13 +108,13 @@ NLM_THREAD_NAME = rotlogs
# This is used by the '-screenname' directive. If left blank,
# 'Apache for NetWare' Thread will be used.
#
-NLM_SCREEN_NAME = DEFAULT
+NLM_SCREEN_NAME = DEFAULT
#
# If this is specified, it will override VERSION value in
# $(AP_WORK)/build/NWGNUenvironment.inc
#
-NLM_VERSION =
+NLM_VERSION =
#
# If this is specified, it will override the default of 64K
@@ -141,14 +140,14 @@ NLM_CHECK_SYM =
#
# If these are specified it will be used by the link '-flags' directive
#
-NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE
+NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION, MULTIPLE
#
# If this is specified it will be linked in with the XDCData option in the def
# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled
# by setting APACHE_UNIPROC in the environment
#
-XDCDATA =
+XDCDATA =
#
# If there is an NLM target, put it here
@@ -176,7 +175,7 @@ FILES_nlm_objs = \
# These will be added as a library command in the link.opt file.
#
FILES_nlm_libs = \
- $(PRELUDE) \
+ $(PRELUDE) \
$(EOLIST)
#
@@ -216,13 +215,13 @@ FILES_nlm_Ximports = \
#
FILES_nlm_exports = \
$(EOLIST)
-
+
#
# These are the OBJ files needed to create the LIB target above.
# Paths must all use the '/' character
#
FILES_lib_objs = \
- $(EOLIST)
+ $(EOLIST)
#
# implement targets and dependancies (leave this section alone)
@@ -249,4 +248,3 @@ install :: nlms FORCE
include $(APBUILD)/NWGNUtail.inc
-
diff --git a/support/README b/support/README
index 020a6bcf..09dadb2c 100644
--- a/support/README
+++ b/support/README
@@ -18,7 +18,7 @@ dbmmanage
DBM format used by mod_auth_db.
htcacheclean
- Keep the size of mod_disk_cache store within a certain limit.
+ Keep the size of mod_cache_disk store within a certain limit.
htdigest
Create and update user authentication files used in
diff --git a/support/ab.c b/support/ab.c
index 3744864e..e464dc26 100644
--- a/support/ab.c
+++ b/support/ab.c
@@ -156,25 +156,8 @@
#include "ap_config_auto.h"
#endif
-#if defined(HAVE_SSLC)
-
-/* Libraries for RSA SSL-C */
-#include <rsa.h>
-#include <x509.h>
-#include <pem.h>
-#include <err.h>
-#include <ssl.h>
-#include <r_rand.h>
-#include <sslc.h>
-#define USE_SSL
-#define RSAREF
-#define SK_NUM(x) sk_num(x)
-#define SK_VALUE(x,y) sk_value(x,y)
-typedef STACK X509_STACK_TYPE;
-
-#elif defined(HAVE_OPENSSL)
+#if defined(HAVE_OPENSSL)
-/* Libraries on most systems.. */
#include <openssl/rsa.h>
#include <openssl/crypto.h>
#include <openssl/x509.h>
@@ -221,19 +204,25 @@ typedef STACK_OF(X509) X509_STACK_TYPE;
/* maximum number of requests on a time limited test */
#define MAX_REQUESTS (INT_MAX > 50000 ? 50000 : INT_MAX)
-/* good old state hostname */
-#define STATE_UNCONNECTED 0
-#define STATE_CONNECTING 1 /* TCP connect initiated, but we don't
+/* connection state
+ * don't add enums or rearrange or otherwise change values without
+ * visiting set_conn_state()
+ */
+typedef enum {
+ STATE_UNCONNECTED = 0,
+ STATE_CONNECTING, /* TCP connect initiated, but we don't
* know if it worked yet
*/
-#define STATE_CONNECTED 2 /* we know TCP connect completed */
-#define STATE_READ 3
+ STATE_CONNECTED, /* we know TCP connect completed */
+ STATE_READ
+} connect_state_e;
#define CBUFFSIZE (2048)
struct connection {
apr_pool_t *ctx;
apr_socket_t *aprsock;
+ apr_pollfd_t pollfd;
int state;
apr_size_t read; /* amount of bytes read */
apr_size_t bread; /* amount of body read */
@@ -264,8 +253,8 @@ struct data {
apr_interval_time_t time; /* time for connection */
};
-#define ap_min(a,b) ((a)<(b))?(a):(b)
-#define ap_max(a,b) ((a)>(b))?(a):(b)
+#define ap_min(a,b) (((a)<(b))?(a):(b))
+#define ap_max(a,b) (((a)>(b))?(a):(b))
#define ap_round_ms(a) ((apr_time_t)((a) + 500)/1000)
#define ap_double_ms(a) ((double)(a)/1000.0)
#define MAX_CONCURRENCY 20000
@@ -274,7 +263,9 @@ struct data {
int verbosity = 0; /* no verbosity by default */
int recverrok = 0; /* ok to proceed after socket receive errors */
-int posting = 0; /* GET by default */
+enum {NO_METH = 0, GET, HEAD, PUT, POST} method = NO_METH;
+const char *method_str[] = {"bug", "GET", "HEAD", "PUT", "POST"};
+int send_body = 0; /* non-zero if sending body with request */
int requests = 1; /* Number of requests to make */
int heartbeatres = 100; /* How often do we say we're alive */
int concurrency = 1; /* Number of multiple requests to make */
@@ -285,24 +276,26 @@ int keepalive = 0; /* try and do keepalive connections */
int windowsize = 0; /* we use the OS default window size */
char servername[1024]; /* name that server reports */
char *hostname; /* host name from URL */
-char *host_field; /* value of "Host:" header field */
-char *path; /* path name */
+const char *host_field; /* value of "Host:" header field */
+const char *path; /* path name */
char postfile[1024]; /* name of file containing post data */
char *postdata; /* *buffer containing data from postfile */
apr_size_t postlen = 0; /* length of data to be POSTed */
char content_type[1024];/* content type to put in POST header */
-char *cookie, /* optional cookie line */
- *auth, /* optional (basic/uuencoded) auhentication */
- *hdrs; /* optional arbitrary headers */
+const char *cookie, /* optional cookie line */
+ *auth, /* optional (basic/uuencoded) auhentication */
+ *hdrs; /* optional arbitrary headers */
apr_port_t port; /* port number */
char proxyhost[1024]; /* proxy host name */
int proxyport = 0; /* proxy port */
-char *connecthost;
+const char *connecthost;
+const char *myhost;
apr_port_t connectport;
-char *gnuplot; /* GNUplot file */
-char *csvperc; /* CSV Percentile file */
+const char *gnuplot; /* GNUplot file */
+const char *csvperc; /* CSV Percentile file */
char url[1024];
-char * fullurl, * colonhost;
+const char *fullurl;
+const char *colonhost;
int isproxy = 0;
apr_interval_time_t aprtimeout = apr_time_from_sec(30); /* timeout value */
@@ -361,6 +354,7 @@ apr_pool_t *cntxt;
apr_pollset_t *readbits;
+apr_sockaddr_t *mysa;
apr_sockaddr_t *destsa;
#ifdef NOT_ASCII
@@ -374,7 +368,7 @@ static void close_connection(struct connection * c);
/* simple little function to write an error string and exit */
-static void err(char *s)
+static void err(const char *s)
{
fprintf(stderr, "%s\n", s);
if (done)
@@ -384,7 +378,7 @@ static void err(char *s)
/* simple little function to write an APR error string and exit */
-static void apr_err(char *s, apr_status_t rv)
+static void apr_err(const char *s, apr_status_t rv)
{
char buf[120];
@@ -396,6 +390,45 @@ static void apr_err(char *s, apr_status_t rv)
exit(rv);
}
+static void set_polled_events(struct connection *c, apr_int16_t new_reqevents)
+{
+ apr_status_t rv;
+
+ if (c->pollfd.reqevents != new_reqevents) {
+ if (c->pollfd.reqevents != 0) {
+ rv = apr_pollset_remove(readbits, &c->pollfd);
+ if (rv != APR_SUCCESS) {
+ apr_err("apr_pollset_remove()", rv);
+ }
+ }
+
+ if (new_reqevents != 0) {
+ c->pollfd.reqevents = new_reqevents;
+ rv = apr_pollset_add(readbits, &c->pollfd);
+ if (rv != APR_SUCCESS) {
+ apr_err("apr_pollset_add()", rv);
+ }
+ }
+ }
+}
+
+static void set_conn_state(struct connection *c, connect_state_e new_state)
+{
+ apr_int16_t events_by_state[] = {
+ 0, /* for STATE_UNCONNECTED */
+ APR_POLLOUT, /* for STATE_CONNECTING */
+ APR_POLLIN, /* for STATE_CONNECTED; we don't poll in this state,
+ * so prepare for polling in the following state --
+ * STATE_READ
+ */
+ APR_POLLIN /* for STATE_READ */
+ };
+
+ c->state = new_state;
+
+ set_polled_events(c, events_by_state[new_state]);
+}
+
/* --------------------------------------------------------- */
/* write out request to a connection - assumes we can write
* (small) request out in one go into our new socket buffer
@@ -461,7 +494,6 @@ static int ssl_rand_choosenum(int l, int h)
static void ssl_rand_seed(void)
{
- int nDone = 0;
int n, l;
time_t t;
pid_t pid;
@@ -473,7 +505,6 @@ static void ssl_rand_seed(void)
t = time(NULL);
l = sizeof(time_t);
RAND_seed((unsigned char *)&t, l);
- nDone += l;
/*
* seed in the current process id (usually just 4 bytes)
@@ -481,14 +512,12 @@ static void ssl_rand_seed(void)
pid = getpid();
l = sizeof(pid_t);
RAND_seed((unsigned char *)&pid, l);
- nDone += l;
/*
* seed in some current state of the run-time stack (128 bytes)
*/
n = ssl_rand_choosenum(0, sizeof(stackdata)-128-1);
RAND_seed(stackdata+n, 128);
- nDone += 128;
}
static int ssl_print_connection_info(BIO *bio, SSL *ssl)
@@ -509,6 +538,7 @@ static int ssl_print_connection_info(BIO *bio, SSL *ssl)
static void ssl_print_cert_info(BIO *bio, X509 *cert)
{
X509_NAME *dn;
+ EVP_PKEY *pk;
char buf[1024];
BIO_printf(bio, "Certificate version: %ld\n", X509_get_version(cert)+1);
@@ -520,8 +550,10 @@ static void ssl_print_cert_info(BIO *bio, X509 *cert)
ASN1_UTCTIME_print(bio, X509_get_notAfter(cert));
BIO_printf(bio,"\n");
+ pk = X509_get_pubkey(cert);
BIO_printf(bio,"Public key is %d bits\n",
- EVP_PKEY_bits(X509_get_pubkey(cert)));
+ EVP_PKEY_bits(pk));
+ EVP_PKEY_free(pk);
dn = X509_get_issuer_name(cert);
X509_NAME_oneline(dn, buf, sizeof(buf));
@@ -548,7 +580,6 @@ static void ssl_print_info(struct connection *c)
for (i=1; i<count; i++) {
cert = (X509 *)SK_VALUE(sk, i);
ssl_print_cert_info(bio_out, cert);
- X509_free(cert);
}
}
cert = SSL_get_peer_certificate(c->ssl);
@@ -569,7 +600,6 @@ static void ssl_proceed_handshake(struct connection *c)
while (do_next) {
int ret, ecode;
- apr_pollfd_t new_pollfd;
ret = SSL_do_handshake(c->ssl);
ecode = SSL_get_error(c->ssl, ret);
@@ -601,11 +631,7 @@ static void ssl_proceed_handshake(struct connection *c)
do_next = 0;
break;
case SSL_ERROR_WANT_READ:
- new_pollfd.desc_type = APR_POLL_SOCKET;
- new_pollfd.reqevents = APR_POLLIN;
- new_pollfd.desc.s = c->aprsock;
- new_pollfd.client_data = c;
- apr_pollset_add(readbits, &new_pollfd);
+ set_polled_events(c, APR_POLLIN);
do_next = 0;
break;
case SSL_ERROR_WANT_WRITE:
@@ -629,6 +655,10 @@ static void ssl_proceed_handshake(struct connection *c)
static void write_request(struct connection * c)
{
+ if (started >= requests) {
+ return;
+ }
+
do {
apr_time_t tnow;
apr_size_t l = c->rwrite;
@@ -644,7 +674,7 @@ static void write_request(struct connection * c)
c->connect = tnow;
c->rwrote = 0;
c->rwrite = reqlen;
- if (posting)
+ if (send_body)
c->rwrite += postlen;
}
else if (tnow > c->connect + aprtimeout) {
@@ -681,16 +711,9 @@ static void write_request(struct connection * c)
c->rwrite -= l;
} while (c->rwrite);
- c->state = STATE_READ;
c->endwrite = lasttime = apr_time_now();
- {
- apr_pollfd_t new_pollfd;
- new_pollfd.desc_type = APR_POLL_SOCKET;
- new_pollfd.reqevents = APR_POLLIN;
- new_pollfd.desc.s = c->aprsock;
- new_pollfd.client_data = c;
- apr_pollset_add(readbits, &new_pollfd);
- }
+ started++;
+ set_conn_state(c, STATE_READ);
}
/* --------------------------------------------------------- */
@@ -770,10 +793,9 @@ static void output_results(int sig)
if (keepalive)
printf("Keep-Alive requests: %d\n", doneka);
printf("Total transferred: %" APR_INT64_T_FMT " bytes\n", totalread);
- if (posting == 1)
- printf("Total POSTed: %" APR_INT64_T_FMT "\n", totalposted);
- if (posting == 2)
- printf("Total PUT: %" APR_INT64_T_FMT "\n", totalposted);
+ if (send_body)
+ printf("Total body sent: %" APR_INT64_T_FMT "\n",
+ totalposted);
printf("HTML transferred: %" APR_INT64_T_FMT " bytes\n", totalbread);
/* avoid divide by zero */
@@ -786,7 +808,7 @@ static void output_results(int sig)
(double) timetaken * 1000 / done);
printf("Transfer rate: %.2f [Kbytes/sec] received\n",
(double) totalread / 1024 / timetaken);
- if (posting > 0) {
+ if (send_body) {
printf(" %.2f kb/s sent\n",
(double) totalposted / timetaken / 1024);
printf(" %.2f kb/s total\n",
@@ -1057,14 +1079,11 @@ static void output_html_results(void)
printf("<tr %s><th colspan=2 %s>Total transferred:</th>"
"<td colspan=2 %s>%" APR_INT64_T_FMT " bytes</td></tr>\n",
trstring, tdstring, tdstring, totalread);
- if (posting == 1)
- printf("<tr %s><th colspan=2 %s>Total POSTed:</th>"
- "<td colspan=2 %s>%" APR_INT64_T_FMT "</td></tr>\n",
- trstring, tdstring, tdstring, totalposted);
- if (posting == 2)
- printf("<tr %s><th colspan=2 %s>Total PUT:</th>"
+ if (send_body)
+ printf("<tr %s><th colspan=2 %s>Total body sent:</th>"
"<td colspan=2 %s>%" APR_INT64_T_FMT "</td></tr>\n",
- trstring, tdstring, tdstring, totalposted);
+ trstring, tdstring,
+ tdstring, totalposted);
printf("<tr %s><th colspan=2 %s>HTML transferred:</th>"
"<td colspan=2 %s>%" APR_INT64_T_FMT " bytes</td></tr>\n",
trstring, tdstring, tdstring, totalbread);
@@ -1073,11 +1092,11 @@ static void output_html_results(void)
if (timetaken) {
printf("<tr %s><th colspan=2 %s>Requests per second:</th>"
"<td colspan=2 %s>%.2f</td></tr>\n",
- trstring, tdstring, tdstring, (double) done * 1000 / timetaken);
+ trstring, tdstring, tdstring, (double) done / timetaken);
printf("<tr %s><th colspan=2 %s>Transfer rate:</th>"
"<td colspan=2 %s>%.2f kb/s received</td></tr>\n",
trstring, tdstring, tdstring, (double) totalread / timetaken);
- if (posting > 0) {
+ if (send_body) {
printf("<tr %s><td colspan=2 %s>&nbsp;</td>"
"<td colspan=2 %s>%.2f kb/s sent</td></tr>\n",
trstring, tdstring, tdstring,
@@ -1166,18 +1185,28 @@ static void start_connect(struct connection * c)
SOCK_STREAM, 0, c->ctx)) != APR_SUCCESS) {
apr_err("socket", rv);
}
+
+ if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) {
+ apr_err("bind", rv);
+ }
+
+ c->pollfd.desc_type = APR_POLL_SOCKET;
+ c->pollfd.desc.s = c->aprsock;
+ c->pollfd.reqevents = 0;
+ c->pollfd.client_data = c;
+
if ((rv = apr_socket_opt_set(c->aprsock, APR_SO_NONBLOCK, 1))
!= APR_SUCCESS) {
apr_err("socket nonblock", rv);
}
if (windowsize != 0) {
- rv = apr_socket_opt_set(c->aprsock, APR_SO_SNDBUF,
+ rv = apr_socket_opt_set(c->aprsock, APR_SO_SNDBUF,
windowsize);
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
apr_err("socket send buffer", rv);
}
- rv = apr_socket_opt_set(c->aprsock, APR_SO_RCVBUF,
+ rv = apr_socket_opt_set(c->aprsock, APR_SO_RCVBUF,
windowsize);
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
apr_err("socket receive buffer", rv);
@@ -1210,21 +1239,12 @@ static void start_connect(struct connection * c)
#endif
if ((rv = apr_socket_connect(c->aprsock, destsa)) != APR_SUCCESS) {
if (APR_STATUS_IS_EINPROGRESS(rv)) {
- apr_pollfd_t new_pollfd;
- c->state = STATE_CONNECTING;
+ set_conn_state(c, STATE_CONNECTING);
c->rwrite = 0;
- new_pollfd.desc_type = APR_POLL_SOCKET;
- new_pollfd.reqevents = APR_POLLOUT;
- new_pollfd.desc.s = c->aprsock;
- new_pollfd.client_data = c;
- apr_pollset_add(readbits, &new_pollfd);
return;
}
else {
- apr_pollfd_t remove_pollfd;
- remove_pollfd.desc_type = APR_POLL_SOCKET;
- remove_pollfd.desc.s = c->aprsock;
- apr_pollset_remove(readbits, &remove_pollfd);
+ set_conn_state(c, STATE_UNCONNECTED);
apr_socket_close(c->aprsock);
err_conn++;
if (bad++ > 10) {
@@ -1232,15 +1252,14 @@ static void start_connect(struct connection * c)
"\nTest aborted after 10 failures\n\n");
apr_err("apr_socket_connect()", rv);
}
- c->state = STATE_UNCONNECTED;
+
start_connect(c);
return;
}
}
/* connected first time */
- c->state = STATE_CONNECTED;
- started++;
+ set_conn_state(c, STATE_CONNECTED);
#ifdef USE_SSL
if (c->ssl) {
ssl_proceed_handshake(c);
@@ -1288,21 +1307,15 @@ static void close_connection(struct connection * c)
}
}
- {
- apr_pollfd_t remove_pollfd;
- remove_pollfd.desc_type = APR_POLL_SOCKET;
- remove_pollfd.desc.s = c->aprsock;
- apr_pollset_remove(readbits, &remove_pollfd);
+ set_conn_state(c, STATE_UNCONNECTED);
#ifdef USE_SSL
- if (c->ssl) {
- SSL_shutdown(c->ssl);
- SSL_free(c->ssl);
- c->ssl = NULL;
- }
-#endif
- apr_socket_close(c->aprsock);
+ if (c->ssl) {
+ SSL_shutdown(c->ssl);
+ SSL_free(c->ssl);
+ c->ssl = NULL;
}
- c->state = STATE_UNCONNECTED;
+#endif
+ apr_socket_close(c->aprsock);
/* connect again */
start_connect(c);
@@ -1420,10 +1433,7 @@ static void read_connection(struct connection * c)
}
else {
/* header is in invalid or too big - close connection */
- apr_pollfd_t remove_pollfd;
- remove_pollfd.desc_type = APR_POLL_SOCKET;
- remove_pollfd.desc.s = c->aprsock;
- apr_pollset_remove(readbits, &remove_pollfd);
+ set_conn_state(c, STATE_UNCONNECTED);
apr_socket_close(c->aprsock);
err_response++;
if (bad++ > 10) {
@@ -1486,12 +1496,12 @@ static void read_connection(struct connection * c)
if (cl) {
c->keepalive = 1;
/* response to HEAD doesn't have entity body */
- c->length = posting >= 0 ? atoi(cl + 16) : 0;
+ c->length = method != HEAD ? atoi(cl + 16) : 0;
}
/* The response may not have a Content-Length header */
if (!cl) {
c->keepalive = 1;
- c->length = 0;
+ c->length = 0;
}
}
c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy;
@@ -1547,7 +1557,8 @@ static void read_connection(struct connection * c)
static void test(void)
{
apr_time_t stoptime;
- apr_int16_t rv;
+ apr_int16_t rtnev;
+ apr_status_t rv;
int i;
apr_status_t status;
int snprintf_res = 0;
@@ -1575,9 +1586,17 @@ static void test(void)
con = calloc(concurrency, sizeof(struct connection));
+ /*
+ * XXX: a way to calculate the stats without requiring O(requests) memory
+ * XXX: would be nice.
+ */
stats = calloc(requests, sizeof(struct data));
+ if (stats == NULL || con == NULL) {
+ err("Cannot allocate memory for result statistics");
+ }
- if ((status = apr_pollset_create(&readbits, concurrency, cntxt, 0)) != APR_SUCCESS) {
+ if ((status = apr_pollset_create(&readbits, concurrency, cntxt,
+ APR_POLLSET_NOCOPY)) != APR_SUCCESS) {
apr_err("apr_pollset_create failed", status);
}
@@ -1607,12 +1626,12 @@ static void test(void)
}
/* setup request */
- if (posting <= 0) {
+ if (!send_body) {
snprintf_res = apr_snprintf(request, sizeof(_request),
"%s %s HTTP/1.0\r\n"
"%s" "%s" "%s"
"%s" "\r\n",
- (posting == 0) ? "GET" : "HEAD",
+ method_str[method],
(isproxy) ? fullurl : path,
keepalive ? "Connection: Keep-Alive\r\n" : "",
cookie, auth, hdrs);
@@ -1625,7 +1644,7 @@ static void test(void)
"Content-type: %s\r\n"
"%s"
"\r\n",
- (posting == 1) ? "POST" : "PUT",
+ method_str[method],
(isproxy) ? fullurl : path,
keepalive ? "Connection: Keep-Alive\r\n" : "",
cookie, auth,
@@ -1637,15 +1656,15 @@ static void test(void)
}
if (verbosity >= 2)
- printf("INFO: %s header == \n---\n%s\n---\n",
- (posting == 2) ? "PUT" : "POST", request);
+ printf("INFO: %s header == \n---\n%s\n---\n",
+ method_str[method], request);
reqlen = strlen(request);
/*
- * Combine headers and (optional) post file into one contineous buffer
+ * Combine headers and (optional) post file into one continuous buffer
*/
- if (posting >= 1) {
+ if (send_body) {
char *buff = malloc(postlen + reqlen + 1);
if (!buff) {
fprintf(stderr, "error creating request buffer: out of memory\n");
@@ -1669,6 +1688,14 @@ static void test(void)
#endif /* NOT_ASCII */
/* This only needs to be done once */
+ if ((rv = apr_sockaddr_info_get(&mysa, myhost, APR_UNSPEC, 0, 0, cntxt)) != APR_SUCCESS) {
+ char buf[120];
+ apr_snprintf(buf, sizeof(buf),
+ "apr_sockaddr_info_get() for %s", myhost);
+ apr_err(buf, rv);
+ }
+
+ /* This too */
if ((rv = apr_sockaddr_info_get(&destsa, connecthost, APR_UNSPEC, connectport, 0, cntxt))
!= APR_SUCCESS) {
char buf[120];
@@ -1681,7 +1708,7 @@ static void test(void)
start = lasttime = apr_time_now();
stoptime = tlimit ? (start + apr_time_from_sec(tlimit)) : AB_MAX;
-#ifdef SIGINT
+#ifdef SIGINT
/* Output the results if the user terminates the run early. */
apr_signal(SIGINT, output_results);
#endif
@@ -1694,24 +1721,19 @@ static void test(void)
do {
apr_int32_t n;
- const apr_pollfd_t *pollresults;
+ const apr_pollfd_t *pollresults, *pollfd;
n = concurrency;
do {
- status = apr_pollset_poll(readbits, aprtimeout, &n, &pollresults);
+ status = apr_pollset_poll(readbits, aprtimeout, &n, &pollresults);
} while (APR_STATUS_IS_EINTR(status));
if (status != APR_SUCCESS)
- apr_err("apr_poll", status);
+ apr_err("apr_pollset_poll", status);
- if (!n) {
- err("\nServer timed out\n\n");
- }
-
- for (i = 0; i < n; i++) {
- const apr_pollfd_t *next_fd = &(pollresults[i]);
+ for (i = 0, pollfd = pollresults; i < n; i++, pollfd++) {
struct connection *c;
- c = next_fd->client_data;
+ c = pollfd->client_data;
/*
* If the connection isn't connected how can we check it?
@@ -1719,7 +1741,7 @@ static void test(void)
if (c->state == STATE_UNCONNECTED)
continue;
- rv = next_fd->rtnevents;
+ rtnev = pollfd->rtnevents;
#ifdef USE_SSL
if (c->state == STATE_CONNECTED && c->ssl && SSL_in_init(c->ssl)) {
@@ -1740,22 +1762,25 @@ static void test(void)
* connection is done and we loop here endlessly calling
* apr_poll().
*/
- if ((rv & APR_POLLIN) || (rv & APR_POLLPRI) || (rv & APR_POLLHUP))
+ if ((rtnev & APR_POLLIN) || (rtnev & APR_POLLPRI) || (rtnev & APR_POLLHUP))
read_connection(c);
- if ((rv & APR_POLLERR) || (rv & APR_POLLNVAL)) {
+ if ((rtnev & APR_POLLERR) || (rtnev & APR_POLLNVAL)) {
bad++;
err_except++;
- start_connect(c);
+ /* avoid apr_poll/EINPROGRESS loop on HP-UX, let recv discover ECONNREFUSED */
+ if (c->state == STATE_CONNECTING) {
+ read_connection(c);
+ }
+ else {
+ start_connect(c);
+ }
continue;
}
- if (rv & APR_POLLOUT) {
+ if (rtnev & APR_POLLOUT) {
if (c->state == STATE_CONNECTING) {
- apr_pollfd_t remove_pollfd;
rv = apr_socket_connect(c->aprsock, destsa);
- remove_pollfd.desc_type = APR_POLL_SOCKET;
- remove_pollfd.desc.s = c->aprsock;
- apr_pollset_remove(readbits, &remove_pollfd);
if (rv != APR_SUCCESS) {
+ set_conn_state(c, STATE_UNCONNECTED);
apr_socket_close(c->aprsock);
err_conn++;
if (bad++ > 10) {
@@ -1763,13 +1788,11 @@ static void test(void)
"\nTest aborted after 10 failures\n\n");
apr_err("apr_socket_connect()", rv);
}
- c->state = STATE_UNCONNECTED;
start_connect(c);
continue;
}
else {
- c->state = STATE_CONNECTED;
- started++;
+ set_conn_state(c, STATE_CONNECTED);
#ifdef USE_SSL
if (c->ssl)
ssl_proceed_handshake(c);
@@ -1782,25 +1805,9 @@ static void test(void)
write_request(c);
}
}
-
- /*
- * When using a select based poll every time we check the bits
- * are reset. In 1.3's ab we copied the FD_SET's each time
- * through, but here we're going to check the state and if the
- * connection is in STATE_READ or STATE_CONNECTING we'll add the
- * socket back in as APR_POLLIN.
- */
- if (c->state == STATE_READ) {
- apr_pollfd_t new_pollfd;
- new_pollfd.desc_type = APR_POLL_SOCKET;
- new_pollfd.reqevents = APR_POLLIN;
- new_pollfd.desc.s = c->aprsock;
- new_pollfd.client_data = c;
- apr_pollset_add(readbits, &new_pollfd);
- }
}
} while (lasttime < stoptime && done < requests);
-
+
if (heartbeatres)
fprintf(stderr, "Finished %d requests\n", done);
else
@@ -1818,14 +1825,14 @@ static void test(void)
static void copyright(void)
{
if (!use_html) {
- printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 655654 $>");
+ printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1178079 $>");
printf("Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
printf("Licensed to The Apache Software Foundation, http://www.apache.org/\n");
printf("\n");
}
else {
printf("<p>\n");
- printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i><br>\n", AP_AB_BASEREVISION, "$Revision: 655654 $");
+ printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i><br>\n", AP_AB_BASEREVISION, "$Revision: 1178079 $");
printf(" Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
printf(" Licensed to The Apache Software Foundation, http://www.apache.org/<br>\n");
printf("</p>\n<p>\n");
@@ -1847,6 +1854,7 @@ static void usage(const char *progname)
fprintf(stderr, " -c concurrency Number of multiple requests to make\n");
fprintf(stderr, " -t timelimit Seconds to max. wait for responses\n");
fprintf(stderr, " -b windowsize Size of TCP send/receive buffer, in bytes\n");
+ fprintf(stderr, " -B address Address to bind to when making outgoing connections\n");
fprintf(stderr, " -p postfile File containing data to POST. Remember also to set -T\n");
fprintf(stderr, " -u putfile File containing data to PUT. Remember also to set -T\n");
fprintf(stderr, " -T content-type Content-type header for POSTing, eg.\n");
@@ -1858,7 +1866,7 @@ static void usage(const char *progname)
fprintf(stderr, " -x attributes String to insert as table attributes\n");
fprintf(stderr, " -y attributes String to insert as tr attributes\n");
fprintf(stderr, " -z attributes String to insert as td or th attributes\n");
- fprintf(stderr, " -C attribute Add cookie, eg. 'Apache=1234. (repeatable)\n");
+ fprintf(stderr, " -C attribute Add cookie, eg. 'Apache=1234'. (repeatable)\n");
fprintf(stderr, " -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'\n");
fprintf(stderr, " Inserted after all normal header lines. (repeatable)\n");
fprintf(stderr, " -A attribute Add Basic WWW Authentication, the attributes\n");
@@ -1889,7 +1897,7 @@ static void usage(const char *progname)
/* split URL into parts */
-static int parse_url(char *url)
+static int parse_url(const char *url)
{
char *cp;
char *h;
@@ -1920,9 +1928,7 @@ static int parse_url(char *url)
if ((cp = strchr(url, '/')) == NULL)
return 1;
- h = apr_palloc(cntxt, cp - url + 1);
- memcpy(h, url, cp - url);
- h[cp - url] = '\0';
+ h = apr_pstrmemdup(cntxt, url, cp - url);
rv = apr_parse_addr_port(&hostname, &scope_id, &port, h, cntxt);
if (rv != APR_SUCCESS || !hostname || scope_id) {
return 1;
@@ -1959,9 +1965,9 @@ static int parse_url(char *url)
/* ------------------------------------------------------- */
-/* read data to POST from file, save contents and length */
+/* read data to POST/PUT from file, save contents and length */
-static int open_postfile(const char *pfile)
+static apr_status_t open_postfile(const char *pfile)
{
apr_file_t *postfd;
apr_finfo_t finfo;
@@ -1994,7 +2000,7 @@ static int open_postfile(const char *pfile)
return rv;
}
apr_file_close(postfd);
- return 0;
+ return APR_SUCCESS;
}
/* ------------------------------------------------------- */
@@ -2002,11 +2008,11 @@ static int open_postfile(const char *pfile)
/* sort out command-line args and call test */
int main(int argc, const char * const argv[])
{
- int r, l;
+ int l;
char tmp[1024];
apr_status_t status;
apr_getopt_t *opt;
- const char *optarg;
+ const char *opt_arg;
char c;
#ifdef USE_SSL
AB_SSL_METHOD_CONST SSL_METHOD *meth = SSLv23_client_method();
@@ -2043,15 +2049,17 @@ int main(int argc, const char * const argv[])
}
#endif
+ myhost = NULL; /* 0.0.0.0 or :: */
+
apr_getopt_init(&opt, cntxt, argc, argv);
- while ((status = apr_getopt(opt, "n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:Sq"
+ while ((status = apr_getopt(opt, "n:c:t:b:T:p:u:v:rkVhwix:y:z:C:H:P:A:g:X:de:SqB:"
#ifdef USE_SSL
"Z:f:"
#endif
- ,&c, &optarg)) == APR_SUCCESS) {
+ ,&c, &opt_arg)) == APR_SUCCESS) {
switch (c) {
case 'n':
- requests = atoi(optarg);
+ requests = atoi(opt_arg);
if (requests <= 0) {
err("Invalid number of requests\n");
}
@@ -2063,76 +2071,74 @@ int main(int argc, const char * const argv[])
heartbeatres = 0;
break;
case 'c':
- concurrency = atoi(optarg);
+ concurrency = atoi(opt_arg);
break;
case 'b':
- windowsize = atoi(optarg);
+ windowsize = atoi(opt_arg);
break;
case 'i':
- if (posting > 0)
- err("Cannot mix POST/PUT and HEAD\n");
- posting = -1;
+ if (method != NO_METH)
+ err("Cannot mix HEAD with other methods\n");
+ method = HEAD;
break;
case 'g':
- gnuplot = strdup(optarg);
+ gnuplot = strdup(opt_arg);
break;
case 'd':
percentile = 0;
break;
case 'e':
- csvperc = strdup(optarg);
+ csvperc = strdup(opt_arg);
break;
case 'S':
confidence = 0;
break;
case 'p':
- if (posting != 0)
- err("Cannot mix POST and HEAD\n");
- if (0 == (r = open_postfile(optarg))) {
- posting = 1;
- }
- else if (postdata) {
- exit(r);
+ if (method != NO_METH)
+ err("Cannot mix POST with other methods\n");
+ if (open_postfile(opt_arg) != APR_SUCCESS) {
+ exit(1);
}
+ method = POST;
+ send_body = 1;
break;
case 'u':
- if (posting != 0)
- err("Cannot mix PUT and HEAD\n");
- if (0 == (r = open_postfile(optarg))) {
- posting = 2;
- }
- else if (postdata) {
- exit(r);
+ if (method != NO_METH)
+ err("Cannot mix PUT with other methods\n");
+ if (open_postfile(opt_arg) != APR_SUCCESS) {
+ exit(1);
}
+ method = PUT;
+ send_body = 1;
break;
case 'r':
recverrok = 1;
break;
case 'v':
- verbosity = atoi(optarg);
+ verbosity = atoi(opt_arg);
break;
case 't':
- tlimit = atoi(optarg);
+ tlimit = atoi(opt_arg);
requests = MAX_REQUESTS; /* need to size data array on
* something */
break;
case 'T':
- strcpy(content_type, optarg);
+ strcpy(content_type, opt_arg);
break;
case 'C':
- cookie = apr_pstrcat(cntxt, "Cookie: ", optarg, "\r\n", NULL);
+ cookie = apr_pstrcat(cntxt, "Cookie: ", opt_arg, "\r\n", NULL);
break;
case 'A':
/*
* assume username passwd already to be in colon separated form.
* Ready to be uu-encoded.
*/
- while (apr_isspace(*optarg))
- optarg++;
- if (apr_base64_encode_len(strlen(optarg)) > sizeof(tmp)) {
+ while (apr_isspace(*opt_arg))
+ opt_arg++;
+ if (apr_base64_encode_len(strlen(opt_arg)) > sizeof(tmp)) {
err("Authentication credentials too long\n");
}
- l = apr_base64_encode(tmp, optarg, strlen(optarg));
+ l = apr_base64_encode(tmp, opt_arg, strlen(opt_arg));
tmp[l] = '\0';
auth = apr_pstrcat(cntxt, auth, "Authorization: Basic ", tmp,
@@ -2142,27 +2148,27 @@ int main(int argc, const char * const argv[])
/*
* assume username passwd already to be in colon separated form.
*/
- while (apr_isspace(*optarg))
- optarg++;
- if (apr_base64_encode_len(strlen(optarg)) > sizeof(tmp)) {
+ while (apr_isspace(*opt_arg))
+ opt_arg++;
+ if (apr_base64_encode_len(strlen(opt_arg)) > sizeof(tmp)) {
err("Proxy credentials too long\n");
}
- l = apr_base64_encode(tmp, optarg, strlen(optarg));
+ l = apr_base64_encode(tmp, opt_arg, strlen(opt_arg));
tmp[l] = '\0';
auth = apr_pstrcat(cntxt, auth, "Proxy-Authorization: Basic ",
tmp, "\r\n", NULL);
break;
case 'H':
- hdrs = apr_pstrcat(cntxt, hdrs, optarg, "\r\n", NULL);
+ hdrs = apr_pstrcat(cntxt, hdrs, opt_arg, "\r\n", NULL);
/*
* allow override of some of the common headers that ab adds
*/
- if (strncasecmp(optarg, "Host:", 5) == 0) {
+ if (strncasecmp(opt_arg, "Host:", 5) == 0) {
opt_host = 1;
- } else if (strncasecmp(optarg, "Accept:", 7) == 0) {
+ } else if (strncasecmp(opt_arg, "Accept:", 7) == 0) {
opt_accept = 1;
- } else if (strncasecmp(optarg, "User-Agent:", 11) == 0) {
+ } else if (strncasecmp(opt_arg, "User-Agent:", 11) == 0) {
opt_useragent = 1;
}
break;
@@ -2175,7 +2181,7 @@ int main(int argc, const char * const argv[])
*/
case 'x':
use_html = 1;
- tablestring = optarg;
+ tablestring = opt_arg;
break;
case 'X':
{
@@ -2183,22 +2189,22 @@ int main(int argc, const char * const argv[])
/*
* assume proxy-name[:port]
*/
- if ((p = strchr(optarg, ':'))) {
+ if ((p = strchr(opt_arg, ':'))) {
*p = '\0';
p++;
proxyport = atoi(p);
}
- strcpy(proxyhost, optarg);
+ strcpy(proxyhost, opt_arg);
isproxy = 1;
}
break;
case 'y':
use_html = 1;
- trstring = optarg;
+ trstring = opt_arg;
break;
case 'z':
use_html = 1;
- tdstring = optarg;
+ tdstring = opt_arg;
break;
case 'h':
usage(argv[0]);
@@ -2206,20 +2212,23 @@ int main(int argc, const char * const argv[])
case 'V':
copyright();
return 0;
+ case 'B':
+ myhost = apr_pstrdup(cntxt, opt_arg);
+ break;
#ifdef USE_SSL
case 'Z':
- ssl_cipher = strdup(optarg);
+ ssl_cipher = strdup(opt_arg);
break;
case 'f':
- if (strncasecmp(optarg, "ALL", 3) == 0) {
+ if (strncasecmp(opt_arg, "ALL", 3) == 0) {
meth = SSLv23_client_method();
#ifndef OPENSSL_NO_SSL2
- } else if (strncasecmp(optarg, "SSL2", 4) == 0) {
+ } else if (strncasecmp(opt_arg, "SSL2", 4) == 0) {
meth = SSLv2_client_method();
#endif
- } else if (strncasecmp(optarg, "SSL3", 4) == 0) {
+ } else if (strncasecmp(opt_arg, "SSL3", 4) == 0) {
meth = SSLv3_client_method();
- } else if (strncasecmp(optarg, "TLS1", 4) == 0) {
+ } else if (strncasecmp(opt_arg, "TLS1", 4) == 0) {
meth = TLSv1_client_method();
}
break;
@@ -2232,6 +2241,10 @@ int main(int argc, const char * const argv[])
usage(argv[0]);
}
+ if (method == NO_METH) {
+ method = GET;
+ }
+
if (parse_url(apr_pstrdup(cntxt, opt->argv[opt->ind++]))) {
fprintf(stderr, "%s: invalid URL\n", argv[0]);
usage(argv[0]);
@@ -2275,6 +2288,10 @@ int main(int argc, const char * const argv[])
exit(1);
}
SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL);
+#ifdef SSL_MODE_RELEASE_BUFFERS
+ /* Keep memory usage as low as possible */
+ SSL_CTX_set_mode (ssl_ctx, SSL_MODE_RELEASE_BUFFERS);
+#endif
if (ssl_cipher != NULL) {
if (!SSL_CTX_set_cipher_list(ssl_ctx, ssl_cipher)) {
fprintf(stderr, "error setting cipher list [%s]\n", ssl_cipher);
diff --git a/support/ab.dep b/support/ab.dep
deleted file mode 100644
index 34dfe85a..00000000
--- a/support/ab.dep
+++ /dev/null
@@ -1,16 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by ab.mak
-
-.\ab.c : \
- "..\include\ap_release.h"\
- "..\srclib\apr-util\include\apr_base64.h"\
- "..\srclib\apr\include\apr_getopt.h"\
- "..\srclib\apr\include\apr_lib.h"\
- "..\srclib\apr\include\apr_poll.h"\
- "..\srclib\apr\include\apr_portable.h"\
- "..\srclib\apr\include\apr_signal.h"\
- "..\srclib\apr\include\apr_strings.h"\
-
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
diff --git a/support/ab.mak b/support/ab.mak
deleted file mode 100644
index 20ba112c..00000000
--- a/support/ab.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on ab.dsp
-!IF "$(CFG)" == ""
-CFG=ab - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to ab - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "ab - Win32 Release" && "$(CFG)" != "ab - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ab.mak" CFG="ab - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ab - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "ab - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "ab - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\ab.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\ab.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\ab.obj"
- -@erase "$(INTDIR)\ab.res"
- -@erase "$(INTDIR)\ab_src.idb"
- -@erase "$(INTDIR)\ab_src.pdb"
- -@erase "$(OUTDIR)\ab.exe"
- -@erase "$(OUTDIR)\ab.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ab_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ab.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="ab.exe" /d LONG_NAME="ApacheBench command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\ab.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\ab.pdb" /debug /out:"$(OUTDIR)\ab.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\ab.obj" \
- "$(INTDIR)\ab.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\ab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\ab.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\ab.exe"
- if exist .\Release\ab.exe.manifest mt.exe -manifest .\Release\ab.exe.manifest -outputresource:.\Release\ab.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "ab - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\ab.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\ab.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\ab.obj"
- -@erase "$(INTDIR)\ab.res"
- -@erase "$(INTDIR)\ab_src.idb"
- -@erase "$(INTDIR)\ab_src.pdb"
- -@erase "$(OUTDIR)\ab.exe"
- -@erase "$(OUTDIR)\ab.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ab_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ab.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="ab.exe" /d LONG_NAME="ApacheBench command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\ab.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\ab.pdb" /debug /out:"$(OUTDIR)\ab.exe"
-LINK32_OBJS= \
- "$(INTDIR)\ab.obj" \
- "$(INTDIR)\ab.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\ab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\ab.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\ab.exe"
- if exist .\Debug\ab.exe.manifest mt.exe -manifest .\Debug\ab.exe.manifest -outputresource:.\Debug\ab.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("ab.dep")
-!INCLUDE "ab.dep"
-!ELSE
-!MESSAGE Warning: cannot find "ab.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "ab - Win32 Release" || "$(CFG)" == "ab - Win32 Debug"
-
-!IF "$(CFG)" == "ab - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "ab - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "ab - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "ab - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=.\ab.c
-
-"$(INTDIR)\ab.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "ab - Win32 Release"
-
-
-"$(INTDIR)\ab.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\ab.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="ab.exe" /d LONG_NAME="ApacheBench command line utility" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "ab - Win32 Debug"
-
-
-"$(INTDIR)\ab.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\ab.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="ab.exe" /d LONG_NAME="ApacheBench command line utility" $(SOURCE)
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/support/abs.dep b/support/abs.dep
deleted file mode 100644
index 6097fa86..00000000
--- a/support/abs.dep
+++ /dev/null
@@ -1,16 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by abs.mak
-
-.\ab.c : \
- "..\include\ap_release.h"\
- "..\srclib\apr-util\include\apr_base64.h"\
- "..\srclib\apr\include\apr_getopt.h"\
- "..\srclib\apr\include\apr_lib.h"\
- "..\srclib\apr\include\apr_poll.h"\
- "..\srclib\apr\include\apr_portable.h"\
- "..\srclib\apr\include\apr_signal.h"\
- "..\srclib\apr\include\apr_strings.h"\
-
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
diff --git a/support/abs.mak b/support/abs.mak
deleted file mode 100644
index d14deacf..00000000
--- a/support/abs.mak
+++ /dev/null
@@ -1,336 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on abs.dsp
-!IF "$(CFG)" == ""
-CFG=abs - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to abs - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "abs - Win32 Release" && "$(CFG)" != "abs - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "abs.mak" CFG="abs - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "abs - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "abs - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "abs - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\abs.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\abs.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\ab.res"
- -@erase "$(INTDIR)\abs.obj"
- -@erase "$(INTDIR)\abs_src.idb"
- -@erase "$(INTDIR)\abs_src.pdb"
- -@erase "$(OUTDIR)\abs.exe"
- -@erase "$(OUTDIR)\abs.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /I "../srclib/openssl/inc32" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "HAVE_OPENSSL" /D "WIN32_LEAN_AND_MEAN" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\abs_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ab.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="ab.exe" /d LONG_NAME="ApacheBench/SSL command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\abs.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\abs.pdb" /debug /out:"$(OUTDIR)\abs.exe" /libpath:"../srclib/openssl/out32dll" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\abs.obj" \
- "$(INTDIR)\ab.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\abs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\abs.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\abs.exe"
- if exist .\Release\abs.exe.manifest mt.exe -manifest .\Release\abs.exe.manifest -outputresource:.\Release\abs.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "abs - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\abs.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\abs.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\ab.res"
- -@erase "$(INTDIR)\abs.obj"
- -@erase "$(INTDIR)\abs_src.idb"
- -@erase "$(INTDIR)\abs_src.pdb"
- -@erase "$(OUTDIR)\abs.exe"
- -@erase "$(OUTDIR)\abs.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /I "../srclib/openssl/inc32" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "HAVE_OPENSSL" /D "WIN32_LEAN_AND_MEAN" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\abs_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ab.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="ab.exe" /d LONG_NAME="ApacheBench/SSL command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\abs.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib ssleay32.lib libeay32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\abs.pdb" /debug /out:"$(OUTDIR)\abs.exe" /libpath:"../srclib/openssl/out32dll"
-LINK32_OBJS= \
- "$(INTDIR)\abs.obj" \
- "$(INTDIR)\ab.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\abs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\abs.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\abs.exe"
- if exist .\Debug\abs.exe.manifest mt.exe -manifest .\Debug\abs.exe.manifest -outputresource:.\Debug\abs.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("abs.dep")
-!INCLUDE "abs.dep"
-!ELSE
-!MESSAGE Warning: cannot find "abs.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "abs - Win32 Release" || "$(CFG)" == "abs - Win32 Debug"
-
-!IF "$(CFG)" == "abs - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "abs - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "abs - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "abs - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=.\ab.c
-
-!IF "$(CFG)" == "abs - Win32 Release"
-
-CPP_SWITCHES=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /I "../srclib/openssl/inc32" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "HAVE_OPENSSL" /D "WIN32_LEAN_AND_MEAN" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /Fo"$(INTDIR)\abs.obj" /Fd"$(INTDIR)\abs_src" /FD /c
-
-"$(INTDIR)\abs.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ELSEIF "$(CFG)" == "abs - Win32 Debug"
-
-CPP_SWITCHES=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /I "../srclib/openssl/inc32" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /D "HAVE_OPENSSL" /D "WIN32_LEAN_AND_MEAN" /D "NO_IDEA" /D "NO_RC5" /D "NO_MDC2" /D "OPENSSL_NO_IDEA" /D "OPENSSL_NO_RC5" /D "OPENSSL_NO_MDC2" /Fo"$(INTDIR)\abs.obj" /Fd"$(INTDIR)\abs_src" /FD /EHsc /c
-
-"$(INTDIR)\abs.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ENDIF
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "abs - Win32 Release"
-
-
-"$(INTDIR)\ab.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\ab.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="ab.exe" /d LONG_NAME="ApacheBench/SSL command line utility" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "abs - Win32 Debug"
-
-
-"$(INTDIR)\ab.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\ab.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="ab.exe" /d LONG_NAME="ApacheBench/SSL command line utility" $(SOURCE)
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/support/apachectl.in b/support/apachectl.in
index d4dff38a..3281c2e6 100644
--- a/support/apachectl.in
+++ b/support/apachectl.in
@@ -35,6 +35,7 @@
# When multiple arguments are given, only the error from the _last_
# one is reported. Run "apachectl help" for usage info
#
+ACMD="$1"
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
@@ -75,7 +76,7 @@ if [ "x$ARGV" = "x" ] ; then
ARGV="-h"
fi
-case $ARGV in
+case $ACMD in
start|stop|restart|graceful|graceful-stop)
$HTTPD -k $ARGV
ERROR=$?
@@ -97,7 +98,7 @@ fullstatus)
$LYNX $STATUSURL
;;
*)
- $HTTPD $ARGV
+ $HTTPD "$@"
ERROR=$?
esac
diff --git a/support/apxs.in b/support/apxs.in
index 1900a787..39ff16cd 100644
--- a/support/apxs.in
+++ b/support/apxs.in
@@ -75,6 +75,7 @@ my $opt_A = 0;
my $opt_q = 0;
my $opt_h = 0;
my $opt_p = 0;
+my $opt_v = 0;
# this subroutine is derived from Perl's getopts.pl with the enhancement of
# the "+" metacharacter at the format string to allow a list to be built by
@@ -141,7 +142,7 @@ sub Getopts {
sub usage {
print STDERR "Usage: apxs -g [-S <var>=<val>] -n <modname>\n";
- print STDERR " apxs -q [-S <var>=<val>] <query> ...\n";
+ print STDERR " apxs -q [-v] [-S <var>=<val>] [<query> ...]\n";
print STDERR " apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]\n";
print STDERR " [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]\n";
print STDERR " [-Wl,<flags>] [-p] <files> ...\n";
@@ -152,9 +153,9 @@ sub usage {
# option handling
my $rc;
-($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaAp", @ARGV);
+($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaApv", @ARGV);
&usage if ($rc == 0);
-&usage if ($#ARGV == -1 and not $opt_g);
+&usage if ($#ARGV == -1 and not $opt_g and not $opt_q);
&usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not $opt_c and not $opt_e);
# argument handling
@@ -186,28 +187,11 @@ if (@opt_S) {
##
## Initial shared object support check
##
-my $httpd = get_vars("sbindir") . "/" . get_vars("progname");
-$httpd = eval qq("$httpd");
-$httpd = eval qq("$httpd");
-my $envvars = get_vars("sbindir") . "/envvars";
-$envvars = eval qq("$envvars");
-$envvars = eval qq("$envvars");
-
-#allow apxs to be run from the source tree, before installation
-if ($0 =~ m:support/apxs$:) {
- ($httpd = $0) =~ s:support/apxs$::;
-}
-
-unless (-x "$httpd") {
- error("$httpd not found or not executable");
- exit 1;
-}
-
-unless (grep /mod_so/, `. $envvars && $httpd -l`) {
+unless ("@MOD_SO_ENABLED@" eq "yes") {
error("Sorry, no shared object support for Apache");
error("available under your platform. Make sure");
error("the Apache module mod_so is compiled into");
- error("your server binary `$httpd'.");
+ error("the server binary.");
exit 1;
}
@@ -252,7 +236,6 @@ sub get_vars {
}
}
$result =~ s|;;$||;
- $result =~ s|:| |;
return $result;
}
@@ -319,8 +302,35 @@ if ($opt_q) {
##
## QUERY INFORMATION
##
- my $result = get_vars(@args);
- print "$result\n";
+ my $result;
+ if ($#args >= 0) {
+ $result = get_vars(@args);
+ print "$result\n";
+ } else {
+ # -q without var name prints all variables and their values
+
+ # Additional -v pretty-prints output
+ if ($opt_v) {
+ # Variable names in alphabetic order
+ my @vars = sort {uc($a) cmp uc($b)} keys %config_vars;
+
+ # Make the left column as wide as the longest variable name
+ my $width = 0;
+ foreach (@vars) {
+ my $l = length $_;
+ $width = $l unless ($l <= $width);
+ }
+
+ foreach (@vars) {
+ printf "%-${width}s = %s\n", $_, $config_vars{$_};
+ }
+ } else {
+ # Unprettified name=value list
+ foreach (keys %config_vars) {
+ print "$_=$config_vars{$_}\n";
+ }
+ }
+ }
}
my $apr_config = get_vars("APR_CONFIG");
@@ -330,11 +340,16 @@ if (! -x "$apr_config") {
exit(1);
}
-my $apu_config = get_vars("APU_CONFIG");
+my $apr_major_version = (split /\./, `$apr_config --version`)[0];
-if (! -x "$apu_config") {
- error("$apu_config not found!");
- exit(1);
+my $apu_config = "";
+if ($apr_major_version < 2) {
+ $apu_config = get_vars("APU_CONFIG");
+
+ if (! -x "$apu_config") {
+ error("$apu_config not found!");
+ exit(1);
+ }
}
my $libtool = `$apr_config --apr-libtool`;
@@ -342,8 +357,11 @@ chomp($libtool);
my $apr_includedir = `$apr_config --includes`;
chomp($apr_includedir);
-my $apu_includedir = `$apu_config --includes`;
-chomp($apu_includedir);
+my $apu_includedir = "";
+if ($apr_major_version < 2) {
+ $apu_includedir = `$apu_config --includes`;
+ chomp($apu_includedir);
+}
if ($opt_c) {
##
@@ -434,8 +452,11 @@ if ($opt_c) {
my $apr_libs=`$apr_config --cflags --ldflags --link-libtool --libs`;
chomp($apr_libs);
- my $apu_libs=`$apu_config --ldflags --link-libtool --libs`;
- chomp($apu_libs);
+ my $apu_libs="";
+ if ($apr_major_version < 2) {
+ $apu_libs=`$apu_config --ldflags --link-libtool --libs`;
+ chomp($apu_libs);
+ }
$opt .= " ".$apu_libs." ".$apr_libs;
}
@@ -492,7 +513,7 @@ if ($opt_i or $opt_e) {
open(FP, "<$base.c");
my $content = join('', <FP>);
close(FP);
- if ($content =~ m|.*module\s+(?:AP_MODULE_DECLARE_DATA\s+)?([a-zA-Z0-9_]+)_module\s*=\s*.*|s) {
+ if ($content =~ m|.*AP_DECLARE_MODULE\s*\(\s*([a-zA-Z0-9_]+)\s*\)\s*=.*|s || $content =~ m|.*module\s+(?:AP_MODULE_DECLARE_DATA\s+)?([a-zA-Z0-9_]+)_module\s*=\s*.*|s) {
$name = "$1";
$filename = "$base.c";
$filename =~ s|^[^/]+/||;
diff --git a/support/check_forensic b/support/check_forensic
index 3c8123fc..d7a3f785 100755
--- a/support/check_forensic
+++ b/support/check_forensic
@@ -43,8 +43,8 @@ out=$name
trap "rm -f -- \"$all\" \"$in\" \"$out\";" 0 1 2 3 13 15
cut -f 1 -d '|' $F > $all
-grep + < $all | cut -c2- | sort > $in
-grep -- - < $all | cut -c2- | sort > $out
+grep ^+ < $all | cut -c2- | sort > $in
+grep -- ^- < $all | cut -c2- | sort > $out
# use -i instead of -I for GNU xargs
join -v 1 $in $out | xargs -I xx egrep "^\\+xx" $F
diff --git a/support/config.m4 b/support/config.m4
index c0ea8f91..4865e38e 100644
--- a/support/config.m4
+++ b/support/config.m4
@@ -7,6 +7,7 @@ ab_LTFLAGS=""
checkgid_LTFLAGS=""
htcacheclean_LTFLAGS=""
httxt2dbm_LTFLAGS=""
+fcgistarter_LTFLAGS=""
AC_ARG_ENABLE(static-support,APACHE_HELP_STRING(--enable-static-support,Build a statically linked version of the support binaries),[
if test "$enableval" = "yes" ; then
@@ -19,6 +20,7 @@ if test "$enableval" = "yes" ; then
APR_ADDTO(checkgid_LTFLAGS, [-static])
APR_ADDTO(htcacheclean_LTFLAGS, [-static])
APR_ADDTO(httxt2dbm_LTFLAGS, [-static])
+ APR_ADDTO(fcgistarter_LTFLAGS, [-static])
fi
])
@@ -103,6 +105,15 @@ fi
])
APACHE_SUBST(httxt2dbm_LTFLAGS)
+AC_ARG_ENABLE(static-fcgistarter,APACHE_HELP_STRING(--enable-static-fcgistarter,Build a statically linked version of fcgistarter),[
+if test "$enableval" = "yes" ; then
+ APR_ADDTO(fcgistarter_LTFLAGS, [-static])
+else
+ APR_REMOVEFROM(fcgistarter, [-static])
+fi
+])
+APACHE_SUBST(fcgistarter_LTFLAGS)
+
# Configure or check which of the non-portable support programs can be enabled.
NONPORTABLE_SUPPORT=""
@@ -110,7 +121,7 @@ case $host in
*mingw*)
;;
*)
- NONPORTABLE_SUPPORT="checkgid"
+ NONPORTABLE_SUPPORT="checkgid fcgistarter"
;;
esac
APACHE_SUBST(NONPORTABLE_SUPPORT)
@@ -130,7 +141,7 @@ case $host in
APACHECTL_ULIMIT="ulimit -S -n \`ulimit -h -n\`"
;;
*)
- if TMP_ULIMIT=`ulimit -H -n` && ulimit -S -n $TMP_ULIMIT ; then
+ if TMP_ULIMIT=`ulimit -H -n` && ulimit -S -n $TMP_ULIMIT >/dev/null 2>&1; then
APACHECTL_ULIMIT="ulimit -S -n \`ulimit -H -n\`"
else
APACHECTL_ULIMIT=""
diff --git a/support/fcgistarter.c b/support/fcgistarter.c
new file mode 100644
index 00000000..2e2c3e56
--- /dev/null
+++ b/support/fcgistarter.c
@@ -0,0 +1,215 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <apr.h>
+#include <apr_pools.h>
+#include <apr_network_io.h>
+#include <apr_thread_proc.h>
+#include <apr_getopt.h>
+#include <apr_portable.h>
+
+#if APR_HAVE_STDLIB_H
+#include <stdlib.h> /* For EXIT_SUCCESS, EXIT_FAILURE */
+#endif
+
+#if APR_HAVE_UNISTD_H
+#include <unistd.h> /* For execl */
+#endif
+
+static const char *usage_message =
+ "usage: fcgistarter -c <command> -p <port> [-i <interface> -N <num>]\n"
+ "\n"
+ "If an interface is not specified, any available will be used.\n";
+
+static void usage(void)
+{
+ fprintf(stderr, "%s", usage_message);
+
+ exit(EXIT_FAILURE);
+}
+
+static void exit_error(apr_status_t rv, const char *func)
+{
+ char buffer[1024];
+
+ fprintf(stderr,
+ "%s: %s\n",
+ func,
+ apr_strerror(rv, buffer, sizeof(buffer)));
+
+ exit(EXIT_FAILURE);
+}
+
+int main(int argc, const char * const argv[])
+{
+ apr_file_t *infd, *skwrapper;
+ apr_sockaddr_t *skaddr;
+ apr_getopt_t *gopt;
+ apr_socket_t *skt;
+ apr_pool_t *pool;
+ apr_status_t rv;
+ apr_proc_t proc;
+
+
+ /* Command line arguments */
+ int num_to_start = 1, port = 0;
+ const char *interface = NULL;
+ const char *command = NULL;
+
+ apr_app_initialize(&argc, &argv, NULL);
+
+ atexit(apr_terminate);
+
+ apr_pool_create(&pool, NULL);
+
+ rv = apr_getopt_init(&gopt, pool, argc, argv);
+ if (rv) {
+ return EXIT_FAILURE;
+ }
+
+ for (;;) {
+ const char *arg;
+ char opt;
+
+ rv = apr_getopt(gopt, "c:p:i:N:", &opt, &arg);
+ if (APR_STATUS_IS_EOF(rv)) {
+ break;
+ } else if (rv) {
+ usage();
+ } else {
+ switch (opt) {
+ case 'c':
+ command = arg;
+ break;
+
+ case 'p':
+ port = atoi(arg);
+ if (! port) {
+ usage();
+ }
+ break;
+
+ case 'i':
+ interface = arg;
+ break;
+
+ case 'N':
+ num_to_start = atoi(arg);
+ if (! num_to_start) {
+ usage();
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ if (! command || ! port) {
+ usage();
+ }
+
+ rv = apr_sockaddr_info_get(&skaddr, interface, APR_UNSPEC, port, 0, pool);
+ if (rv) {
+ exit_error(rv, "apr_sockaddr_info_get");
+ }
+
+ rv = apr_socket_create(&skt, skaddr->family, SOCK_STREAM, APR_PROTO_TCP, pool);
+ if (rv) {
+ exit_error(rv, "apr_socket_create");
+ }
+
+ rv = apr_socket_bind(skt, skaddr);
+ if (rv) {
+ exit_error(rv, "apr_socket_bind");
+ }
+
+ rv = apr_socket_listen(skt, 1024);
+ if (rv) {
+ exit_error(rv, "apr_socket_listen");
+ }
+
+ rv = apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
+ if (rv) {
+ exit_error(rv, "apr_proc_detach");
+ }
+
+#if defined(WIN32) || defined(OS2) || defined(NETWARE)
+
+#error "Please implement me."
+
+#else
+
+ while (--num_to_start >= 0) {
+ rv = apr_proc_fork(&proc, pool);
+ if (rv == APR_INCHILD) {
+ apr_os_file_t oft = 0;
+ apr_os_sock_t oskt;
+
+ /* Ok, so we need a file that has file descriptor 0 (which
+ * FastCGI wants), but points to our socket. This isn't really
+ * possible in APR, so we cheat a bit. I have no idea how to
+ * do this on a non-unix platform, so for now this is platform
+ * specific. Ick.
+ *
+ * Note that this has to happen post-detach, otherwise fd 0
+ * gets closed during apr_proc_detach and it's all for nothing.
+ *
+ * Unfortunately, doing this post detach means we have no way
+ * to let anyone know if there's a problem at this point :( */
+
+ rv = apr_os_file_put(&infd, &oft, APR_READ | APR_WRITE, pool);
+ if (rv) {
+ exit(EXIT_FAILURE);
+ }
+
+ rv = apr_os_sock_get(&oskt, skt);
+ if (rv) {
+ exit(EXIT_FAILURE);
+ }
+
+ rv = apr_os_file_put(&skwrapper, &oskt, APR_READ | APR_WRITE,
+ pool);
+ if (rv) {
+ exit(EXIT_FAILURE);
+ }
+
+ rv = apr_file_dup2(infd, skwrapper, pool);
+ if (rv) {
+ exit(EXIT_FAILURE);
+ }
+
+ /* XXX Can't use apr_proc_create because there's no way to get
+ * infd into the procattr without going through another dup2,
+ * which means by the time it gets to the fastcgi process it
+ * is no longer fd 0, so it doesn't work. Sigh. */
+
+ execl(command, command, NULL);
+
+ } else if (rv == APR_INPARENT) {
+ if (num_to_start == 0) {
+ apr_socket_close(skt);
+ }
+ } else {
+ exit_error(rv, "apr_proc_fork");
+ }
+ }
+
+#endif
+
+ return EXIT_SUCCESS;
+}
diff --git a/support/fcgistarter.dsp b/support/fcgistarter.dsp
new file mode 100644
index 00000000..9cd5780b
--- /dev/null
+++ b/support/fcgistarter.dsp
@@ -0,0 +1,106 @@
+# Microsoft Developer Studio Project File - Name="fcgistarter" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=fcgistarter - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "fcgistarter.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "fcgistarter.mak" CFG="fcgistarter - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "fcgistarter - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "fcgistarter - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "fcgistarter - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c
+# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/fcgistarter_src" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /fo"Release/fcgistarter.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="fcgistarter.exe" /d LONG_NAME="Apache fcgi command line utility"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console
+# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /debug /opt:ref
+# Begin Special Build Tool
+TargetPath=.\Release\fcgistarter.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).manifest -outputresource:$(TargetPath);2
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "fcgistarter - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /I "../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/fcgistarter_src" /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /fo"Debug/fcgistarter.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="fcgistarter.exe" /d LONG_NAME="Apache fcgi command line utility"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /debug
+# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /debug
+# Begin Special Build Tool
+TargetPath=.\Debug\fcgistarter.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).manifest -outputresource:$(TargetPath);2
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "fcgistarter - Win32 Release"
+# Name "fcgistarter - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\fcgistarter.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\build\win32\httpd.rc
+# End Source File
+# End Target
+# End Project
diff --git a/support/htcacheclean.c b/support/htcacheclean.c
index 63f47c42..9ca92789 100644
--- a/support/htcacheclean.c
+++ b/support/htcacheclean.c
@@ -32,9 +32,13 @@
#include "apr_thread_proc.h"
#include "apr_signal.h"
#include "apr_getopt.h"
+#include "apr_md5.h"
#include "apr_ring.h"
#include "apr_date.h"
-#include "../modules/cache/mod_disk_cache.h"
+#include "apr_buckets.h"
+
+#include "../modules/cache/cache_common.h"
+#include "../modules/cache/cache_disk_common.h"
#if APR_HAVE_UNISTD_H
#include <unistd.h>
@@ -97,10 +101,13 @@ static int benice; /* flag: true means nice mode is activated */
static int dryrun; /* flag: true means dry run, don't actually delete
anything */
static int deldirs; /* flag: true means directories should be deleted */
+static int listurls; /* flag: true means list cached urls */
+static int listextended;/* flag: true means list cached urls */
static int baselen; /* string length of the path to the proxy directory */
static apr_time_t now; /* start time of this processing run */
static apr_file_t *errfile; /* stderr file handle */
+static apr_file_t *outfile; /* stdout file handle */
static apr_off_t unsolicited; /* file size summary for deleted unsolicited
files */
static APR_RING_ENTRY(_entry) root; /* ENTRY ring anchor */
@@ -108,6 +115,22 @@ static APR_RING_ENTRY(_entry) root; /* ENTRY ring anchor */
/* short program name as called */
static const char *shortname = "htcacheclean";
+/* what did we clean? */
+struct stats {
+ apr_off_t total;
+ apr_off_t sum;
+ apr_off_t max;
+ apr_off_t ntotal;
+ apr_off_t nodes;
+ apr_off_t inodes;
+ apr_off_t etotal;
+ apr_off_t entries;
+ apr_off_t dfuture;
+ apr_off_t dexpired;
+ apr_off_t dfresh;
+};
+
+
#ifdef DEBUG
/*
* fake delete for debug purposes
@@ -153,8 +176,7 @@ static int oom(int unused)
/*
* print purge statistics
*/
-static void printstats(apr_off_t total, apr_off_t sum, apr_off_t max,
- apr_off_t etotal, apr_off_t entries)
+static void printstats(char *path, struct stats *s)
{
char ttype, stype, mtype, utype;
apr_off_t tfrag, sfrag, ufrag;
@@ -164,31 +186,31 @@ static void printstats(apr_off_t total, apr_off_t sum, apr_off_t max,
}
ttype = 'K';
- tfrag = ((total * 10) / KBYTE) % 10;
- total /= KBYTE;
- if (total >= KBYTE) {
+ tfrag = ((s->total * 10) / KBYTE) % 10;
+ s->total /= KBYTE;
+ if (s->total >= KBYTE) {
ttype = 'M';
- tfrag = ((total * 10) / KBYTE) % 10;
- total /= KBYTE;
+ tfrag = ((s->total * 10) / KBYTE) % 10;
+ s->total /= KBYTE;
}
stype = 'K';
- sfrag = ((sum * 10) / KBYTE) % 10;
- sum /= KBYTE;
- if (sum >= KBYTE) {
+ sfrag = ((s->sum * 10) / KBYTE) % 10;
+ s->sum /= KBYTE;
+ if (s->sum >= KBYTE) {
stype = 'M';
- sfrag = ((sum * 10) / KBYTE) % 10;
- sum /= KBYTE;
+ sfrag = ((s->sum * 10) / KBYTE) % 10;
+ s->sum /= KBYTE;
}
mtype = 'K';
- max /= KBYTE;
- if (max >= KBYTE) {
+ s->max /= KBYTE;
+ if (s->max >= KBYTE) {
mtype = 'M';
- max /= KBYTE;
+ s->max /= KBYTE;
}
- apr_file_printf(errfile, "Statistics:" APR_EOL_STR);
+ apr_file_printf(errfile, "Cleaned %s. Statistics:" APR_EOL_STR, path);
if (unsolicited) {
utype = 'K';
ufrag = ((unsolicited * 10) / KBYTE) % 10;
@@ -203,33 +225,120 @@ static void printstats(apr_off_t total, apr_off_t sum, apr_off_t max,
}
apr_file_printf(errfile, "unsolicited size %d.%d%c" APR_EOL_STR,
(int)(unsolicited), (int)(ufrag), utype);
- }
- apr_file_printf(errfile, "size limit %d.0%c" APR_EOL_STR,
- (int)(max), mtype);
- apr_file_printf(errfile, "total size was %d.%d%c, total size now "
- "%d.%d%c" APR_EOL_STR,
- (int)(total), (int)(tfrag), ttype, (int)(sum),
- (int)(sfrag), stype);
- apr_file_printf(errfile, "total entries was %d, total entries now %d"
- APR_EOL_STR, (int)(etotal), (int)(entries));
+ }
+ apr_file_printf(errfile, "size limit %" APR_OFF_T_FMT ".0%c" APR_EOL_STR,
+ s->max, mtype);
+ apr_file_printf(errfile, "inodes limit %" APR_OFF_T_FMT APR_EOL_STR,
+ s->inodes);
+ apr_file_printf(
+ errfile,
+ "total size was %" APR_OFF_T_FMT ".%" APR_OFF_T_FMT "%c, total size now "
+ "%" APR_OFF_T_FMT ".%" APR_OFF_T_FMT "%c" APR_EOL_STR, s->total,
+ tfrag, ttype, s->sum, sfrag, stype);
+ apr_file_printf(errfile, "total inodes was %" APR_OFF_T_FMT
+ ", total %sinodes now "
+ "%" APR_OFF_T_FMT APR_EOL_STR, s->ntotal, dryrun && deldirs ? "estimated "
+ : "", s->nodes);
+ apr_file_printf(
+ errfile,
+ "total entries was %" APR_OFF_T_FMT ", total entries now %" APR_OFF_T_FMT
+ APR_EOL_STR, s->etotal, s->entries);
+ apr_file_printf(
+ errfile,
+ "%" APR_OFF_T_FMT " entries deleted (%" APR_OFF_T_FMT " from future, %"
+ APR_OFF_T_FMT " expired, %" APR_OFF_T_FMT " fresh)" APR_EOL_STR,
+ (s->etotal - s->entries), s->dfuture, s->dexpired, s->dfresh);
+}
+
+/**
+ * Round the value up to the given threshold.
+ */
+static apr_size_t round_up(apr_size_t val, apr_off_t round) {
+ if (round > 1) {
+ return (apr_size_t)(((val + round - 1) / round) * round);
+ }
+ return val;
}
/*
- * delete a single file
+ * delete parent directories
*/
-static void delete_file(char *path, char *basename, apr_pool_t *pool)
+static void delete_parent(const char *path, const char *basename,
+ apr_off_t *nodes, apr_pool_t *pool)
{
- char *nextpath;
+ char *nextpath, *name;
apr_pool_t *p;
- if (dryrun) {
- return;
+ /* temp pool, otherwise lots of memory could be allocated */
+ apr_pool_create(&p, pool);
+ name = apr_pstrdup(p, basename);
+
+ /* If asked to delete dirs, do so now. We don't care if it fails.
+ * If it fails, it likely means there was something else there.
+ */
+ if (deldirs && !dryrun) {
+ const char *vary;
+ char *end = strrchr(name, '/');
+ while (end) {
+ *end = 0;
+
+ /* remove the directory */
+ nextpath = apr_pstrcat(p, path, "/", name, NULL);
+ if (!apr_dir_remove(nextpath, p)) {
+ (*nodes)--;
+
+ /* vary directory found? */
+ vary = strstr(name, CACHE_VDIR_SUFFIX);
+ if (vary && !vary[sizeof(CACHE_VDIR_SUFFIX) - 1]) {
+ nextpath = apr_pstrcat(p, path, "/", apr_pstrndup(p, name, vary
+ - name), NULL);
+ if (!apr_file_remove(nextpath, p)) {
+ (*nodes)--;
+ }
+ }
+
+ }
+ else {
+ break;
+ }
+ end = strrchr(name, '/');
+ }
+ }
+
+ apr_pool_destroy(p);
+
+ if (benice) {
+ if (++delcount >= DELETE_NICE) {
+ apr_sleep(NICE_DELAY);
+ delcount = 0;
+ }
}
+}
+
+/*
+ * delete a single file
+ */
+static void delete_file(char *path, char *basename, apr_off_t *nodes,
+ apr_pool_t *pool)
+{
+ char *nextpath;
+ apr_pool_t *p;
+
/* temp pool, otherwise lots of memory could be allocated */
apr_pool_create(&p, pool);
nextpath = apr_pstrcat(p, path, "/", basename, NULL);
- apr_file_remove(nextpath, p);
+
+ if (dryrun) {
+ apr_finfo_t finfo;
+ if (!apr_stat(&finfo, nextpath, APR_FINFO_NLINK, p)) {
+ (*nodes)--;
+ }
+ }
+ else if (!apr_file_remove(nextpath, p)) {
+ (*nodes)--;
+ }
+
apr_pool_destroy(p);
if (benice) {
@@ -238,28 +347,44 @@ static void delete_file(char *path, char *basename, apr_pool_t *pool)
delcount = 0;
}
}
+
+ delete_parent(path, basename, nodes, pool);
+
}
/*
* delete cache file set
*/
-static void delete_entry(char *path, char *basename, apr_pool_t *pool)
+static void delete_entry(char *path, char *basename, apr_off_t *nodes,
+ apr_pool_t *pool)
{
char *nextpath;
apr_pool_t *p;
- if (dryrun) {
- return;
- }
-
/* temp pool, otherwise lots of memory could be allocated */
apr_pool_create(&p, pool);
nextpath = apr_pstrcat(p, path, "/", basename, CACHE_HEADER_SUFFIX, NULL);
- apr_file_remove(nextpath, p);
+ if (dryrun) {
+ apr_finfo_t finfo;
+ if (!apr_stat(&finfo, nextpath, APR_FINFO_NLINK, p)) {
+ (*nodes)--;
+ }
+ }
+ else if (!apr_file_remove(nextpath, p)) {
+ (*nodes)--;
+ }
nextpath = apr_pstrcat(p, path, "/", basename, CACHE_DATA_SUFFIX, NULL);
- apr_file_remove(nextpath, p);
+ if (dryrun) {
+ apr_finfo_t finfo;
+ if (!apr_stat(&finfo, nextpath, APR_FINFO_NLINK, p)) {
+ (*nodes)--;
+ }
+ }
+ else if (!apr_file_remove(nextpath, p)) {
+ (*nodes)--;
+ }
apr_pool_destroy(p);
@@ -270,12 +395,204 @@ static void delete_entry(char *path, char *basename, apr_pool_t *pool)
delcount = 0;
}
}
+
+ delete_parent(path, basename, nodes, pool);
+
+}
+
+/*
+ * list the cache directory tree
+ */
+static int list_urls(char *path, apr_pool_t *pool, apr_off_t round)
+{
+ apr_dir_t *dir;
+ apr_finfo_t info;
+ apr_size_t len;
+ apr_pool_t *p;
+ apr_file_t *fd;
+ const char *ext, *nextpath;
+ char *url;
+ apr_uint32_t format;
+ disk_cache_info_t disk_info;
+
+ apr_pool_create(&p, pool);
+
+ if (apr_dir_open(&dir, path, p) != APR_SUCCESS) {
+ return 1;
+ }
+
+ while (apr_dir_read(&info, 0, dir) == APR_SUCCESS && !interrupted) {
+
+ if (info.filetype == APR_DIR) {
+ if (!strcmp(info.name, ".") || !strcmp(info.name, "..")) {
+ continue;
+ }
+
+ if (list_urls(apr_pstrcat(p, path, "/", info.name, NULL), pool, round)) {
+ return 1;
+ }
+ }
+
+ else if (info.filetype == APR_REG) {
+
+ ext = strchr(info.name, '.');
+
+ if (ext && !strcasecmp(ext, CACHE_HEADER_SUFFIX)) {
+
+ nextpath = apr_pstrcat(p, path, "/", info.name, NULL);
+
+ if (apr_file_open(&fd, nextpath, APR_FOPEN_READ
+ | APR_FOPEN_BINARY, APR_OS_DEFAULT, p) == APR_SUCCESS) {
+ len = sizeof(format);
+ if (apr_file_read_full(fd, &format, len, &len)
+ == APR_SUCCESS) {
+ if (format == DISK_FORMAT_VERSION) {
+ apr_off_t offset = 0;
+
+ apr_file_seek(fd, APR_SET, &offset);
+
+ len = sizeof(disk_cache_info_t);
+
+ if (apr_file_read_full(fd, &disk_info, len, &len)
+ == APR_SUCCESS) {
+ len = disk_info.name_len;
+ url = apr_palloc(p, len + 1);
+ url[len] = 0;
+
+ if (apr_file_read_full(fd, url, len, &len)
+ == APR_SUCCESS) {
+
+ if (listextended) {
+ apr_finfo_t hinfo, dinfo;
+
+ /* stat the header file */
+ if (APR_SUCCESS != apr_file_info_get(
+ &hinfo, APR_FINFO_SIZE, fd)) {
+ /* ignore the file */
+ }
+ else if (disk_info.has_body && APR_SUCCESS
+ != apr_stat(
+ &dinfo,
+ apr_pstrcat(
+ p,
+ path,
+ "/",
+ apr_pstrndup(
+ p,
+ info.name,
+ ext
+ - info.name),
+ CACHE_DATA_SUFFIX,
+ NULL),
+ APR_FINFO_SIZE
+ | APR_FINFO_IDENT,
+ p)) {
+ /* ignore the file */
+ }
+ else if (disk_info.has_body && (dinfo.device
+ != disk_info.device
+ || dinfo.inode
+ != disk_info.inode)) {
+ /* ignore the file */
+ }
+ else {
+
+ apr_file_printf(
+ outfile,
+ "%s %" APR_SIZE_T_FMT
+ " %" APR_SIZE_T_FMT
+ " %d %" APR_SIZE_T_FMT
+ " %" APR_TIME_T_FMT
+ " %" APR_TIME_T_FMT
+ " %" APR_TIME_T_FMT
+ " %" APR_TIME_T_FMT
+ " %d %d\n",
+ url,
+ round_up((apr_size_t)hinfo.size, round),
+ round_up(
+ disk_info.has_body ? (apr_size_t)dinfo.size
+ : 0, round),
+ disk_info.status,
+ disk_info.entity_version,
+ disk_info.date,
+ disk_info.expire,
+ disk_info.request_time,
+ disk_info.response_time,
+ disk_info.has_body,
+ disk_info.header_only);
+ }
+ }
+ else {
+ apr_finfo_t dinfo;
+
+ /* stat the data file */
+ if (disk_info.has_body && APR_SUCCESS
+ != apr_stat(
+ &dinfo,
+ apr_pstrcat(
+ p,
+ path,
+ "/",
+ apr_pstrndup(
+ p,
+ info.name,
+ ext
+ - info.name),
+ CACHE_DATA_SUFFIX,
+ NULL),
+ APR_FINFO_SIZE
+ | APR_FINFO_IDENT,
+ p)) {
+ /* ignore the file */
+ }
+ else if (disk_info.has_body && (dinfo.device
+ != disk_info.device
+ || dinfo.inode
+ != disk_info.inode)) {
+ /* ignore the file */
+ }
+ else {
+ apr_file_printf(outfile, "%s\n",
+ url);
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ }
+ apr_file_close(fd);
+
+ }
+ }
+ }
+
+ }
+
+ apr_dir_close(dir);
+
+ if (interrupted) {
+ return 1;
+ }
+
+ apr_pool_destroy(p);
+
+ if (benice) {
+ apr_sleep(NICE_DELAY);
+ }
+
+ if (interrupted) {
+ return 1;
+ }
+
+ return 0;
}
/*
* walk the cache directory tree
*/
-static int process_dir(char *path, apr_pool_t *pool)
+static int process_dir(char *path, apr_pool_t *pool, apr_off_t *nodes)
{
apr_dir_t *dir;
apr_pool_t *p;
@@ -286,7 +603,7 @@ static int process_dir(char *path, apr_pool_t *pool)
apr_finfo_t info;
apr_size_t len;
apr_time_t current, deviation;
- char *nextpath, *base, *ext, *orig_basename;
+ char *nextpath, *base, *ext;
APR_RING_ENTRY(_direntry) anchor;
DIRENTRY *d, *t, *n;
ENTRY *e;
@@ -297,7 +614,6 @@ static int process_dir(char *path, apr_pool_t *pool)
apr_pool_create(&p, pool);
h = apr_hash_make(p);
fd = NULL;
- skip = 0;
deviation = MAXDEVIATION * APR_USEC_PER_SEC;
if (apr_dir_open(&dir, path, p) != APR_SUCCESS) {
@@ -311,6 +627,7 @@ static int process_dir(char *path, apr_pool_t *pool)
d = apr_pcalloc(p, sizeof(DIRENTRY));
d->basename = apr_pstrcat(p, path, "/", info.name, NULL);
APR_RING_INSERT_TAIL(&anchor, d, _direntry, link);
+ (*nodes)++;
}
apr_dir_close(dir);
@@ -341,7 +658,7 @@ static int process_dir(char *path, apr_pool_t *pool)
}
}
- /* this may look strange but apr_stat() may return errno which
+ /* this may look strange but apr_stat() may return an error which
* is system dependent and there may be transient failures,
* so just blindly retry for a short while
*/
@@ -367,18 +684,9 @@ static int process_dir(char *path, apr_pool_t *pool)
}
if (info.filetype == APR_DIR) {
- /* Make a copy of the basename, as process_dir modifies it */
- orig_basename = apr_pstrdup(pool, d->basename);
- if (process_dir(d->basename, pool)) {
+ if (process_dir(d->basename, pool, nodes)) {
return 1;
}
-
- /* If asked to delete dirs, do so now. We don't care if it fails.
- * If it fails, it likely means there was something else there.
- */
- if (deldirs && !dryrun) {
- apr_dir_remove(orig_basename, pool);
- }
continue;
}
@@ -474,6 +782,11 @@ static int process_dir(char *path, apr_pool_t *pool)
e->hsize = d->hsize;
e->dsize = d->dsize;
e->basename = apr_pstrdup(pool, d->basename);
+ if (!disk_info.has_body) {
+ delete_file(path, apr_pstrcat(p, path, "/",
+ d->basename, CACHE_DATA_SUFFIX, NULL),
+ nodes, p);
+ }
break;
}
else {
@@ -481,13 +794,30 @@ static int process_dir(char *path, apr_pool_t *pool)
}
}
else if (format == VARY_FORMAT_VERSION) {
+ apr_finfo_t finfo;
+
/* This must be a URL that added Vary headers later,
* so kill the orphaned .data file
*/
apr_file_close(fd);
- apr_file_remove(apr_pstrcat(p, path, "/", d->basename,
- CACHE_DATA_SUFFIX, NULL),
- p);
+
+ if (apr_stat(&finfo, apr_pstrcat(p, nextpath,
+ CACHE_VDIR_SUFFIX, NULL), APR_FINFO_TYPE, p)
+ || finfo.filetype != APR_DIR) {
+ delete_entry(path, d->basename, nodes, p);
+ }
+ else {
+ delete_file(path, apr_pstrcat(p, path, "/",
+ d->basename, CACHE_DATA_SUFFIX, NULL),
+ nodes, p);
+ }
+ break;
+ }
+ else {
+ /* We didn't recognise the format, kill the files */
+ apr_file_close(fd);
+ delete_entry(path, d->basename, nodes, p);
+ break;
}
}
else {
@@ -505,7 +835,7 @@ static int process_dir(char *path, apr_pool_t *pool)
current = apr_time_now();
if (realclean || d->htime < current - deviation
|| d->htime > current + deviation) {
- delete_entry(path, d->basename, p);
+ delete_entry(path, d->basename, nodes, p);
unsolicited += d->hsize;
unsolicited += d->dsize;
}
@@ -531,22 +861,63 @@ static int process_dir(char *path, apr_pool_t *pool)
len = sizeof(expires);
- apr_file_read_full(fd, &expires, len, &len);
+ if (apr_file_read_full(fd, &expires, len,
+ &len) == APR_SUCCESS) {
+ apr_finfo_t finfo;
- apr_file_close(fd);
+ apr_file_close(fd);
+
+ if (apr_stat(&finfo, apr_pstrcat(p, nextpath,
+ CACHE_VDIR_SUFFIX, NULL), APR_FINFO_TYPE, p)
+ || finfo.filetype != APR_DIR) {
+ delete_entry(path, d->basename, nodes, p);
+ }
+ else if (expires < current) {
+ delete_entry(path, d->basename, nodes, p);
+ }
+
+ break;
+ }
+ }
+ else if (format == DISK_FORMAT_VERSION) {
+ apr_off_t offset = 0;
+
+ apr_file_seek(fd, APR_SET, &offset);
+
+ len = sizeof(disk_cache_info_t);
- if (expires < current) {
- delete_entry(path, d->basename, p);
+ if (apr_file_read_full(fd, &disk_info, len,
+ &len) == APR_SUCCESS) {
+ apr_file_close(fd);
+ e = apr_palloc(pool, sizeof(ENTRY));
+ APR_RING_INSERT_TAIL(&root, e, _entry, link);
+ e->expire = disk_info.expire;
+ e->response_time = disk_info.response_time;
+ e->htime = d->htime;
+ e->dtime = d->dtime;
+ e->hsize = d->hsize;
+ e->dsize = d->dsize;
+ e->basename = apr_pstrdup(pool, d->basename);
+ break;
+ }
+ else {
+ apr_file_close(fd);
}
+ }
+ else {
+ apr_file_close(fd);
+ delete_entry(path, d->basename, nodes, p);
break;
}
}
- apr_file_close(fd);
+ else {
+ apr_file_close(fd);
+ }
}
if (realclean || d->htime < current - deviation
|| d->htime > current + deviation) {
- delete_entry(path, d->basename, p);
+ delete_entry(path, d->basename, nodes, p);
unsolicited += d->hsize;
}
break;
@@ -555,7 +926,7 @@ static int process_dir(char *path, apr_pool_t *pool)
current = apr_time_now();
if (realclean || d->dtime < current - deviation
|| d->dtime > current + deviation) {
- delete_entry(path, d->basename, p);
+ delete_entry(path, d->basename, nodes, p);
unsolicited += d->dsize;
}
break;
@@ -564,7 +935,7 @@ static int process_dir(char *path, apr_pool_t *pool)
* is asserted above if a tempfile is in the hash array
*/
case TEMP:
- delete_file(path, d->basename, p);
+ delete_file(path, d->basename, nodes, p);
unsolicited += d->dsize;
break;
}
@@ -590,27 +961,35 @@ static int process_dir(char *path, apr_pool_t *pool)
/*
* purge cache entries
*/
-static void purge(char *path, apr_pool_t *pool, apr_off_t max)
+static void purge(char *path, apr_pool_t *pool, apr_off_t max,
+ apr_off_t inodes, apr_off_t nodes, apr_off_t round)
{
- apr_off_t sum, total, entries, etotal;
ENTRY *e, *n, *oldest;
- sum = 0;
- entries = 0;
+ struct stats s;
+ s.sum = 0;
+ s.entries = 0;
+ s.dfuture = 0;
+ s.dexpired = 0;
+ s.dfresh = 0;
+ s.max = max;
+ s.nodes = nodes;
+ s.inodes = inodes;
+ s.ntotal = nodes;
for (e = APR_RING_FIRST(&root);
e != APR_RING_SENTINEL(&root, _entry, link);
e = APR_RING_NEXT(e, link)) {
- sum += e->hsize;
- sum += e->dsize;
- entries++;
+ s.sum += round_up((apr_size_t)e->hsize, round);
+ s.sum += round_up((apr_size_t)e->dsize, round);
+ s.entries++;
}
- total = sum;
- etotal = entries;
+ s.total = s.sum;
+ s.etotal = s.entries;
- if (sum <= max) {
- printstats(total, sum, max, etotal, entries);
+ if ((!s.max || s.sum <= s.max) && (!s.inodes || s.nodes <= s.inodes)) {
+ printstats(path, &s);
return;
}
@@ -622,14 +1001,15 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max)
e != APR_RING_SENTINEL(&root, _entry, link) && !interrupted;) {
n = APR_RING_NEXT(e, link);
if (e->response_time > now || e->htime > now || e->dtime > now) {
- delete_entry(path, e->basename, pool);
- sum -= e->hsize;
- sum -= e->dsize;
- entries--;
+ delete_entry(path, e->basename, &s.nodes, pool);
+ s.sum -= round_up((apr_size_t)e->hsize, round);
+ s.sum -= round_up((apr_size_t)e->dsize, round);
+ s.entries--;
+ s.dfuture++;
APR_RING_REMOVE(e, link);
- if (sum <= max) {
+ if ((!s.max || s.sum <= s.max) && (!s.inodes || s.nodes <= s.inodes)) {
if (!interrupted) {
- printstats(total, sum, max, etotal, entries);
+ printstats(path, &s);
}
return;
}
@@ -646,14 +1026,15 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max)
e != APR_RING_SENTINEL(&root, _entry, link) && !interrupted;) {
n = APR_RING_NEXT(e, link);
if (e->expire != APR_DATE_BAD && e->expire < now) {
- delete_entry(path, e->basename, pool);
- sum -= e->hsize;
- sum -= e->dsize;
- entries--;
+ delete_entry(path, e->basename, &s.nodes, pool);
+ s.sum -= round_up((apr_size_t)e->hsize, round);
+ s.sum -= round_up((apr_size_t)e->dsize, round);
+ s.entries--;
+ s.dexpired++;
APR_RING_REMOVE(e, link);
- if (sum <= max) {
+ if ((!s.max || s.sum <= s.max) && (!s.inodes || s.nodes <= s.inodes)) {
if (!interrupted) {
- printstats(total, sum, max, etotal, entries);
+ printstats(path, &s);
}
return;
}
@@ -670,7 +1051,8 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max)
* corrupt 64bit arithmetics which happend to me once, so better safe
* than sorry
*/
- while (sum > max && !interrupted && !APR_RING_EMPTY(&root, _entry, link)) {
+ while (!((!s.max || s.sum <= s.max) && (!s.inodes || s.nodes <= s.inodes))
+ && !interrupted && !APR_RING_EMPTY(&root, _entry, link)) {
oldest = APR_RING_FIRST(&root);
for (e = APR_RING_NEXT(oldest, link);
@@ -681,18 +1063,212 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max)
}
}
- delete_entry(path, oldest->basename, pool);
- sum -= oldest->hsize;
- sum -= oldest->dsize;
- entries--;
+ delete_entry(path, oldest->basename, &s.nodes, pool);
+ s.sum -= round_up((apr_size_t)oldest->hsize, round);
+ s.sum -= round_up((apr_size_t)oldest->dsize, round);
+ s.entries--;
+ s.dfresh++;
APR_RING_REMOVE(oldest, link);
}
if (!interrupted) {
- printstats(total, sum, max, etotal, entries);
+ printstats(path, &s);
}
}
+static apr_status_t remove_directory(apr_pool_t *pool, const char *dir)
+{
+ apr_status_t rv;
+ apr_dir_t *dirp;
+ apr_finfo_t dirent;
+
+ rv = apr_dir_open(&dirp, dir, pool);
+ if (APR_STATUS_IS_ENOENT(rv)) {
+ return rv;
+ }
+ if (rv != APR_SUCCESS) {
+ char errmsg[120];
+ apr_file_printf(errfile, "Could not open directory %s: %s" APR_EOL_STR,
+ dir, apr_strerror(rv, errmsg, sizeof errmsg));
+ return rv;
+ }
+
+ while (apr_dir_read(&dirent, APR_FINFO_DIRENT | APR_FINFO_TYPE, dirp)
+ == APR_SUCCESS) {
+ if (dirent.filetype == APR_DIR) {
+ if (strcmp(dirent.name, ".") && strcmp(dirent.name, "..")) {
+ rv = remove_directory(pool, apr_pstrcat(pool, dir, "/",
+ dirent.name, NULL));
+ /* tolerate the directory not being empty, the cache may have
+ * attempted to recreate the directory in the mean time.
+ */
+ if (APR_SUCCESS != rv && APR_ENOTEMPTY != rv) {
+ break;
+ }
+ }
+ } else {
+ const char *file = apr_pstrcat(pool, dir, "/", dirent.name, NULL);
+ rv = apr_file_remove(file, pool);
+ if (APR_SUCCESS != rv) {
+ char errmsg[120];
+ apr_file_printf(errfile,
+ "Could not remove file '%s': %s" APR_EOL_STR, file,
+ apr_strerror(rv, errmsg, sizeof errmsg));
+ break;
+ }
+ }
+ }
+
+ apr_dir_close(dirp);
+
+ if (rv == APR_SUCCESS) {
+ rv = apr_dir_remove(dir, pool);
+ if (APR_ENOTEMPTY == rv) {
+ rv = APR_SUCCESS;
+ }
+ if (rv != APR_SUCCESS) {
+ char errmsg[120];
+ apr_file_printf(errfile, "Could not remove directory %s: %s" APR_EOL_STR,
+ dir, apr_strerror(rv, errmsg, sizeof errmsg));
+ }
+ }
+
+ return rv;
+}
+
+static apr_status_t find_directory(apr_pool_t *pool, const char *base,
+ const char *rest)
+{
+ apr_status_t rv;
+ apr_dir_t *dirp;
+ apr_finfo_t dirent;
+ int found = 0, files = 0;
+ const char *header = apr_pstrcat(pool, rest, CACHE_HEADER_SUFFIX, NULL);
+ const char *data = apr_pstrcat(pool, rest, CACHE_DATA_SUFFIX, NULL);
+ const char *vdir = apr_pstrcat(pool, rest, CACHE_HEADER_SUFFIX,
+ CACHE_VDIR_SUFFIX, NULL);
+ const char *dirname = NULL;
+
+ rv = apr_dir_open(&dirp, base, pool);
+ if (rv != APR_SUCCESS) {
+ char errmsg[120];
+ apr_file_printf(errfile, "Could not open directory %s: %s" APR_EOL_STR,
+ base, apr_strerror(rv, errmsg, sizeof errmsg));
+ return rv;
+ }
+
+ rv = APR_ENOENT;
+
+ while (apr_dir_read(&dirent, APR_FINFO_DIRENT | APR_FINFO_TYPE, dirp)
+ == APR_SUCCESS) {
+ int len = strlen(dirent.name);
+ int restlen = strlen(rest);
+ if (dirent.filetype == APR_DIR && !strncmp(rest, dirent.name, len)) {
+ dirname = apr_pstrcat(pool, base, "/", dirent.name, NULL);
+ rv = find_directory(pool, dirname, rest + (len < restlen ? len
+ : restlen));
+ if (APR_SUCCESS == rv) {
+ found = 1;
+ }
+ }
+ if (dirent.filetype == APR_DIR) {
+ if (!strcmp(dirent.name, vdir)) {
+ files = 1;
+ }
+ }
+ if (dirent.filetype == APR_REG) {
+ if (!strcmp(dirent.name, header) || !strcmp(dirent.name, data)) {
+ files = 1;
+ }
+ }
+ }
+
+ apr_dir_close(dirp);
+
+ if (files) {
+ rv = APR_SUCCESS;
+ if (!dryrun) {
+ const char *remove;
+ apr_status_t status;
+
+ remove = apr_pstrcat(pool, base, "/", header, NULL);
+ status = apr_file_remove(remove, pool);
+ if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
+ char errmsg[120];
+ apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR,
+ remove, apr_strerror(status, errmsg, sizeof errmsg));
+ rv = status;
+ }
+
+ remove = apr_pstrcat(pool, base, "/", data, NULL);
+ status = apr_file_remove(remove, pool);
+ if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
+ char errmsg[120];
+ apr_file_printf(errfile, "Could not remove file %s: %s" APR_EOL_STR,
+ remove, apr_strerror(status, errmsg, sizeof errmsg));
+ rv = status;
+ }
+
+ status = remove_directory(pool, apr_pstrcat(pool, base, "/", vdir, NULL));
+ if (status != APR_SUCCESS && !APR_STATUS_IS_ENOENT(status)) {
+ rv = status;
+ }
+ }
+ }
+
+ /* If asked to delete dirs, do so now. We don't care if it fails.
+ * If it fails, it likely means there was something else there.
+ */
+ if (dirname && deldirs && !dryrun) {
+ apr_dir_remove(dirname, pool);
+ }
+
+ if (found) {
+ return APR_SUCCESS;
+ }
+
+ return rv;
+}
+
+/**
+ * Delete a specific URL from the cache.
+ */
+static apr_status_t delete_url(apr_pool_t *pool, const char *proxypath, const char *url)
+{
+ apr_md5_ctx_t context;
+ unsigned char digest[16];
+ char tmp[23];
+ int i, k;
+ unsigned int x;
+ static const char enc_table[64] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@";
+
+ apr_md5_init(&context);
+ apr_md5_update(&context, (const unsigned char *) url, strlen(url));
+ apr_md5_final(digest, &context);
+
+ /* encode 128 bits as 22 characters, using a modified uuencoding
+ * the encoding is 3 bytes -> 4 characters* i.e. 128 bits is
+ * 5 x 3 bytes + 1 byte -> 5 * 4 characters + 2 characters
+ */
+ for (i = 0, k = 0; i < 15; i += 3) {
+ x = (digest[i] << 16) | (digest[i + 1] << 8) | digest[i + 2];
+ tmp[k++] = enc_table[x >> 18];
+ tmp[k++] = enc_table[(x >> 12) & 0x3f];
+ tmp[k++] = enc_table[(x >> 6) & 0x3f];
+ tmp[k++] = enc_table[x & 0x3f];
+ }
+
+ /* one byte left */
+ x = digest[15];
+ tmp[k++] = enc_table[x >> 2]; /* use up 6 bits */
+ tmp[k++] = enc_table[(x << 4) & 0x3f];
+ tmp[k] = 0;
+
+ /* automatically find the directory levels */
+ return find_directory(pool, proxypath, tmp);
+}
+
/*
* usage info
*/
@@ -700,12 +1276,13 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max)
static void usage(const char *error)
{
if (error) {
- apr_file_printf(errfile, "%s error: %s\n", shortname, error);
+ apr_file_printf(errfile, "%s error: %s\n", shortname, error);
}
- apr_file_printf(errfile,
+ apr_file_printf(errfile,
"%s -- program for cleaning the disk cache." NL
- "Usage: %s [-Dvtrn] -pPATH -lLIMIT [-PPIDFILE]" NL
- " %s [-nti] -dINTERVAL -pPATH -lLIMIT [-PPIDFILE]" NL
+ "Usage: %s [-Dvtrn] -pPATH [-lLIMIT|-LLIMIT] [-PPIDFILE]" NL
+ " %s [-nti] -dINTERVAL -pPATH [-lLIMIT|-LLIMIT] [-PPIDFILE]" NL
+ " %s [-Dvt] -pPATH URL ..." NL
NL
"Options:" NL
" -d Daemonize and repeat cache cleaning every INTERVAL minutes." NL
@@ -713,7 +1290,10 @@ static void usage(const char *error)
" options." NL
NL
" -D Do a dry run and don't delete anything. This option is mutually" NL
- " exclusive with the -d option." NL
+ " exclusive with the -d option. When doing a dry run and deleting" NL
+ " directories with -t, the inodes reported deleted in the stats" NL
+ " cannot take into account the directories deleted, and will be" NL
+ " marked as an estimate." NL
NL
" -v Be verbose and print statistics. This option is mutually" NL
" exclusive with the -d option." NL
@@ -733,12 +1313,32 @@ static void usage(const char *error)
NL
" -P Specify PIDFILE as the file to write the pid to." NL
NL
+ " -R Specify amount to round sizes up to." NL
+ NL
" -l Specify LIMIT as the total disk cache size limit. Attach 'K'" NL
" or 'M' to the number for specifying KBytes or MBytes." NL
NL
+ " -L Specify LIMIT as the total disk cache inode limit." NL
+ NL
" -i Be intelligent and run only when there was a modification of" NL
" the disk cache. This option is only possible together with the" NL
- " -d option." NL,
+ " -d option." NL
+ NL
+ " -a List the URLs currently stored in the cache. Variants of the" NL
+ " same URL will be listed once for each variant." NL
+ NL
+ " -A List the URLs currently stored in the cache, along with their" NL
+ " attributes in the following order: url, header size, body size," NL
+ " status, entity version, date, expiry, request time," NL
+ " response time, body present, head request." NL
+ NL
+ "Should an URL be provided on the command line, the URL will be" NL
+ "deleted from the cache. A reverse proxied URL is made up as follows:" NL
+ "http://<hostname>:<port><path>?[query]. So, for the path \"/\" on the" NL
+ "host \"localhost\" and port 80, the URL to delete becomes" NL
+ "\"http://localhost:80/?\". Note the '?' in the URL must always be" NL
+ "specified explicitly, whether a query string is present or not." NL,
+ shortname,
shortname,
shortname,
shortname
@@ -748,6 +1348,12 @@ static void usage(const char *error)
}
#undef NL
+static void usage_repeated_arg(apr_pool_t *pool, char option) {
+ usage(apr_psprintf(pool,
+ "The option '%c' cannot be specified more than once",
+ option));
+}
+
static void log_pid(apr_pool_t *pool, const char *pidfilename, apr_file_t **pidfile)
{
apr_status_t status;
@@ -764,7 +1370,7 @@ static void log_pid(apr_pool_t *pool, const char *pidfilename, apr_file_t **pidf
if (errfile) {
apr_file_printf(errfile,
"Could not write the pid file '%s': %s" APR_EOL_STR,
- pidfilename,
+ pidfilename,
apr_strerror(status, errmsg, sizeof errmsg));
}
exit(1);
@@ -776,14 +1382,14 @@ static void log_pid(apr_pool_t *pool, const char *pidfilename, apr_file_t **pidf
*/
int main(int argc, const char * const argv[])
{
- apr_off_t max;
+ apr_off_t max, inodes, round;
apr_time_t current, repeat, delay, previous;
apr_status_t status;
apr_pool_t *pool, *instance;
apr_getopt_t *o;
apr_finfo_t info;
apr_file_t *pidfile;
- int retries, isdaemon, limit_found, intelligent, dowork;
+ int retries, isdaemon, limit_found, inodes_found, intelligent, dowork;
char opt;
const char *arg;
char *proxypath, *path, *pidfilename;
@@ -794,7 +1400,10 @@ int main(int argc, const char * const argv[])
isdaemon = 0;
dryrun = 0;
limit_found = 0;
+ inodes_found = 0;
max = 0;
+ inodes = 0;
+ round = 0;
verbose = 0;
realclean = 0;
benice = 0;
@@ -818,13 +1427,14 @@ int main(int argc, const char * const argv[])
}
apr_pool_abort_set(oom, pool);
apr_file_open_stderr(&errfile, pool);
+ apr_file_open_stdout(&outfile, pool);
apr_signal(SIGINT, setterm);
apr_signal(SIGTERM, setterm);
apr_getopt_init(&o, pool, argc, argv);
while (1) {
- status = apr_getopt(o, "iDnvrtd:l:L:p:P:", &opt, &arg);
+ status = apr_getopt(o, "iDnvrtd:l:L:p:P:R:aA", &opt, &arg);
if (status == APR_EOF) {
break;
}
@@ -832,45 +1442,47 @@ int main(int argc, const char * const argv[])
usage(NULL);
}
else {
+ char *end;
+ apr_status_t rv;
switch (opt) {
case 'i':
if (intelligent) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
intelligent = 1;
break;
case 'D':
if (dryrun) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
dryrun = 1;
break;
case 'n':
if (benice) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
benice = 1;
break;
case 't':
if (deldirs) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
deldirs = 1;
break;
case 'v':
if (verbose) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
verbose = 1;
break;
case 'r':
if (realclean) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
realclean = 1;
deldirs = 1;
@@ -878,7 +1490,7 @@ int main(int argc, const char * const argv[])
case 'd':
if (isdaemon) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
isdaemon = 1;
repeat = apr_atoi64(arg);
@@ -888,14 +1500,11 @@ int main(int argc, const char * const argv[])
case 'l':
if (limit_found) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
limit_found = 1;
do {
- apr_status_t rv;
- char *end;
-
rv = apr_strtoff(&max, arg, &end, 10);
if (rv == APR_SUCCESS) {
if ((*end == 'K' || *end == 'k') && !end[1]) {
@@ -919,9 +1528,54 @@ int main(int argc, const char * const argv[])
} while(0);
break;
+ case 'L':
+ if (inodes_found) {
+ usage_repeated_arg(pool, opt);
+ }
+ inodes_found = 1;
+
+ do {
+ rv = apr_strtoff(&inodes, arg, &end, 10);
+ if (rv == APR_SUCCESS) {
+ if ((*end == 'K' || *end == 'k') && !end[1]) {
+ inodes *= KBYTE;
+ }
+ else if ((*end == 'M' || *end == 'm') && !end[1]) {
+ inodes *= MBYTE;
+ }
+ else if ((*end == 'G' || *end == 'g') && !end[1]) {
+ inodes *= GBYTE;
+ }
+ else if (*end && /* neither empty nor [Bb] */
+ ((*end != 'B' && *end != 'b') || end[1])) {
+ rv = APR_EGENERAL;
+ }
+ }
+ if (rv != APR_SUCCESS) {
+ usage(apr_psprintf(pool, "Invalid limit: %s"
+ APR_EOL_STR APR_EOL_STR, arg));
+ }
+ } while(0);
+ break;
+
+ case 'a':
+ if (listurls) {
+ usage_repeated_arg(pool, opt);
+ }
+ listurls = 1;
+ break;
+
+ case 'A':
+ if (listurls) {
+ usage_repeated_arg(pool, opt);
+ }
+ listurls = 1;
+ listextended = 1;
+ break;
+
case 'p':
if (proxypath) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
proxypath = apr_pstrdup(pool, arg);
if ((status = apr_filepath_set(proxypath, pool)) != APR_SUCCESS) {
@@ -932,11 +1586,32 @@ int main(int argc, const char * const argv[])
case 'P':
if (pidfilename) {
- usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
+ usage_repeated_arg(pool, opt);
}
pidfilename = apr_pstrdup(pool, arg);
break;
+ case 'R':
+ if (round) {
+ usage_repeated_arg(pool, opt);
+ }
+ rv = apr_strtoff(&round, arg, &end, 10);
+ if (rv == APR_SUCCESS) {
+ if (*end) {
+ usage(apr_psprintf(pool, "Invalid round value: %s"
+ APR_EOL_STR APR_EOL_STR, arg));
+ }
+ else if (round < 0) {
+ usage(apr_psprintf(pool, "Round value must be positive: %s"
+ APR_EOL_STR APR_EOL_STR, arg));
+ }
+ }
+ if (rv != APR_SUCCESS) {
+ usage(apr_psprintf(pool, "Invalid round value: %s"
+ APR_EOL_STR APR_EOL_STR, arg));
+ }
+ break;
+
} /* switch */
} /* else */
} /* while */
@@ -945,16 +1620,51 @@ int main(int argc, const char * const argv[])
usage(NULL);
}
- if (o->ind != argc) {
- usage("Additional parameters specified on the command line, aborting");
+ if (o->ind < argc) {
+ int deleted = 0;
+ int error = 0;
+ if (isdaemon) {
+ usage("Option -d cannot be used with URL arguments, aborting");
+ }
+ if (intelligent) {
+ usage("Option -i cannot be used with URL arguments, aborting");
+ }
+ if (limit_found) {
+ usage("Option -l cannot be used with URL arguments, aborting");
+ }
+ while (o->ind < argc) {
+ status = delete_url(pool, proxypath, argv[o->ind]);
+ if (APR_SUCCESS == status) {
+ if (verbose) {
+ apr_file_printf(errfile, "Removed: %s" APR_EOL_STR,
+ argv[o->ind]);
+ }
+ deleted = 1;
+ }
+ else if (APR_ENOENT == status) {
+ if (verbose) {
+ apr_file_printf(errfile, "Not cached: %s" APR_EOL_STR,
+ argv[o->ind]);
+ }
+ }
+ else {
+ if (verbose) {
+ apr_file_printf(errfile, "Error while removed: %s" APR_EOL_STR,
+ argv[o->ind]);
+ }
+ error = 1;
+ }
+ o->ind++;
+ }
+ return error ? 1 : deleted ? 0 : 2;
}
if (isdaemon && repeat <= 0) {
usage("Option -d must be greater than zero");
}
- if (isdaemon && (verbose || realclean || dryrun)) {
- usage("Option -d cannot be used with -v, -r or -D");
+ if (isdaemon && (verbose || realclean || dryrun || listurls)) {
+ usage("Option -d cannot be used with -v, -r, -L or -D");
}
if (!isdaemon && intelligent) {
@@ -965,8 +1675,8 @@ int main(int argc, const char * const argv[])
usage("Option -p must be specified");
}
- if (max <= 0) {
- usage("Option -l must be greater than zero");
+ if (!listurls && max <= 0 && inodes <= 0) {
+ usage("At least one of option -l or -L must be greater than zero");
}
if (apr_filepath_get(&path, 0, pool) != APR_SUCCESS) {
@@ -981,6 +1691,11 @@ int main(int argc, const char * const argv[])
*/
}
+ if (listurls) {
+ list_urls(path, pool, round);
+ return (interrupted != 0);
+ }
+
#ifndef DEBUG
if (isdaemon) {
apr_file_close(errfile);
@@ -1051,8 +1766,9 @@ int main(int argc, const char * const argv[])
}
if (dowork && !interrupted) {
- if (!process_dir(path, instance) && !interrupted) {
- purge(path, instance, max);
+ apr_off_t nodes = 0;
+ if (!process_dir(path, instance, &nodes) && !interrupted) {
+ purge(path, instance, max, inodes, nodes, round);
}
else if (!isdaemon && !interrupted) {
apr_file_printf(errfile, "An error occurred, cache cleaning "
diff --git a/support/htcacheclean.dep b/support/htcacheclean.dep
deleted file mode 100644
index 5fff887f..00000000
--- a/support/htcacheclean.dep
+++ /dev/null
@@ -1,15 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by htcacheclean.mak
-
-.\htcacheclean.c : \
- "..\modules\cache\mod_disk_cache.h"\
- "..\srclib\apr-util\include\apr_date.h"\
- "..\srclib\apr\include\apr_getopt.h"\
- "..\srclib\apr\include\apr_hash.h"\
- "..\srclib\apr\include\apr_lib.h"\
- "..\srclib\apr\include\apr_signal.h"\
- "..\srclib\apr\include\apr_strings.h"\
-
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
diff --git a/support/htcacheclean.mak b/support/htcacheclean.mak
deleted file mode 100644
index 320fbe97..00000000
--- a/support/htcacheclean.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on htcacheclean.dsp
-!IF "$(CFG)" == ""
-CFG=htcacheclean - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to htcacheclean - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "htcacheclean - Win32 Release" && "$(CFG)" != "htcacheclean - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "htcacheclean.mak" CFG="htcacheclean - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "htcacheclean - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "htcacheclean - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "htcacheclean - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\htcacheclean.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\htcacheclean.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\htcacheclean.obj"
- -@erase "$(INTDIR)\htcacheclean.res"
- -@erase "$(INTDIR)\htcacheclean_src.idb"
- -@erase "$(INTDIR)\htcacheclean_src.pdb"
- -@erase "$(OUTDIR)\htcacheclean.exe"
- -@erase "$(OUTDIR)\htcacheclean.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\htcacheclean_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\htcacheclean.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="htcacheclean.exe" /d LONG_NAME="Apache htcacheclean command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\htcacheclean.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htcacheclean.pdb" /debug /out:"$(OUTDIR)\htcacheclean.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\htcacheclean.obj" \
- "$(INTDIR)\htcacheclean.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\htcacheclean.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\htcacheclean.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\htcacheclean.exe"
- if exist .\Release\htcacheclean.exe.manifest mt.exe -manifest .\Release\htcacheclean.exe.manifest -outputresource:.\Release\htcacheclean.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "htcacheclean - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\htcacheclean.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\htcacheclean.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\htcacheclean.obj"
- -@erase "$(INTDIR)\htcacheclean.res"
- -@erase "$(INTDIR)\htcacheclean_src.idb"
- -@erase "$(INTDIR)\htcacheclean_src.pdb"
- -@erase "$(OUTDIR)\htcacheclean.exe"
- -@erase "$(OUTDIR)\htcacheclean.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\htcacheclean_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\htcacheclean.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="htcacheclean.exe" /d LONG_NAME="Apache htcacheclean command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\htcacheclean.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htcacheclean.pdb" /debug /out:"$(OUTDIR)\htcacheclean.exe"
-LINK32_OBJS= \
- "$(INTDIR)\htcacheclean.obj" \
- "$(INTDIR)\htcacheclean.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\htcacheclean.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\htcacheclean.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\htcacheclean.exe"
- if exist .\Debug\htcacheclean.exe.manifest mt.exe -manifest .\Debug\htcacheclean.exe.manifest -outputresource:.\Debug\htcacheclean.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("htcacheclean.dep")
-!INCLUDE "htcacheclean.dep"
-!ELSE
-!MESSAGE Warning: cannot find "htcacheclean.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "htcacheclean - Win32 Release" || "$(CFG)" == "htcacheclean - Win32 Debug"
-
-!IF "$(CFG)" == "htcacheclean - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "htcacheclean - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "htcacheclean - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "htcacheclean - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=.\htcacheclean.c
-
-"$(INTDIR)\htcacheclean.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "htcacheclean - Win32 Release"
-
-
-"$(INTDIR)\htcacheclean.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\htcacheclean.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="htcacheclean.exe" /d LONG_NAME="Apache htcacheclean command line utility" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "htcacheclean - Win32 Debug"
-
-
-"$(INTDIR)\htcacheclean.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\htcacheclean.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="htcacheclean.exe" /d LONG_NAME="Apache htcacheclean command line utility" $(SOURCE)
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/support/htdbm.c b/support/htdbm.c
index 5e4b8fb0..f9a02bd4 100644
--- a/support/htdbm.c
+++ b/support/htdbm.c
@@ -69,7 +69,7 @@
#define ALG_APMD5 1
#define ALG_APSHA 2
-#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
+#if (!(defined(WIN32) || defined(NETWARE)))
#define ALG_CRYPT 3
#endif
@@ -305,17 +305,17 @@ static apr_status_t htdbm_make(htdbm_t *htdbm)
case ALG_PLAIN:
/* XXX this len limitation is not in sync with any HTTPd len. */
apr_cpystrn(cpw,htdbm->userpass,sizeof(cpw));
-#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
+#if (!(defined(WIN32) || defined(NETWARE)))
fprintf(stderr, "Warning: Plain text passwords aren't supported by the "
"server on this platform!\n");
#endif
break;
-#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
+#if (!(defined(WIN32) || defined(NETWARE)))
case ALG_CRYPT:
(void) srand((int) time((time_t *) NULL));
to64(&salt[0], rand(), 8);
salt[8] = '\0';
- apr_cpystrn(cpw, (char *)crypt(htdbm->userpass, salt), sizeof(cpw) - 1);
+ apr_cpystrn(cpw, crypt(htdbm->userpass, salt), sizeof(cpw) - 1);
fprintf(stderr, "CRYPT is now deprecated, use MD5 instead!\n");
#endif
default:
@@ -341,7 +341,7 @@ static apr_status_t htdbm_valid_username(htdbm_t *htdbm)
static void htdbm_usage(void)
{
-#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
+#if (!(defined(WIN32) || defined(NETWARE)))
#define CRYPT_OPTION "d"
#else
#define CRYPT_OPTION ""
@@ -361,7 +361,7 @@ static void htdbm_usage(void)
fprintf(stderr, " -c Create a new database.\n");
fprintf(stderr, " -n Don't update database; display results on stdout.\n");
fprintf(stderr, " -m Force MD5 encryption of the password (default).\n");
-#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
+#if (!(defined(WIN32) || defined(NETWARE)))
fprintf(stderr, " -d Force CRYPT encryption of the password (now deprecated).\n");
#endif
fprintf(stderr, " -p Do not encrypt the password (plaintext).\n");
@@ -468,7 +468,7 @@ int main(int argc, const char * const argv[])
case 's':
h->alg = ALG_APSHA;
break;
-#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
+#if (!(defined(WIN32) || defined(NETWARE)))
case 'd':
h->alg = ALG_CRYPT;
break;
@@ -532,7 +532,7 @@ int main(int argc, const char * const argv[])
switch (cmd) {
case HTDBM_VERIFY:
if ((rv = htdbm_verify(h)) != APR_SUCCESS) {
- if(rv == APR_ENOENT) {
+ if (APR_STATUS_IS_ENOENT(rv)) {
fprintf(stderr, "The user '%s' could not be found in database\n", h->username);
exit(ERR_BADUSER);
}
diff --git a/support/htdbm.dep b/support/htdbm.dep
deleted file mode 100644
index 341f447e..00000000
--- a/support/htdbm.dep
+++ /dev/null
@@ -1,14 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by htdbm.mak
-
-.\htdbm.c : \
- "..\srclib\apr-util\include\apr_dbm.h"\
- "..\srclib\apr-util\include\apr_md5.h"\
- "..\srclib\apr-util\include\apr_sha1.h"\
- "..\srclib\apr\include\apr_lib.h"\
- "..\srclib\apr\include\apr_signal.h"\
- "..\srclib\apr\include\apr_strings.h"\
-
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
diff --git a/support/htdbm.mak b/support/htdbm.mak
deleted file mode 100644
index 5c8c2124..00000000
--- a/support/htdbm.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on htdbm.dsp
-!IF "$(CFG)" == ""
-CFG=htdbm - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to htdbm - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "htdbm - Win32 Release" && "$(CFG)" != "htdbm - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "htdbm.mak" CFG="htdbm - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "htdbm - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "htdbm - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "htdbm - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\htdbm.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\htdbm.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\htdbm.obj"
- -@erase "$(INTDIR)\htdbm.res"
- -@erase "$(INTDIR)\htdbm_src.idb"
- -@erase "$(INTDIR)\htdbm_src.pdb"
- -@erase "$(OUTDIR)\htdbm.exe"
- -@erase "$(OUTDIR)\htdbm.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\htdbm_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\htdbm.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="htdbm.exe" /d LONG_NAME="Apache htdbm command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\htdbm.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htdbm.pdb" /debug /out:"$(OUTDIR)\htdbm.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\htdbm.obj" \
- "$(INTDIR)\htdbm.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\htdbm.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\htdbm.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\htdbm.exe"
- if exist .\Release\htdbm.exe.manifest mt.exe -manifest .\Release\htdbm.exe.manifest -outputresource:.\Release\htdbm.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "htdbm - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\htdbm.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\htdbm.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\htdbm.obj"
- -@erase "$(INTDIR)\htdbm.res"
- -@erase "$(INTDIR)\htdbm_src.idb"
- -@erase "$(INTDIR)\htdbm_src.pdb"
- -@erase "$(OUTDIR)\htdbm.exe"
- -@erase "$(OUTDIR)\htdbm.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\htdbm_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\htdbm.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="htdbm.exe" /d LONG_NAME="Apache htdbm command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\htdbm.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htdbm.pdb" /debug /out:"$(OUTDIR)\htdbm.exe"
-LINK32_OBJS= \
- "$(INTDIR)\htdbm.obj" \
- "$(INTDIR)\htdbm.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\htdbm.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\htdbm.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\htdbm.exe"
- if exist .\Debug\htdbm.exe.manifest mt.exe -manifest .\Debug\htdbm.exe.manifest -outputresource:.\Debug\htdbm.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("htdbm.dep")
-!INCLUDE "htdbm.dep"
-!ELSE
-!MESSAGE Warning: cannot find "htdbm.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "htdbm - Win32 Release" || "$(CFG)" == "htdbm - Win32 Debug"
-
-!IF "$(CFG)" == "htdbm - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "htdbm - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "htdbm - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "htdbm - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=.\htdbm.c
-
-"$(INTDIR)\htdbm.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "htdbm - Win32 Release"
-
-
-"$(INTDIR)\htdbm.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\htdbm.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="htdbm.exe" /d LONG_NAME="Apache htdbm command line utility" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "htdbm - Win32 Debug"
-
-
-"$(INTDIR)\htdbm.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\htdbm.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="htdbm.exe" /d LONG_NAME="Apache htdbm command line utility" $(SOURCE)
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/support/htdigest.dep b/support/htdigest.dep
deleted file mode 100644
index f022095c..00000000
--- a/support/htdigest.dep
+++ /dev/null
@@ -1,12 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by htdigest.mak
-
-.\htdigest.c : \
- "..\srclib\apr-util\include\apr_md5.h"\
- "..\srclib\apr\include\apr_lib.h"\
- "..\srclib\apr\include\apr_signal.h"\
- "..\srclib\apr\include\apr_strings.h"\
-
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
diff --git a/support/htdigest.mak b/support/htdigest.mak
deleted file mode 100644
index 01881d8c..00000000
--- a/support/htdigest.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on htdigest.dsp
-!IF "$(CFG)" == ""
-CFG=htdigest - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to htdigest - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "htdigest - Win32 Release" && "$(CFG)" != "htdigest - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "htdigest.mak" CFG="htdigest - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "htdigest - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "htdigest - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "htdigest - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\htdigest.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\htdigest.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\htdigest.obj"
- -@erase "$(INTDIR)\htdigest.res"
- -@erase "$(INTDIR)\htdigest_src.idb"
- -@erase "$(INTDIR)\htdigest_src.pdb"
- -@erase "$(OUTDIR)\htdigest.exe"
- -@erase "$(OUTDIR)\htdigest.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\htdigest_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\htdigest.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="htdigest.exe" /d LONG_NAME="Apache htdigest command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\htdigest.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htdigest.pdb" /debug /out:"$(OUTDIR)\htdigest.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\htdigest.obj" \
- "$(INTDIR)\htdigest.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\htdigest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\htdigest.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\htdigest.exe"
- if exist .\Release\htdigest.exe.manifest mt.exe -manifest .\Release\htdigest.exe.manifest -outputresource:.\Release\htdigest.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "htdigest - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\htdigest.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\htdigest.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\htdigest.obj"
- -@erase "$(INTDIR)\htdigest.res"
- -@erase "$(INTDIR)\htdigest_src.idb"
- -@erase "$(INTDIR)\htdigest_src.pdb"
- -@erase "$(OUTDIR)\htdigest.exe"
- -@erase "$(OUTDIR)\htdigest.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\htdigest_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\htdigest.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="htdigest.exe" /d LONG_NAME="Apache htdigest command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\htdigest.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htdigest.pdb" /debug /out:"$(OUTDIR)\htdigest.exe"
-LINK32_OBJS= \
- "$(INTDIR)\htdigest.obj" \
- "$(INTDIR)\htdigest.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\htdigest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\htdigest.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\htdigest.exe"
- if exist .\Debug\htdigest.exe.manifest mt.exe -manifest .\Debug\htdigest.exe.manifest -outputresource:.\Debug\htdigest.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("htdigest.dep")
-!INCLUDE "htdigest.dep"
-!ELSE
-!MESSAGE Warning: cannot find "htdigest.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "htdigest - Win32 Release" || "$(CFG)" == "htdigest - Win32 Debug"
-
-!IF "$(CFG)" == "htdigest - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "htdigest - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "htdigest - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "htdigest - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=.\htdigest.c
-
-"$(INTDIR)\htdigest.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "htdigest - Win32 Release"
-
-
-"$(INTDIR)\htdigest.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\htdigest.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="htdigest.exe" /d LONG_NAME="Apache htdigest command line utility" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "htdigest - Win32 Debug"
-
-
-"$(INTDIR)\htdigest.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\htdigest.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="htdigest.exe" /d LONG_NAME="Apache htdigest command line utility" $(SOURCE)
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/support/htpasswd.c b/support/htpasswd.c
index 3aa9e184..f67076ff 100644
--- a/support/htpasswd.c
+++ b/support/htpasswd.c
@@ -104,6 +104,13 @@ apr_file_t *ftemp = NULL;
#define NL APR_EOL_STR
+#if defined(WIN32) || defined(NETWARE)
+#define CRYPT_ALGO_SUPPORTED 0
+#else
+#define CRYPT_ALGO_SUPPORTED 1
+#endif
+
+#if CRYPT_ALGO_SUPPORTED
static void to64(char *s, unsigned long v, int n)
{
static unsigned char itoa64[] = /* 0 ... 63 => ASCII - 64 */
@@ -114,10 +121,11 @@ static void to64(char *s, unsigned long v, int n)
v >>= 6;
}
}
+#endif
static void generate_salt(char *s, size_t size)
{
- static unsigned char tbl[] =
+ static unsigned char tbl[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
size_t i;
for (i = 0; i < size; ++i) {
@@ -209,7 +217,7 @@ static int mkrecord(char *user, char *record, apr_size_t rlen, char *passwd,
apr_cpystrn(cpw,pw,sizeof(cpw));
break;
-#if (!(defined(WIN32) || defined(NETWARE)))
+#if CRYPT_ALGO_SUPPORTED
case ALG_CRYPT:
default:
if (seed_rand()) {
@@ -229,7 +237,7 @@ static int mkrecord(char *user, char *record, apr_size_t rlen, char *passwd,
free(truncpw);
}
break;
-#endif
+#endif /* CRYPT_ALGO_SUPPORTED */
}
memset(pw, '\0', strlen(pw));
@@ -270,7 +278,7 @@ static void usage(void)
"rather than prompting for it." NL);
apr_file_printf(errfile, " -D Delete the specified user." NL);
apr_file_printf(errfile,
- "On other systems than Windows, NetWare and TPF the '-p' flag will "
+ "On other systems than Windows and NetWare the '-p' flag will "
"probably not work." NL);
apr_file_printf(errfile,
"The SHA algorithm does not use a salt and is less secure than "
@@ -476,14 +484,14 @@ int main(int argc, const char * const argv[])
check_args(pool, argc, argv, &alg, &mask, &user, &pwfilename, &password);
-#if defined(WIN32) || defined(NETWARE)
+#if !CRYPT_ALGO_SUPPORTED
if (alg == ALG_CRYPT) {
alg = ALG_APMD5;
apr_file_printf(errfile, "Automatically using MD5 format." NL);
}
#endif
-#if (!(defined(WIN32) || defined(TPF) || defined(NETWARE)))
+#if CRYPT_ALGO_SUPPORTED
if (alg == ALG_PLAIN) {
apr_file_printf(errfile,"Warning: storing passwords as plain text "
"might just not work on this platform." NL);
diff --git a/support/htpasswd.dep b/support/htpasswd.dep
deleted file mode 100644
index 9f328fc3..00000000
--- a/support/htpasswd.dep
+++ /dev/null
@@ -1,13 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by htpasswd.mak
-
-.\htpasswd.c : \
- "..\srclib\apr-util\include\apr_md5.h"\
- "..\srclib\apr-util\include\apr_sha1.h"\
- "..\srclib\apr\include\apr_lib.h"\
- "..\srclib\apr\include\apr_signal.h"\
- "..\srclib\apr\include\apr_strings.h"\
-
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
diff --git a/support/htpasswd.mak b/support/htpasswd.mak
deleted file mode 100644
index 5ec00756..00000000
--- a/support/htpasswd.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on htpasswd.dsp
-!IF "$(CFG)" == ""
-CFG=htpasswd - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to htpasswd - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "htpasswd - Win32 Release" && "$(CFG)" != "htpasswd - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "htpasswd.mak" CFG="htpasswd - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "htpasswd - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "htpasswd - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "htpasswd - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\htpasswd.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\htpasswd.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\htpasswd.obj"
- -@erase "$(INTDIR)\htpasswd.res"
- -@erase "$(INTDIR)\htpasswd_src.idb"
- -@erase "$(INTDIR)\htpasswd_src.pdb"
- -@erase "$(OUTDIR)\htpasswd.exe"
- -@erase "$(OUTDIR)\htpasswd.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\htpasswd_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\htpasswd.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="htpasswd.exe" /d LONG_NAME="Apache htpasswd command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\htpasswd.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib rpcrt4.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htpasswd.pdb" /debug /out:"$(OUTDIR)\htpasswd.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\htpasswd.obj" \
- "$(INTDIR)\htpasswd.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\htpasswd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\htpasswd.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\htpasswd.exe"
- if exist .\Release\htpasswd.exe.manifest mt.exe -manifest .\Release\htpasswd.exe.manifest -outputresource:.\Release\htpasswd.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\htpasswd.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\htpasswd.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\htpasswd.obj"
- -@erase "$(INTDIR)\htpasswd.res"
- -@erase "$(INTDIR)\htpasswd_src.idb"
- -@erase "$(INTDIR)\htpasswd_src.pdb"
- -@erase "$(OUTDIR)\htpasswd.exe"
- -@erase "$(OUTDIR)\htpasswd.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\htpasswd_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\htpasswd.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="htpasswd.exe" /d LONG_NAME="Apache htpasswd command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\htpasswd.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib rpcrt4.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htpasswd.pdb" /debug /out:"$(OUTDIR)\htpasswd.exe"
-LINK32_OBJS= \
- "$(INTDIR)\htpasswd.obj" \
- "$(INTDIR)\htpasswd.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\htpasswd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\htpasswd.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\htpasswd.exe"
- if exist .\Debug\htpasswd.exe.manifest mt.exe -manifest .\Debug\htpasswd.exe.manifest -outputresource:.\Debug\htpasswd.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("htpasswd.dep")
-!INCLUDE "htpasswd.dep"
-!ELSE
-!MESSAGE Warning: cannot find "htpasswd.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "htpasswd - Win32 Release" || "$(CFG)" == "htpasswd - Win32 Debug"
-
-!IF "$(CFG)" == "htpasswd - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "htpasswd - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=.\htpasswd.c
-
-"$(INTDIR)\htpasswd.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "htpasswd - Win32 Release"
-
-
-"$(INTDIR)\htpasswd.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\htpasswd.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="htpasswd.exe" /d LONG_NAME="Apache htpasswd command line utility" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug"
-
-
-"$(INTDIR)\htpasswd.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\htpasswd.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="htpasswd.exe" /d LONG_NAME="Apache htpasswd command line utility" $(SOURCE)
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/support/httxt2dbm.c b/support/httxt2dbm.c
index efe493af..8792f944 100644
--- a/support/httxt2dbm.c
+++ b/support/httxt2dbm.c
@@ -178,7 +178,7 @@ int main(int argc, const char *const argv[])
apr_pool_t *pool;
apr_status_t rv = APR_SUCCESS;
apr_getopt_t *opt;
- const char *optarg;
+ const char *opt_arg;
char ch;
apr_file_t *infile;
apr_dbm_t *outdbm;
@@ -213,7 +213,7 @@ int main(int argc, const char *const argv[])
return 1;
}
- while ((rv = apr_getopt(opt, "vf::i::o::", &ch, &optarg)) == APR_SUCCESS) {
+ while ((rv = apr_getopt(opt, "vf::i::o::", &ch, &opt_arg)) == APR_SUCCESS) {
switch (ch) {
case 'v':
if (verbose) {
@@ -229,7 +229,7 @@ int main(int argc, const char *const argv[])
usage();
return 1;
}
- format = apr_pstrdup(pool, optarg);
+ format = apr_pstrdup(pool, opt_arg);
break;
case 'i':
if (input) {
@@ -237,7 +237,7 @@ int main(int argc, const char *const argv[])
usage();
return 1;
}
- input = apr_pstrdup(pool, optarg);
+ input = apr_pstrdup(pool, opt_arg);
break;
case 'o':
if (output) {
@@ -245,7 +245,7 @@ int main(int argc, const char *const argv[])
usage();
return 1;
}
- output = apr_pstrdup(pool, optarg);
+ output = apr_pstrdup(pool, opt_arg);
break;
}
}
diff --git a/support/httxt2dbm.dep b/support/httxt2dbm.dep
deleted file mode 100644
index 5bfcfdf8..00000000
--- a/support/httxt2dbm.dep
+++ /dev/null
@@ -1,12 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by httxt2dbm.mak
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
-
-.\httxt2dbm.c : \
- "..\srclib\apr-util\include\apr_dbm.h"\
- "..\srclib\apr\include\apr_getopt.h"\
- "..\srclib\apr\include\apr_lib.h"\
- "..\srclib\apr\include\apr_strings.h"\
-
diff --git a/support/httxt2dbm.mak b/support/httxt2dbm.mak
deleted file mode 100644
index 239619d2..00000000
--- a/support/httxt2dbm.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on httxt2dbm.dsp
-!IF "$(CFG)" == ""
-CFG=httxt2dbm - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to httxt2dbm - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "httxt2dbm - Win32 Release" && "$(CFG)" != "httxt2dbm - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "httxt2dbm.mak" CFG="httxt2dbm - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "httxt2dbm - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "httxt2dbm - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "httxt2dbm - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\httxt2dbm.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\httxt2dbm.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\httxt2dbm.obj"
- -@erase "$(INTDIR)\httxt2dbm.res"
- -@erase "$(INTDIR)\httxt2dbm_src.idb"
- -@erase "$(INTDIR)\httxt2dbm_src.pdb"
- -@erase "$(OUTDIR)\httxt2dbm.exe"
- -@erase "$(OUTDIR)\httxt2dbm.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\httxt2dbm_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\httxt2dbm.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="httxt2dbm.exe" /d LONG_NAME="Apache httxt2dbm command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\httxt2dbm.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\httxt2dbm.pdb" /debug /out:"$(OUTDIR)\httxt2dbm.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\httxt2dbm.obj" \
- "$(INTDIR)\httxt2dbm.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\httxt2dbm.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\httxt2dbm.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\httxt2dbm.exe"
- if exist .\Release\httxt2dbm.exe.manifest mt.exe -manifest .\Release\httxt2dbm.exe.manifest -outputresource:.\Release\httxt2dbm.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "httxt2dbm - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\httxt2dbm.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\httxt2dbm.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\httxt2dbm.obj"
- -@erase "$(INTDIR)\httxt2dbm.res"
- -@erase "$(INTDIR)\httxt2dbm_src.idb"
- -@erase "$(INTDIR)\httxt2dbm_src.pdb"
- -@erase "$(OUTDIR)\httxt2dbm.exe"
- -@erase "$(OUTDIR)\httxt2dbm.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\httxt2dbm_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\httxt2dbm.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="httxt2dbm.exe" /d LONG_NAME="Apache httxt2dbm command line utility"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\httxt2dbm.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\httxt2dbm.pdb" /debug /out:"$(OUTDIR)\httxt2dbm.exe"
-LINK32_OBJS= \
- "$(INTDIR)\httxt2dbm.obj" \
- "$(INTDIR)\httxt2dbm.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\httxt2dbm.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\httxt2dbm.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\httxt2dbm.exe"
- if exist .\Debug\httxt2dbm.exe.manifest mt.exe -manifest .\Debug\httxt2dbm.exe.manifest -outputresource:.\Debug\httxt2dbm.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("httxt2dbm.dep")
-!INCLUDE "httxt2dbm.dep"
-!ELSE
-!MESSAGE Warning: cannot find "httxt2dbm.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "httxt2dbm - Win32 Release" || "$(CFG)" == "httxt2dbm - Win32 Debug"
-
-!IF "$(CFG)" == "httxt2dbm - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "httxt2dbm - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "httxt2dbm - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "httxt2dbm - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "httxt2dbm - Win32 Release"
-
-
-"$(INTDIR)\httxt2dbm.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\httxt2dbm.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="httxt2dbm.exe" /d LONG_NAME="Apache httxt2dbm command line utility" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "httxt2dbm - Win32 Debug"
-
-
-"$(INTDIR)\httxt2dbm.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\httxt2dbm.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="httxt2dbm.exe" /d LONG_NAME="Apache httxt2dbm command line utility" $(SOURCE)
-
-
-!ENDIF
-
-SOURCE=.\httxt2dbm.c
-
-"$(INTDIR)\httxt2dbm.obj" : $(SOURCE) "$(INTDIR)"
-
-
-
-!ENDIF
-
diff --git a/support/logresolve.c b/support/logresolve.c
index 1a36a18f..b0ba6ec1 100644
--- a/support/logresolve.c
+++ b/support/logresolve.c
@@ -15,12 +15,13 @@
*/
/*
- * logresolve 1.1
+ * logresolve 2.0
*
* Tom Rathborne - tomr uunet.ca - http://www.uunet.ca/~tomr/
* UUNET Canada, April 16, 1995
*
* Rewritten by David Robinson. (drtr ast.cam.ac.uk)
+ * Rewritten again, and ported to APR by Colm MacCarthaigh
*
* Usage: logresolve [-s filename] [-c] < access_log > new_log
*
@@ -28,7 +29,7 @@
* -s filename name of a file to record statistics
* -c check the DNS for a matching A record for the host.
*
- * Notes:
+ * Notes: (For historical interest)
*
* To generate meaningful statistics from an HTTPD log file, it's good
* to have the domain name of each machine that accessed your site, but
@@ -55,333 +56,274 @@
* that one of these matches the original address.
*/
+#include "apr.h"
#include "apr_lib.h"
-#if APR_HAVE_STDIO_H
-#include <stdio.h>
-#endif
+#include "apr_hash.h"
+#include "apr_getopt.h"
+#include "apr_strings.h"
+#include "apr_file_io.h"
+#include "apr_network_io.h"
+
#if APR_HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#if APR_HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-#if APR_HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#if APR_HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#if APR_HAVE_STRING_H
-#include <string.h>
-#endif
-#if APR_HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if APR_HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-static void cgethost(struct in_addr ipnum, char *string, int check);
-static int get_line(char *s, int n);
-static void stats(FILE *output);
-
-#ifdef BEOS
-#define NO_ADDRESS NO_DATA
-#endif
-
-
-/* maximum line length */
-#ifndef MAXLINE
-#define MAXLINE 1024
-#endif
-
-/* maximum length of a domain name */
-#ifndef MAXDNAME
-#define MAXDNAME 256
-#endif
-
-/* number of buckets in cache hash apr_table_t */
-#define BUCKETS 256
-
-/*
- * struct nsrec - record of nameservice for cache linked list
- *
- * ipnum - IP number hostname - hostname noname - nonzero if IP number has no
- * hostname, i.e. hostname=IP number
- */
-
-struct nsrec {
- struct in_addr ipnum;
- char *hostname;
- int noname;
- struct nsrec *next;
-} *nscache[BUCKETS];
-
-/*
- * statistics - obvious
- */
-
-#ifndef h_errno
-#ifdef __CYGWIN__
-extern __declspec(dllimport) int h_errno;
-#else
-extern int h_errno; /* some machines don't have this in their headers */
-#endif
-#endif
-/* largest value for h_errno */
+#define READ_BUF_SIZE 128*1024
+#define WRITE_BUF_SIZE 128*1024
+#define LINE_BUF_SIZE 128*1024
-#define MAX_ERR (NO_ADDRESS)
-#define UNKNOWN_ERR (MAX_ERR+1)
-#define NO_REVERSE (MAX_ERR+2)
+static apr_file_t *errfile;
+static const char *shortname = "logresolve";
+static apr_hash_t *cache;
+/* Statistics */
static int cachehits = 0;
static int cachesize = 0;
static int entries = 0;
static int resolves = 0;
static int withname = 0;
-static int errors[MAX_ERR + 3];
+static int doublefailed = 0;
+static int noreverse = 0;
/*
- * cgethost - gets hostname by IP address, caching, and adding unresolvable
- * IP numbers with their IP number as hostname, setting noname flag
+ * prints various statistics to output
*/
+#define NL APR_EOL_STR
+static void print_statistics (apr_file_t *output)
+{
+ apr_file_printf(output, "logresolve Statistics:" NL);
+ apr_file_printf(output, "Entries: %d" NL, entries);
+ apr_file_printf(output, " With name : %d" NL, withname);
+ apr_file_printf(output, " Resolves : %d" NL, resolves);
+
+ if (noreverse) {
+ apr_file_printf(output, " - No reverse : %d" NL,
+ noreverse);
+ }
+
+ if (doublefailed) {
+ apr_file_printf(output, " - Double lookup failed : %d" NL,
+ doublefailed);
+ }
-static void cgethost (struct in_addr ipnum, char *string, int check)
+ apr_file_printf(output, "Cache hits : %d" NL, cachehits);
+ apr_file_printf(output, "Cache size : %d" NL, cachesize);
+}
+
+/*
+ * usage info
+ */
+static void usage(void)
{
- struct nsrec **current, *new;
- struct hostent *hostdata;
- char *name;
+ apr_file_printf(errfile,
+ "%s -- Resolve IP-addresses to hostnames in Apache log files." NL
+ "Usage: %s [-s STATFILE] [-c]" NL
+ NL
+ "Options:" NL
+ " -s Record statistics to STATFILE when finished." NL
+ NL
+ " -c Perform double lookups when resolving IP addresses." NL,
+ shortname, shortname);
+ exit(1);
+}
+#undef NL
- current = &nscache[((ipnum.s_addr + (ipnum.s_addr >> 8) +
- (ipnum.s_addr >> 16) + (ipnum.s_addr >> 24)) % BUCKETS)];
+int main(int argc, const char * const argv[])
+{
+ apr_file_t * outfile;
+ apr_file_t * infile;
+ apr_getopt_t * o;
+ apr_pool_t * pool;
+ apr_pool_t *pline;
+ apr_status_t status;
+ const char * arg;
+ char * stats = NULL;
+ char * inbuffer;
+ char * outbuffer;
+ char * line;
+ int doublelookups = 0;
+
+ if (apr_app_initialize(&argc, &argv, NULL) != APR_SUCCESS) {
+ return 1;
+ }
+ atexit(apr_terminate);
- while (*current != NULL && ipnum.s_addr != (*current)->ipnum.s_addr)
- current = &(*current)->next;
+ if (argc) {
+ shortname = apr_filepath_name_get(argv[0]);
+ }
- if (*current == NULL) {
- cachesize++;
- new = (struct nsrec *) malloc(sizeof(struct nsrec));
- if (new == NULL) {
- perror("malloc");
- fprintf(stderr, "Insufficient memory\n");
- exit(1);
+ if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
+ return 1;
+ }
+ apr_file_open_stderr(&errfile, pool);
+ apr_getopt_init(&o, pool, argc, argv);
+
+ while (1) {
+ char opt;
+ status = apr_getopt(o, "s:c", &opt, &arg);
+ if (status == APR_EOF) {
+ break;
}
- *current = new;
- new->next = NULL;
-
- new->ipnum = ipnum;
-
- hostdata = gethostbyaddr((const char *) &ipnum, sizeof(struct in_addr),
- AF_INET);
- if (hostdata == NULL) {
- if (h_errno > MAX_ERR)
- errors[UNKNOWN_ERR]++;
- else
- errors[h_errno]++;
- new->noname = h_errno;
- name = strdup(inet_ntoa(ipnum));
+ else if (status != APR_SUCCESS) {
+ usage();
}
else {
- new->noname = 0;
- name = strdup(hostdata->h_name);
- if (check) {
- if (name == NULL) {
- perror("strdup");
- fprintf(stderr, "Insufficient memory\n");
- exit(1);
- }
- hostdata = gethostbyname(name);
- if (hostdata != NULL) {
- char **hptr;
-
- for (hptr = hostdata->h_addr_list; *hptr != NULL; hptr++)
- if (((struct in_addr *) (*hptr))->s_addr == ipnum.s_addr)
- break;
- if (*hptr == NULL)
- hostdata = NULL;
+ switch (opt) {
+ case 'c':
+ if (doublelookups) {
+ usage();
}
- if (hostdata == NULL) {
- fprintf(stderr, "Bad host: %s != %s\n", name,
- inet_ntoa(ipnum));
- new->noname = NO_REVERSE;
- free(name);
- name = strdup(inet_ntoa(ipnum));
- errors[NO_REVERSE]++;
+ doublelookups = 1;
+ break;
+ case 's':
+ if (stats) {
+ usage();
}
- }
- }
- new->hostname = name;
- if (new->hostname == NULL) {
- perror("strdup");
- fprintf(stderr, "Insufficient memory\n");
- exit(1);
- }
+ stats = apr_pstrdup(pool, arg);
+ break;
+ } /* switch */
+ } /* else */
+ } /* while */
+
+ apr_file_open_stdout(&outfile, pool);
+ apr_file_open_stdin(&infile, pool);
+
+ /* Allocate two new 10k file buffers */
+ if ( (outbuffer = apr_palloc(pool, WRITE_BUF_SIZE)) == NULL
+ || (inbuffer = apr_palloc(pool, READ_BUF_SIZE)) == NULL
+ || (line = apr_palloc(pool, LINE_BUF_SIZE)) == NULL) {
+ return 1;
}
- else
- cachehits++;
- /* size of string == MAXDNAME +1 */
- strncpy(string, (*current)->hostname, MAXDNAME);
- string[MAXDNAME] = '\0';
-}
+ /* Set the buffers */
+ apr_file_buffer_set(infile, inbuffer, READ_BUF_SIZE);
+ apr_file_buffer_set(outfile, outbuffer, WRITE_BUF_SIZE);
-/*
- * prints various statistics to output
- */
-
-static void stats (FILE *output)
-{
- int i;
- char *ipstring;
- struct nsrec *current;
- char *errstring[MAX_ERR + 3];
-
- for (i = 0; i < MAX_ERR + 3; i++)
- errstring[i] = "Unknown error";
- errstring[HOST_NOT_FOUND] = "Host not found";
- errstring[TRY_AGAIN] = "Try again";
- errstring[NO_RECOVERY] = "Non recoverable error";
- errstring[NO_DATA] = "No data record";
- errstring[NO_ADDRESS] = "No address";
- errstring[NO_REVERSE] = "No reverse entry";
-
- fprintf(output, "logresolve Statistics:\n");
-
- fprintf(output, "Entries: %d\n", entries);
- fprintf(output, " With name : %d\n", withname);
- fprintf(output, " Resolves : %d\n", resolves);
- if (errors[HOST_NOT_FOUND])
- fprintf(output, " - Not found : %d\n", errors[HOST_NOT_FOUND]);
- if (errors[TRY_AGAIN])
- fprintf(output, " - Try again : %d\n", errors[TRY_AGAIN]);
- if (errors[NO_DATA])
- fprintf(output, " - No data : %d\n", errors[NO_DATA]);
- if (errors[NO_ADDRESS])
- fprintf(output, " - No address: %d\n", errors[NO_ADDRESS]);
- if (errors[NO_REVERSE])
- fprintf(output, " - No reverse: %d\n", errors[NO_REVERSE]);
- fprintf(output, "Cache hits : %d\n", cachehits);
- fprintf(output, "Cache size : %d\n", cachesize);
- fprintf(output, "Cache buckets : IP number * hostname\n");
-
- for (i = 0; i < BUCKETS; i++)
- for (current = nscache[i]; current != NULL; current = current->next) {
- ipstring = inet_ntoa(current->ipnum);
- if (current->noname == 0)
- fprintf(output, " %3d %15s - %s\n", i, ipstring,
- current->hostname);
- else {
- if (current->noname > MAX_ERR + 2)
- fprintf(output, " %3d %15s : Unknown error\n", i,
- ipstring);
- else
- fprintf(output, " %3d %15s : %s\n", i, ipstring,
- errstring[current->noname]);
- }
- }
-}
+ cache = apr_hash_make(pool);
+ if(apr_pool_create(&pline, pool) != APR_SUCCESS){
+ return 1;
+ }
+ while (apr_file_gets(line, LINE_BUF_SIZE, infile) == APR_SUCCESS) {
+ char *hostname;
+ char *space;
+ apr_sockaddr_t *ip;
+ apr_sockaddr_t *ipdouble;
+ char dummy[] = " " APR_EOL_STR;
-/*
- * gets a line from stdin
- */
+ if (line[0] == '\0') {
+ continue;
+ }
-static int get_line (char *s, int n)
-{
- char *cp;
-
- if (!fgets(s, n, stdin))
- return (0);
- cp = strchr(s, '\n');
- if (cp)
- *cp = '\0';
- return (1);
-}
+ /* Count our log entries */
+ entries++;
-int main (int argc, char *argv[])
-{
- struct in_addr ipnum;
- char *bar, hoststring[MAXDNAME + 1], line[MAXLINE], *statfile;
- int i, check;
-
-#if defined(WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
- /* If we apr'ify this code, apr_pool_create/apr_pool_destroy
- * should perform the WSAStartup/WSACleanup for us.
- */
- WSADATA wsaData;
- WSAStartup(MAKEWORD(2, 0), &wsaData);
-#endif
+ /* Check if this could even be an IP address */
+ if (!apr_isxdigit(line[0]) && line[0] != ':') {
+ withname++;
+ apr_file_puts(line, outfile);
+ continue;
+ }
- check = 0;
- statfile = NULL;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-c") == 0)
- check = 1;
- else if (strcmp(argv[i], "-s") == 0) {
- if (i == argc - 1) {
- fprintf(stderr, "logresolve: missing filename to -s\n");
- exit(1);
- }
- i++;
- statfile = argv[i];
+ /* Terminate the line at the next space */
+ if ((space = strchr(line, ' ')) != NULL) {
+ *space = '\0';
}
else {
- fprintf(stderr, "Usage: logresolve [-s statfile] [-c] < input > output\n");
- exit(0);
+ space = dummy;
}
- }
-
- for (i = 0; i < BUCKETS; i++)
- nscache[i] = NULL;
- for (i = 0; i < MAX_ERR + 2; i++)
- errors[i] = 0;
- while (get_line(line, MAXLINE)) {
- if (line[0] == '\0')
- continue;
- entries++;
- if (!apr_isdigit(line[0])) { /* short cut */
- puts(line);
- withname++;
+ /* See if we have it in our cache */
+ hostname = (char *) apr_hash_get(cache, line, APR_HASH_KEY_STRING);
+ if (hostname) {
+ apr_file_printf(outfile, "%s %s", hostname, space + 1);
+ cachehits++;
continue;
}
- bar = strchr(line, ' ');
- if (bar != NULL)
- *bar = '\0';
- ipnum.s_addr = inet_addr(line);
- if (ipnum.s_addr == 0xffffffffu) {
- if (bar != NULL)
- *bar = ' ';
- puts(line);
+
+ /* Parse the IP address */
+ status = apr_sockaddr_info_get(&ip, line, APR_UNSPEC, 0, 0, pline);
+ if (status != APR_SUCCESS) {
+ /* Not an IP address */
withname++;
+ *space = ' ';
+ apr_file_puts(line, outfile);
continue;
}
+ /* This does not make much sense, but historically "resolves" means
+ * "parsed as an IP address". It does not mean we actually resolved
+ * the IP address into a hostname.
+ */
resolves++;
- cgethost(ipnum, hoststring, check);
- if (bar != NULL)
- printf("%s %s\n", hoststring, bar + 1);
- else
- puts(hoststring);
- }
+ /* From here on our we cache each result, even if it was not
+ * succesful
+ */
+ cachesize++;
-#if defined(WIN32) || (defined(NETWARE) && defined(USE_WINSOCK))
- WSACleanup();
-#endif
+ /* Try and perform a reverse lookup */
+ status = apr_getnameinfo(&hostname, ip, 0) != APR_SUCCESS;
+ if (status || hostname == NULL) {
+ /* Could not perform a reverse lookup */
+ *space = ' ';
+ apr_file_puts(line, outfile);
+ noreverse++;
+
+ /* Add to cache */
+ *space = '\0';
+ apr_hash_set(cache, line, APR_HASH_KEY_STRING,
+ apr_pstrdup(apr_hash_pool_get(cache), line));
+ continue;
+ }
+
+ /* Perform a double lookup */
+ if (doublelookups) {
+ /* Do a forward lookup on our hostname, and see if that matches our
+ * original IP address.
+ */
+ status = apr_sockaddr_info_get(&ipdouble, hostname, ip->family, 0,
+ 0, pline);
+ if (status == APR_SUCCESS ||
+ memcmp(ipdouble->ipaddr_ptr, ip->ipaddr_ptr, ip->ipaddr_len)) {
+ /* Double-lookup failed */
+ *space = ' ';
+ apr_file_puts(line, outfile);
+ doublefailed++;
+
+ /* Add to cache */
+ *space = '\0';
+ apr_hash_set(cache, line, APR_HASH_KEY_STRING,
+ apr_pstrdup(apr_hash_pool_get(cache), line));
+ continue;
+ }
+ }
+
+ /* Outout the resolved name */
+ apr_file_printf(outfile, "%s %s", hostname, space + 1);
+
+ /* Store it in the cache */
+ apr_hash_set(cache, line, APR_HASH_KEY_STRING,
+ apr_pstrdup(apr_hash_pool_get(cache), hostname));
+
+ apr_pool_clear(pline);
+ }
- if (statfile != NULL) {
- FILE *fp;
- fp = fopen(statfile, "w");
- if (fp == NULL) {
- fprintf(stderr, "logresolve: could not open statistics file '%s'\n"
- ,statfile);
- exit(1);
+ /* Flush any remaining output */
+ apr_file_flush(outfile);
+
+ if (stats) {
+ apr_file_t *statsfile;
+ if (apr_file_open(&statsfile, stats,
+ APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE,
+ APR_OS_DEFAULT, pool) != APR_SUCCESS) {
+ apr_file_printf(errfile, "%s: Could not open %s for writing.",
+ shortname, stats);
+ return 1;
}
- stats(fp);
- fclose(fp);
+ print_statistics(statsfile);
+ apr_file_close(statsfile);
}
- return (0);
+ return 0;
}
diff --git a/support/logresolve.dep b/support/logresolve.dep
deleted file mode 100644
index f8bfc62d..00000000
--- a/support/logresolve.dep
+++ /dev/null
@@ -1,9 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by logresolve.mak
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
-
-.\logresolve.c : \
- "..\srclib\apr\include\apr_lib.h"\
-
diff --git a/support/logresolve.mak b/support/logresolve.mak
deleted file mode 100644
index 8bcb1d6e..00000000
--- a/support/logresolve.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on logresolve.dsp
-!IF "$(CFG)" == ""
-CFG=logresolve - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to logresolve - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "logresolve - Win32 Release" && "$(CFG)" != "logresolve - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "logresolve.mak" CFG="logresolve - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "logresolve - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "logresolve - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "logresolve - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\logresolve.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\logresolve.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\logresolve.obj"
- -@erase "$(INTDIR)\logresolve.res"
- -@erase "$(INTDIR)\logresolve_src.idb"
- -@erase "$(INTDIR)\logresolve_src.pdb"
- -@erase "$(OUTDIR)\logresolve.exe"
- -@erase "$(OUTDIR)\logresolve.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\logresolve_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\logresolve.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="logresolve.exe" /d LONG_NAME="Apache logresolve command line pipe"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\logresolve.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\logresolve.pdb" /debug /out:"$(OUTDIR)\logresolve.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\logresolve.obj" \
- "$(INTDIR)\logresolve.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\logresolve.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\logresolve.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\logresolve.exe"
- if exist .\Release\logresolve.exe.manifest mt.exe -manifest .\Release\logresolve.exe.manifest -outputresource:.\Release\logresolve.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "logresolve - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\logresolve.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\logresolve.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\logresolve.obj"
- -@erase "$(INTDIR)\logresolve.res"
- -@erase "$(INTDIR)\logresolve_src.idb"
- -@erase "$(INTDIR)\logresolve_src.pdb"
- -@erase "$(OUTDIR)\logresolve.exe"
- -@erase "$(OUTDIR)\logresolve.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\logresolve_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\logresolve.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="logresolve.exe" /d LONG_NAME="Apache logresolve command line pipe"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\logresolve.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\logresolve.pdb" /debug /out:"$(OUTDIR)\logresolve.exe"
-LINK32_OBJS= \
- "$(INTDIR)\logresolve.obj" \
- "$(INTDIR)\logresolve.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\logresolve.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\logresolve.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\logresolve.exe"
- if exist .\Debug\logresolve.exe.manifest mt.exe -manifest .\Debug\logresolve.exe.manifest -outputresource:.\Debug\logresolve.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("logresolve.dep")
-!INCLUDE "logresolve.dep"
-!ELSE
-!MESSAGE Warning: cannot find "logresolve.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "logresolve - Win32 Release" || "$(CFG)" == "logresolve - Win32 Debug"
-
-!IF "$(CFG)" == "logresolve - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "logresolve - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "logresolve - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "logresolve - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "logresolve - Win32 Release"
-
-
-"$(INTDIR)\logresolve.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\logresolve.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="logresolve.exe" /d LONG_NAME="Apache logresolve command line pipe" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "logresolve - Win32 Debug"
-
-
-"$(INTDIR)\logresolve.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\logresolve.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="logresolve.exe" /d LONG_NAME="Apache logresolve command line pipe" $(SOURCE)
-
-
-!ENDIF
-
-SOURCE=.\logresolve.c
-
-"$(INTDIR)\logresolve.obj" : $(SOURCE) "$(INTDIR)"
-
-
-
-!ENDIF
-
diff --git a/support/rotatelogs.c b/support/rotatelogs.c
index 1e7218f1..81bd950f 100644
--- a/support/rotatelogs.c
+++ b/support/rotatelogs.c
@@ -34,6 +34,8 @@
* -f option added Feb, 2008. This causes rotatelog to open/create
* the logfile as soon as it's started, not as soon as it sees
* data.
+ *
+ * -v option added Feb, 2008. Verbose output of command line parsing.
*/
@@ -46,16 +48,16 @@
#include "apr_general.h"
#include "apr_time.h"
#include "apr_getopt.h"
+#include "apr_thread_proc.h"
+#if APR_FILES_AS_SOCKETS
+#include "apr_poll.h"
+#endif
#if APR_HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#if APR_HAVE_STRING_H
-#include <string.h>
-#endif
-#if APR_HAVE_STRINGS_H
-#include <strings.h>
-#endif
+#define APR_WANT_STRFUNC
+#include "apr_want.h"
#define BUFSIZE 65536
#define ERRMSGSZ 256
@@ -64,14 +66,75 @@
#define MAX_PATH 1024
#endif
+#define ROTATE_NONE 0
+#define ROTATE_NEW 1
+#define ROTATE_TIME 2
+#define ROTATE_SIZE 3
+#define ROTATE_FORCE 4
+
+static const char *ROTATE_REASONS[] = {
+ "None",
+ "Open a new file",
+ "Time interval expired",
+ "Maximum size reached",
+ "Forced rotation",
+ NULL
+};
+
+typedef struct rotate_config rotate_config_t;
+
+struct rotate_config {
+ unsigned int sRotation;
+ int tRotation;
+ int utc_offset;
+ int use_localtime;
+ int use_strftime;
+ int force_open;
+ int verbose;
+ int echo;
+ const char *szLogRoot;
+ int truncate;
+ const char *linkfile;
+ const char *postrotate_prog;
+#if APR_FILES_AS_SOCKETS
+ int create_empty;
+#endif
+};
+
+typedef struct rotate_status rotate_status_t;
+
+/* Structure to contain relevant logfile state: fd, pool and
+ * filename. */
+struct logfile {
+ apr_pool_t *pool;
+ apr_file_t *fd;
+ char name[MAX_PATH];
+};
+
+struct rotate_status {
+ struct logfile current; /* current logfile. */
+ apr_pool_t *pool; /* top-level pool */
+ char errbuf[ERRMSGSZ];
+ int rotateReason;
+ int tLogEnd;
+ int nMessCount;
+};
+
+static rotate_config_t config;
+static rotate_status_t status;
+
static void usage(const char *argv0, const char *reason)
{
if (reason) {
fprintf(stderr, "%s\n", reason);
}
fprintf(stderr,
- "Usage: %s [-l] [-f] <logfile> "
- "{<rotation time in seconds>|<rotation size in megabytes>} "
+#if APR_FILES_AS_SOCKETS
+ "Usage: %s [-v] [-l] [-L linkname] [-p prog] [-f] [-t] [-e] [-c] <logfile> "
+#else
+ "Usage: %s [-v] [-l] [-L linkname] [-p prog] [-f] [-t] [-e] <logfile> "
+#endif
+ "{<rotation time in seconds>|<rotation size>(B|K|M|G)} "
"[offset minutes from UTC]\n\n",
argv0);
#ifdef OS2
@@ -86,19 +149,43 @@ static void usage(const char *argv0, const char *reason)
"or \n\nTransferLog \"|%s /some/where 5M\"\n\n", argv0);
#endif
fprintf(stderr,
- "to httpd.conf. The generated name will be /some/where.nnnn "
- "where nnnn is the\nsystem time at which the log nominally "
- "starts (N.B. if using a rotation time,\nthe time will always "
- "be a multiple of the rotation time, so you can synchronize\n"
- "cron scripts with it). At the end of each rotation time or "
- "when the file size\nis reached a new log is started.\n");
+ "to httpd.conf. By default, the generated name will be\n"
+ "<logfile>.nnnn where nnnn is the system time at which the log\n"
+ "nominally starts (N.B. if using a rotation time, the time will\n"
+ "always be a multiple of the rotation time, so you can synchronize\n"
+ "cron scripts with it). If <logfile> contains strftime conversion\n"
+ "specifications, those will be used instead. At the end of each\n"
+ "rotation time or when the file size is reached a new log is\n"
+ "started.\n"
+ "\n"
+ "Options:\n"
+ " -v Verbose operation. Messages are written to stderr.\n"
+ " -l Base rotation on local time instead of UTC.\n"
+ " -L path Create hard link from current log to specified path.\n"
+ " -p prog Run specified program after opening a new log file. See below.\n"
+ " -f Force opening of log on program start.\n"
+ " -t Truncate logfile instead of rotating, tail friendly.\n"
+ " -e Echo log to stdout for further processing.\n"
+#if APR_FILES_AS_SOCKETS
+ " -c Create log even if it is empty.\n"
+#endif
+ "\n"
+ "The program is invoked as \"[prog] <curfile> [<prevfile>]\"\n"
+ "where <curfile> is the filename of the newly opened logfile, and\n"
+ "<prevfile>, if given, is the filename of the previously used logfile.\n"
+ "\n");
exit(1);
}
-static int get_now(int use_localtime, int utc_offset)
+/*
+ * Get the unix time with timezone corrections
+ * given in the config struct.
+ */
+static int get_now(rotate_config_t *config)
{
apr_time_t tNow = apr_time_now();
- if (use_localtime) {
+ int utc_offset = config->utc_offset;
+ if (config->use_localtime) {
/* Check for our UTC offset before using it, since it might
* change if there's a switch between standard and daylight
* savings time.
@@ -110,41 +197,390 @@ static int get_now(int use_localtime, int utc_offset)
return (int)apr_time_sec(tNow) + utc_offset;
}
+/*
+ * Close a file and destroy the associated pool.
+ */
+static void close_logfile(rotate_config_t *config, struct logfile *logfile)
+{
+ if (config->verbose) {
+ fprintf(stderr, "Closing file %s\n", logfile->name);
+ }
+ apr_file_close(logfile->fd);
+ apr_pool_destroy(logfile->pool);
+}
+
+/*
+ * Dump the configuration parsing result to STDERR.
+ */
+static void dumpConfig (rotate_config_t *config)
+{
+ fprintf(stderr, "Rotation time interval: %12d\n", config->tRotation);
+ fprintf(stderr, "Rotation size interval: %12d\n", config->sRotation);
+ fprintf(stderr, "Rotation time UTC offset: %12d\n", config->utc_offset);
+ fprintf(stderr, "Rotation based on localtime: %12s\n", config->use_localtime ? "yes" : "no");
+ fprintf(stderr, "Rotation file date pattern: %12s\n", config->use_strftime ? "yes" : "no");
+ fprintf(stderr, "Rotation file forced open: %12s\n", config->force_open ? "yes" : "no");
+ fprintf(stderr, "Rotation verbose: %12s\n", config->verbose ? "yes" : "no");
+#if APR_FILES_AS_SOCKETS
+ fprintf(stderr, "Rotation create empty logs: %12s\n", config->create_empty ? "yes" : "no");
+#endif
+ fprintf(stderr, "Rotation file name: %21s\n", config->szLogRoot);
+ fprintf(stderr, "Post-rotation prog: %21s\n", config->postrotate_prog);
+}
+
+/*
+ * Check whether we need to rotate.
+ * Possible reasons are:
+ * - No log file open (ROTATE_NEW)
+ * - User forces us to rotate (ROTATE_FORCE)
+ * - Our log file size is already bigger than the
+ * allowed maximum (ROTATE_SIZE)
+ * - The next log time interval expired (ROTATE_TIME)
+ *
+ * When size and time constraints are both given,
+ * it suffices that one of them is fulfilled.
+ */
+static void checkRotate(rotate_config_t *config, rotate_status_t *status)
+{
+ if (status->current.fd == NULL) {
+ status->rotateReason = ROTATE_NEW;
+ }
+ else if (config->sRotation) {
+ apr_finfo_t finfo;
+ apr_off_t current_size = -1;
+
+ if (apr_file_info_get(&finfo, APR_FINFO_SIZE, status->current.fd) == APR_SUCCESS) {
+ current_size = finfo.size;
+ }
+
+ if (current_size > config->sRotation) {
+ status->rotateReason = ROTATE_SIZE;
+ }
+ else if (config->tRotation) {
+ if (get_now(config) >= status->tLogEnd) {
+ status->rotateReason = ROTATE_TIME;
+ }
+ }
+ }
+ else if (config->tRotation) {
+ if (get_now(config) >= status->tLogEnd) {
+ status->rotateReason = ROTATE_TIME;
+ }
+ }
+ else {
+ fprintf(stderr, "No rotation time or size specified\n");
+ exit(2);
+ }
+
+ if (status->rotateReason != ROTATE_NONE && config->verbose) {
+ fprintf(stderr, "File rotation needed, reason: %s\n", ROTATE_REASONS[status->rotateReason]);
+ }
+}
+
+/*
+ * Handle post-rotate processing.
+ */
+static void post_rotate(apr_pool_t *pool, struct logfile *newlog,
+ rotate_config_t *config, rotate_status_t *status)
+{
+ apr_status_t rv;
+ char error[120];
+ apr_procattr_t *pattr;
+ const char *argv[4];
+ apr_proc_t proc;
+
+ /* Handle link file, if configured. */
+ if (config->linkfile) {
+ apr_file_remove(config->linkfile, newlog->pool);
+ if (config->verbose) {
+ fprintf(stderr,"Linking %s to %s\n", newlog->name, config->linkfile);
+ }
+ rv = apr_file_link(newlog->name, config->linkfile);
+ if (rv != APR_SUCCESS) {
+ char error[120];
+ apr_strerror(rv, error, sizeof error);
+ fprintf(stderr, "Error linking file %s to %s (%s)\n",
+ newlog->name, config->linkfile, error);
+ exit(2);
+ }
+ }
+
+ if (!config->postrotate_prog) {
+ /* Nothing more to do. */
+ return;
+ }
+
+ /* Collect any zombies from a previous run, but don't wait. */
+ while (apr_proc_wait_all_procs(&proc, NULL, NULL, APR_NOWAIT, pool) == APR_CHILD_DONE)
+ /* noop */;
+
+ if ((rv = apr_procattr_create(&pattr, pool)) != APR_SUCCESS) {
+ fprintf(stderr,
+ "post_rotate: apr_procattr_create failed for '%s': %s\n",
+ config->postrotate_prog,
+ apr_strerror(rv, error, sizeof(error)));
+ return;
+ }
+
+ rv = apr_procattr_error_check_set(pattr, 1);
+ if (rv == APR_SUCCESS)
+ rv = apr_procattr_cmdtype_set(pattr, APR_PROGRAM_ENV);
+
+ if (rv != APR_SUCCESS) {
+ fprintf(stderr,
+ "post_rotate: could not set up process attributes for '%s': %s\n",
+ config->postrotate_prog,
+ apr_strerror(rv, error, sizeof(error)));
+ return;
+ }
+
+ argv[0] = config->postrotate_prog;
+ argv[1] = newlog->name;
+ if (status->current.name) {
+ argv[2] = status->current.name;
+ argv[3] = NULL;
+ }
+ else {
+ argv[2] = NULL;
+ }
+
+ if (config->verbose)
+ fprintf(stderr, "Calling post-rotate program: %s\n", argv[0]);
+
+ rv = apr_proc_create(&proc, argv[0], argv, NULL, pattr, pool);
+ if (rv != APR_SUCCESS) {
+ fprintf(stderr, "Could not spawn post-rotate process '%s': %s\n",
+ config->postrotate_prog,
+ apr_strerror(rv, error, sizeof(error)));
+ return;
+ }
+}
+
+/*
+ * Open a new log file, and if successful
+ * also close the old one.
+ *
+ * The timestamp for the calculation of the file
+ * name of the new log file will be the actual millisecond
+ * timestamp, except when a regular rotation based on a time
+ * interval is configured and the previous interval
+ * is over. Then the timestamp is the starting time
+ * of the actual interval.
+ */
+static void doRotate(rotate_config_t *config, rotate_status_t *status)
+{
+
+ int now = get_now(config);
+ int tLogStart;
+ apr_status_t rv;
+ struct logfile newlog;
+
+ status->rotateReason = ROTATE_NONE;
+
+ if (config->tRotation) {
+ int tLogEnd;
+ tLogStart = (now / config->tRotation) * config->tRotation;
+ tLogEnd = tLogStart + config->tRotation;
+ /*
+ * Check if rotation was forced and the last rotation
+ * interval is not yet over. Use the value of now instead
+ * of the time interval boundary for the file name then.
+ */
+ if (tLogStart < status->tLogEnd) {
+ tLogStart = now;
+ }
+ status->tLogEnd = tLogEnd;
+ }
+ else {
+ tLogStart = now;
+ }
+
+ if (config->use_strftime) {
+ apr_time_t tNow = apr_time_from_sec(tLogStart);
+ apr_time_exp_t e;
+ apr_size_t rs;
+
+ apr_time_exp_gmt(&e, tNow);
+ apr_strftime(newlog.name, &rs, sizeof(newlog.name), config->szLogRoot, &e);
+ }
+ else {
+ if (config->truncate) {
+ apr_snprintf(newlog.name, sizeof(newlog.name), "%s", config->szLogRoot);
+ }
+ else {
+ apr_snprintf(newlog.name, sizeof(newlog.name), "%s.%010d", config->szLogRoot,
+ tLogStart);
+ }
+ }
+ apr_pool_create(&newlog.pool, status->pool);
+ if (config->verbose) {
+ fprintf(stderr, "Opening file %s\n", newlog.name);
+ }
+ rv = apr_file_open(&newlog.fd, newlog.name, APR_WRITE | APR_CREATE | APR_APPEND
+ | (config->truncate ? APR_TRUNCATE : 0), APR_OS_DEFAULT, newlog.pool);
+ if (rv == APR_SUCCESS) {
+ /* Handle post-rotate processing. */
+ post_rotate(newlog.pool, &newlog, config, status);
+
+ /* Close out old (previously 'current') logfile, if any. */
+ if (status->current.fd) {
+ close_logfile(config, &status->current);
+ }
+
+ /* New log file is now 'current'. */
+ status->current = newlog;
+ }
+ else {
+ char error[120];
+ apr_size_t nWrite;
+
+ apr_strerror(rv, error, sizeof error);
+
+ /* Uh-oh. Failed to open the new log file. Try to clear
+ * the previous log file, note the lost log entries,
+ * and keep on truckin'. */
+ if (status->current.fd == NULL) {
+ fprintf(stderr, "Could not open log file '%s' (%s)\n", newlog.name, error);
+ exit(2);
+ }
+
+ /* Throw away new state; it isn't going to be used. */
+ apr_pool_destroy(newlog.pool);
+
+ /* Try to keep this error message constant length
+ * in case it occurs several times. */
+ apr_snprintf(status->errbuf, sizeof status->errbuf,
+ "Resetting log file due to error opening "
+ "new log file, %10d messages lost: %-25.25s\n",
+ status->nMessCount, error);
+ nWrite = strlen(status->errbuf);
+
+ if (apr_file_trunc(status->current.fd, 0) != APR_SUCCESS) {
+ fprintf(stderr, "Error truncating the file %s\n", status->current.name);
+ exit(2);
+ }
+ if (apr_file_write(status->current.fd, status->errbuf, &nWrite) != APR_SUCCESS) {
+ fprintf(stderr, "Error writing to the file %s\n", status->current.name);
+ exit(2);
+ }
+ }
+
+ status->nMessCount = 0;
+}
+
+/*
+ * Get a size or time param from a string.
+ * Parameter 'last' indicates, whether the
+ * argument is the last commadnline argument.
+ * UTC offset is only allowed as a last argument
+ * in order to make is distinguishable from the
+ * rotation interval time.
+ */
+static const char *get_time_or_size(rotate_config_t *config,
+ const char *arg, int last) {
+ char *ptr = NULL;
+ /* Byte multiplier */
+ unsigned int mult = 1;
+ if ((ptr = strchr(arg, 'B')) != NULL) { /* Found KB size */
+ mult = 1;
+ }
+ else if ((ptr = strchr(arg, 'K')) != NULL) { /* Found KB size */
+ mult = 1024;
+ }
+ else if ((ptr = strchr(arg, 'M')) != NULL) { /* Found MB size */
+ mult = 1024 * 1024;
+ }
+ else if ((ptr = strchr(arg, 'G')) != NULL) { /* Found GB size */
+ mult = 1024 * 1024 * 1024;
+ }
+ if (ptr) { /* rotation based on file size */
+ if (config->sRotation > 0) {
+ return "Rotation size parameter allowed only once";
+ }
+ if (*(ptr+1) == '\0') {
+ config->sRotation = atoi(arg) * mult;
+ }
+ if (config->sRotation == 0) {
+ return "Invalid rotation size parameter";
+ }
+ }
+ else if ((config->sRotation > 0 || config->tRotation > 0) && last) {
+ /* rotation based on elapsed time */
+ if (config->use_localtime) {
+ return "UTC offset parameter is not valid with -l";
+ }
+ config->utc_offset = atoi(arg) * 60;
+ }
+ else { /* rotation based on elapsed time */
+ if (config->tRotation > 0) {
+ return "Rotation time parameter allowed only once";
+ }
+ config->tRotation = atoi(arg);
+ if (config->tRotation <= 0) {
+ return "Invalid rotation time parameter";
+ }
+ }
+ return NULL;
+}
+
int main (int argc, const char * const argv[])
{
- char buf[BUFSIZE], buf2[MAX_PATH], errbuf[ERRMSGSZ];
- int tLogEnd = 0, tRotation = 0, utc_offset = 0;
- unsigned int sRotation = 0;
- int nMessCount = 0;
+ char buf[BUFSIZE];
apr_size_t nRead, nWrite;
- int use_strftime = 0;
- int use_localtime = 0;
- int bypass_io = 0;
- int now = 0;
- const char *szLogRoot;
- apr_file_t *f_stdin, *nLogFD = NULL, *nLogFDprev = NULL;
- apr_pool_t *pool;
- apr_pool_t *pfile = NULL;
- apr_pool_t *pfile_prev = NULL;
+ apr_file_t *f_stdin;
+ apr_file_t *f_stdout;
apr_getopt_t *opt;
apr_status_t rv;
char c;
- const char *optarg;
- char *ptr = NULL;
+ const char *opt_arg;
+ const char *err = NULL;
+#if APR_FILES_AS_SOCKETS
+ apr_pollfd_t pollfd = { 0 };
+ apr_status_t pollret = APR_SUCCESS;
+ int polltimeout;
+#endif
apr_app_initialize(&argc, &argv, NULL);
atexit(apr_terminate);
- apr_pool_create(&pool, NULL);
- apr_getopt_init(&opt, pool, argc, argv);
- while ((rv = apr_getopt(opt, "lf", &c, &optarg)) == APR_SUCCESS) {
+ memset(&config, 0, sizeof config);
+ memset(&status, 0, sizeof status);
+ status.rotateReason = ROTATE_NONE;
+
+ apr_pool_create(&status.pool, NULL);
+ apr_getopt_init(&opt, status.pool, argc, argv);
+#if APR_FILES_AS_SOCKETS
+ while ((rv = apr_getopt(opt, "lL:p:ftvec", &c, &opt_arg)) == APR_SUCCESS) {
+#else
+ while ((rv = apr_getopt(opt, "lL:p:ftve", &c, &opt_arg)) == APR_SUCCESS) {
+#endif
switch (c) {
case 'l':
- use_localtime = 1;
+ config.use_localtime = 1;
+ break;
+ case 'L':
+ config.linkfile = opt_arg;
+ break;
+ case 'p':
+ config.postrotate_prog = opt_arg;
break;
case 'f':
- bypass_io = 1;
+ config.force_open = 1;
+ break;
+ case 't':
+ config.truncate = 1;
break;
+ case 'v':
+ config.verbose = 1;
+ break;
+ case 'e':
+ config.echo = 1;
+ break;
+#if APR_FILES_AS_SOCKETS
+ case 'c':
+ config.create_empty = 1;
+ break;
+#endif
}
}
@@ -152,195 +588,148 @@ int main (int argc, const char * const argv[])
usage(argv[0], NULL /* specific error message already issued */ );
}
- if (opt->ind + 2 != argc && opt->ind + 3 != argc) {
+ /*
+ * After the initial flags we need 2 to 4 arguments,
+ * the file name, either the rotation interval time or size
+ * or both of them, and optionally the UTC offset.
+ */
+ if ((argc - opt->ind < 2) || (argc - opt->ind > 4) ) {
usage(argv[0], "Incorrect number of arguments");
}
- szLogRoot = argv[opt->ind++];
+ config.szLogRoot = argv[opt->ind++];
- ptr = strchr(argv[opt->ind], 'M');
- if (ptr) { /* rotation based on file size */
- if (*(ptr+1) == '\0') {
- sRotation = atoi(argv[opt->ind]) * 1048576;
- }
- if (sRotation == 0) {
- usage(argv[0], "Invalid rotation size parameter");
- }
- }
- else { /* rotation based on elapsed time */
- tRotation = atoi(argv[opt->ind]);
- if (tRotation <= 0) {
- usage(argv[0], "Invalid rotation time parameter");
+ /* Read in the remaining flags, namely time, size and UTC offset. */
+ for(; opt->ind < argc; opt->ind++) {
+ if ((err = get_time_or_size(&config, argv[opt->ind],
+ opt->ind < argc - 1 ? 0 : 1)) != NULL) {
+ usage(argv[0], err);
}
}
- opt->ind++;
- if (opt->ind < argc) { /* have UTC offset */
- if (use_localtime) {
- usage(argv[0], "UTC offset parameter is not valid with -l");
- }
- utc_offset = atoi(argv[opt->ind]) * 60;
- }
+ config.use_strftime = (strchr(config.szLogRoot, '%') != NULL);
- use_strftime = (strchr(szLogRoot, '%') != NULL);
- if (apr_file_open_stdin(&f_stdin, pool) != APR_SUCCESS) {
+ if (apr_file_open_stdin(&f_stdin, status.pool) != APR_SUCCESS) {
fprintf(stderr, "Unable to open stdin\n");
exit(1);
}
+ if (apr_file_open_stdout(&f_stdout, status.pool) != APR_SUCCESS) {
+ fprintf(stderr, "Unable to open stdout\n");
+ exit(1);
+ }
+
+ /*
+ * Write out result of config parsing if verbose is set.
+ */
+ if (config.verbose) {
+ dumpConfig(&config);
+ }
+
+#if APR_FILES_AS_SOCKETS
+ if (config.create_empty && config.tRotation) {
+ pollfd.p = status.pool;
+ pollfd.desc_type = APR_POLL_FILE;
+ pollfd.reqevents = APR_POLLIN;
+ pollfd.desc.f = f_stdin;
+ }
+#endif
+
+ /*
+ * Immediately open the logfile as we start, if we were forced
+ * to do so via '-f'.
+ */
+ if (config.force_open) {
+ doRotate(&config, &status);
+ }
+
for (;;) {
nRead = sizeof(buf);
- /*
- * Bypass reading stdin if we are forcing the logfile
- * to be opened as soon as we start. Since we won't be
- * writing anything, we just want to open the file.
- * First time through is the only time we do this
- * since we reset bypass_io after the 1st loop
- */
- if (!bypass_io) {
- if (apr_file_read(f_stdin, buf, &nRead) != APR_SUCCESS) {
- exit(3);
+#if APR_FILES_AS_SOCKETS
+ if (config.create_empty && config.tRotation) {
+ polltimeout = status.tLogEnd ? status.tLogEnd - get_now(&config) : config.tRotation;
+ if (polltimeout <= 0) {
+ pollret = APR_TIMEUP;
}
- }
- if (tRotation) {
- now = get_now(use_localtime, utc_offset);
- if (nLogFD != NULL && now >= tLogEnd) {
- nLogFDprev = nLogFD;
- nLogFD = NULL;
+ else {
+ pollret = apr_poll(&pollfd, 1, &pollret, apr_time_from_sec(polltimeout));
}
}
- else if (sRotation) {
- apr_finfo_t finfo;
- apr_off_t current_size = -1;
-
- if ((nLogFD != NULL) &&
- (apr_file_info_get(&finfo, APR_FINFO_SIZE, nLogFD) == APR_SUCCESS)) {
- current_size = finfo.size;
+ if (pollret == APR_SUCCESS) {
+ rv = apr_file_read(f_stdin, buf, &nRead);
+ if (APR_STATUS_IS_EOF(rv)) {
+ break;
}
-
- if (current_size > sRotation) {
- nLogFDprev = nLogFD;
- nLogFD = NULL;
+ else if (rv != APR_SUCCESS) {
+ exit(3);
}
}
+ else if (pollret == APR_TIMEUP) {
+ *buf = 0;
+ nRead = 0;
+ }
else {
- fprintf(stderr, "No rotation time or size specified\n");
- exit(2);
+ fprintf(stderr, "Unable to poll stdin\n");
+ exit(5);
+ }
+#else /* APR_FILES_AS_SOCKETS */
+ rv = apr_file_read(f_stdin, buf, &nRead);
+ if (APR_STATUS_IS_EOF(rv)) {
+ break;
+ }
+ else if (rv != APR_SUCCESS) {
+ exit(3);
+ }
+#endif /* APR_FILES_AS_SOCKETS */
+ checkRotate(&config, &status);
+ if (status.rotateReason != ROTATE_NONE) {
+ doRotate(&config, &status);
}
- if (nLogFD == NULL) {
- int tLogStart;
- apr_status_t rv;
-
- if (tRotation) {
- tLogStart = (now / tRotation) * tRotation;
- }
- else {
- tLogStart = get_now(use_localtime, utc_offset);
- }
-
- if (use_strftime) {
- apr_time_t tNow = apr_time_from_sec(tLogStart);
- apr_time_exp_t e;
- apr_size_t rs;
+ nWrite = nRead;
+ rv = apr_file_write(status.current.fd, buf, &nWrite);
+ if (rv == APR_SUCCESS && nWrite != nRead) {
+ /* buffer partially written, which for rotatelogs means we encountered
+ * an error such as out of space or quota or some other limit reached;
+ * try to write the rest so we get the real error code
+ */
+ apr_size_t nWritten = nWrite;
- apr_time_exp_gmt(&e, tNow);
- apr_strftime(buf2, &rs, sizeof(buf2), szLogRoot, &e);
- }
- else {
- apr_snprintf(buf2, sizeof(buf2), "%s.%010d", szLogRoot, tLogStart);
- }
- tLogEnd = tLogStart + tRotation;
- pfile_prev = pfile;
- apr_pool_create(&pfile, pool);
- rv = apr_file_open(&nLogFD, buf2, APR_WRITE | APR_CREATE | APR_APPEND,
- APR_OS_DEFAULT, pfile);
- if (rv != APR_SUCCESS) {
- char error[120];
-
- apr_strerror(rv, error, sizeof error);
-
- /* Uh-oh. Failed to open the new log file. Try to clear
- * the previous log file, note the lost log entries,
- * and keep on truckin'. */
- if (nLogFDprev == NULL) {
- fprintf(stderr, "Could not open log file '%s' (%s)\n", buf2, error);
- exit(2);
- }
- else {
- nLogFD = nLogFDprev;
- apr_pool_destroy(pfile);
- pfile = pfile_prev;
- /* Try to keep this error message constant length
- * in case it occurs several times. */
- apr_snprintf(errbuf, sizeof errbuf,
- "Resetting log file due to error opening "
- "new log file, %10d messages lost: %-25.25s\n",
- nMessCount, error);
- nWrite = strlen(errbuf);
- apr_file_trunc(nLogFD, 0);
- if (apr_file_write(nLogFD, errbuf, &nWrite) != APR_SUCCESS) {
- fprintf(stderr, "Error writing to the file %s\n", buf2);
- exit(2);
- }
- }
- }
- else if (nLogFDprev) {
- apr_file_close(nLogFDprev);
- if (pfile_prev) {
- apr_pool_destroy(pfile_prev);
- }
- }
- nMessCount = 0;
- }
- /*
- * If we just bypassed reading stdin, due to bypass_io,
- * then we have nothing to write, so skip this.
- */
- if (!bypass_io) {
+ nRead = nRead - nWritten;
nWrite = nRead;
- rv = apr_file_write(nLogFD, buf, &nWrite);
- if (rv == APR_SUCCESS && nWrite != nRead) {
- /* buffer partially written, which for rotatelogs means we encountered
- * an error such as out of space or quota or some other limit reached;
- * try to write the rest so we get the real error code
- */
- apr_size_t nWritten = nWrite;
-
- nRead = nRead - nWritten;
- nWrite = nRead;
- rv = apr_file_write(nLogFD, buf + nWritten, &nWrite);
+ rv = apr_file_write(status.current.fd, buf + nWritten, &nWrite);
+ }
+ if (nWrite != nRead) {
+ char strerrbuf[120];
+ apr_off_t cur_offset;
+
+ cur_offset = 0;
+ if (apr_file_seek(status.current.fd, APR_CUR, &cur_offset) != APR_SUCCESS) {
+ cur_offset = -1;
}
- if (nWrite != nRead) {
- char strerrbuf[120];
- apr_off_t cur_offset;
-
- cur_offset = 0;
- if (apr_file_seek(nLogFD, APR_CUR, &cur_offset) != APR_SUCCESS) {
- cur_offset = -1;
- }
- apr_strerror(rv, strerrbuf, sizeof strerrbuf);
- nMessCount++;
- apr_snprintf(errbuf, sizeof errbuf,
- "Error %d writing to log file at offset %" APR_OFF_T_FMT ". "
- "%10d messages lost (%s)\n",
- rv, cur_offset, nMessCount, strerrbuf);
- nWrite = strlen(errbuf);
- apr_file_trunc(nLogFD, 0);
- if (apr_file_write(nLogFD, errbuf, &nWrite) != APR_SUCCESS) {
- fprintf(stderr, "Error writing to the file %s\n", buf2);
+ apr_strerror(rv, strerrbuf, sizeof strerrbuf);
+ status.nMessCount++;
+ apr_snprintf(status.errbuf, sizeof status.errbuf,
+ "Error %d writing to log file at offset %" APR_OFF_T_FMT ". "
+ "%10d messages lost (%s)\n",
+ rv, cur_offset, status.nMessCount, strerrbuf);
+ nWrite = strlen(status.errbuf);
+ apr_file_trunc(status.current.fd, 0);
+ if (apr_file_write(status.current.fd, status.errbuf, &nWrite) != APR_SUCCESS) {
+ fprintf(stderr, "Error writing to the file %s\n", status.current.name);
exit(2);
- }
- }
- else {
- nMessCount++;
}
}
else {
- /* now worry about reading 'n writing all the time */
- bypass_io = 0;
+ status.nMessCount++;
+ }
+ if (config.echo) {
+ if (apr_file_write_full(f_stdout, buf, nRead, &nWrite)) {
+ fprintf(stderr, "Unable to write to stdout\n");
+ exit(4);
+ }
}
}
- /* Of course we never, but prevent compiler warnings */
- return 0;
+
+ return 0; /* reached only at stdin EOF. */
}
diff --git a/support/rotatelogs.dep b/support/rotatelogs.dep
deleted file mode 100644
index d30b6f52..00000000
--- a/support/rotatelogs.dep
+++ /dev/null
@@ -1,11 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by rotatelogs.mak
-
-..\build\win32\httpd.rc : \
- "..\include\ap_release.h"\
-
-
-.\rotatelogs.c : \
- "..\srclib\apr\include\apr_getopt.h"\
- "..\srclib\apr\include\apr_lib.h"\
- "..\srclib\apr\include\apr_strings.h"\
-
diff --git a/support/rotatelogs.mak b/support/rotatelogs.mak
deleted file mode 100644
index a44cae71..00000000
--- a/support/rotatelogs.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on rotatelogs.dsp
-!IF "$(CFG)" == ""
-CFG=rotatelogs - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to rotatelogs - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "rotatelogs - Win32 Release" && "$(CFG)" != "rotatelogs - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "rotatelogs.mak" CFG="rotatelogs - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "rotatelogs - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "rotatelogs - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "rotatelogs - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\rotatelogs.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\rotatelogs.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\rotatelogs.obj"
- -@erase "$(INTDIR)\rotatelogs.res"
- -@erase "$(INTDIR)\rotatelogs_src.idb"
- -@erase "$(INTDIR)\rotatelogs_src.pdb"
- -@erase "$(OUTDIR)\rotatelogs.exe"
- -@erase "$(OUTDIR)\rotatelogs.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\rotatelogs_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\rotatelogs.res" /i "../include" /i "../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="rotatelogs.exe" /d LONG_NAME="Apache rotatelogs command line pipe"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\rotatelogs.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\rotatelogs.pdb" /debug /out:"$(OUTDIR)\rotatelogs.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\rotatelogs.obj" \
- "$(INTDIR)\rotatelogs.res" \
- "..\srclib\apr\LibR\apr-1.lib" \
- "..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\rotatelogs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\rotatelogs.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\rotatelogs.exe"
- if exist .\Release\rotatelogs.exe.manifest mt.exe -manifest .\Release\rotatelogs.exe.manifest -outputresource:.\Release\rotatelogs.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "rotatelogs - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\rotatelogs.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\rotatelogs.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\rotatelogs.obj"
- -@erase "$(INTDIR)\rotatelogs.res"
- -@erase "$(INTDIR)\rotatelogs_src.idb"
- -@erase "$(INTDIR)\rotatelogs_src.pdb"
- -@erase "$(OUTDIR)\rotatelogs.exe"
- -@erase "$(OUTDIR)\rotatelogs.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\rotatelogs_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\rotatelogs.res" /i "../include" /i "../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="rotatelogs.exe" /d LONG_NAME="Apache rotatelogs command line pipe"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\rotatelogs.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\rotatelogs.pdb" /debug /out:"$(OUTDIR)\rotatelogs.exe"
-LINK32_OBJS= \
- "$(INTDIR)\rotatelogs.obj" \
- "$(INTDIR)\rotatelogs.res" \
- "..\srclib\apr\LibD\apr-1.lib" \
- "..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\rotatelogs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\rotatelogs.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\rotatelogs.exe"
- if exist .\Debug\rotatelogs.exe.manifest mt.exe -manifest .\Debug\rotatelogs.exe.manifest -outputresource:.\Debug\rotatelogs.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("rotatelogs.dep")
-!INCLUDE "rotatelogs.dep"
-!ELSE
-!MESSAGE Warning: cannot find "rotatelogs.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "rotatelogs - Win32 Release" || "$(CFG)" == "rotatelogs - Win32 Debug"
-
-!IF "$(CFG)" == "rotatelogs - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "rotatelogs - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-!IF "$(CFG)" == "rotatelogs - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ELSEIF "$(CFG)" == "rotatelogs - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support"
-
-!ENDIF
-
-SOURCE=..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "rotatelogs - Win32 Release"
-
-
-"$(INTDIR)\rotatelogs.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\rotatelogs.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="rotatelogs.exe" /d LONG_NAME="Apache rotatelogs command line pipe" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "rotatelogs - Win32 Debug"
-
-
-"$(INTDIR)\rotatelogs.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\rotatelogs.res" /i "../include" /i "../srclib/apr/include" /i ".\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="rotatelogs.exe" /d LONG_NAME="Apache rotatelogs command line pipe" $(SOURCE)
-
-
-!ENDIF
-
-SOURCE=.\rotatelogs.c
-
-"$(INTDIR)\rotatelogs.obj" : $(SOURCE) "$(INTDIR)"
-
-
-
-!ENDIF
-
diff --git a/support/suexec.c b/support/suexec.c
index 59371be0..5d78bcdb 100644
--- a/support/suexec.c
+++ b/support/suexec.c
@@ -46,6 +46,9 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
+#if APR_HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
#ifdef HAVE_PWD_H
#include <pwd.h>
@@ -55,29 +58,6 @@
#include <grp.h>
#endif
-/*
- ***********************************************************************
- * There is no initgroups() in QNX, so I believe this is safe :-)
- * Use cc -osuexec -3 -O -mf -DQNX suexec.c to compile.
- *
- * May 17, 1997.
- * Igor N. Kovalenko -- infoh mail.wplus.net
- ***********************************************************************
- */
-
-#if defined(NEED_INITGROUPS)
-int initgroups(const char *name, gid_t basegid)
-{
- /* QNX and MPE do not appear to support supplementary groups. */
- return 0;
-}
-#endif
-
-#if defined(SUNOS4)
-extern char *sys_errlist[];
-#define strerror(x) sys_errlist[(x)]
-#endif
-
#if defined(PATH_MAX)
#define AP_MAXPATH PATH_MAX
#elif defined(MAXPATHLEN)
@@ -101,6 +81,8 @@ static const char *const safe_env_lst[] =
"AUTH_TYPE=",
"CONTENT_LENGTH=",
"CONTENT_TYPE=",
+ "CONTEXT_DOCUMENT_ROOT=",
+ "CONTEXT_PREFIX=",
"DATE_GMT=",
"DATE_LOCAL=",
"DOCUMENT_NAME=",
@@ -119,13 +101,16 @@ static const char *const safe_env_lst[] =
"REMOTE_IDENT=",
"REMOTE_PORT=",
"REMOTE_USER=",
+ "REDIRECT_ERROR_NOTES=",
"REDIRECT_HANDLER=",
"REDIRECT_QUERY_STRING=",
"REDIRECT_REMOTE_USER=",
+ "REDIRECT_SCRIPT_FILENAME=",
"REDIRECT_STATUS=",
"REDIRECT_URL=",
"REQUEST_METHOD=",
"REQUEST_URI=",
+ "REQUEST_SCHEME=",
"SCRIPT_FILENAME=",
"SCRIPT_NAME=",
"SCRIPT_URI=",
@@ -151,7 +136,11 @@ static void err_output(int is_error, const char *fmt, va_list ap)
struct tm *lt;
if (!log) {
+#if defined(_LARGEFILE64_SOURCE) && HAVE_FOPEN64
+ if ((log = fopen64(AP_LOG_EXEC, "a")) == NULL) {
+#else
if ((log = fopen(AP_LOG_EXEC, "a")) == NULL) {
+#endif
fprintf(stderr, "suexec failure: could not open log file\n");
perror("fopen");
exit(1);
@@ -255,7 +244,6 @@ int main(int argc, char *argv[])
char *target_homedir; /* target home directory */
char *actual_uname; /* actual user name */
char *actual_gname; /* actual group name */
- char *prog; /* name of this program */
char *cmd; /* command to be executed */
char cwd[AP_MAXPATH]; /* current working directory */
char dwd[AP_MAXPATH]; /* docroot working directory */
@@ -269,7 +257,6 @@ int main(int argc, char *argv[])
*/
clean_env();
- prog = argv[0];
/*
* Check existence/validity of the UID of the user
* running this program. Error out if invalid.
@@ -597,18 +584,27 @@ int main(int argc, char *argv[])
umask(AP_SUEXEC_UMASK);
#endif /* AP_SUEXEC_UMASK */
- /*
- * Be sure to close the log file so the CGI can't
- * mess with it. If the exec fails, it will be reopened
- * automatically when log_err is called. Note that the log
- * might not actually be open if AP_LOG_EXEC isn't defined.
- * However, the "log" cell isn't ifdef'd so let's be defensive
- * and assume someone might have done something with it
- * outside an ifdef'd AP_LOG_EXEC block.
- */
+ /* Be sure to close the log file so the CGI can't mess with it. */
if (log != NULL) {
+#if APR_HAVE_FCNTL_H
+ /*
+ * ask fcntl(2) to set the FD_CLOEXEC flag on the log file,
+ * so it'll be automagically closed if the exec() call succeeds.
+ */
+ fflush(log);
+ setbuf(log, NULL);
+ if ((fcntl(fileno(log), F_SETFD, FD_CLOEXEC) == -1)) {
+ log_err("error: can't set close-on-exec flag");
+ exit(122);
+ }
+#else
+ /*
+ * In this case, exec() errors won't be logged because we have already
+ * dropped privileges and won't be able to reopen the log file.
+ */
fclose(log);
log = NULL;
+#endif
}
/*
diff --git a/support/suexec.h b/support/suexec.h
index 6bb3e372..07bb7bb0 100644
--- a/support/suexec.h
+++ b/support/suexec.h
@@ -56,15 +56,15 @@
#endif
/*
- * USERDIR_SUFFIX -- Define to be the subdirectory under users'
+ * USERDIR_SUFFIX -- Define to be the subdirectory under users'
* home directories where suEXEC access should
* be allowed. All executables under this directory
- * will be executable by suEXEC as the user so
- * they should be "safe" programs. If you are
- * using a "simple" UserDir directive (ie. one
- * without a "*" in it) this should be set to
+ * will be executable by suEXEC as the user so
+ * they should be "safe" programs. If you are
+ * using a "simple" UserDir directive (ie. one
+ * without a "*" in it) this should be set to
* the same value. suEXEC will not work properly
- * in cases where the UserDir directive points to
+ * in cases where the UserDir directive points to
* a location that is not the same as the user's
* home directory as referenced in the passwd file.
*
diff --git a/support/win32/ApacheMonitor.c b/support/win32/ApacheMonitor.c
index 6d97fb7b..de7c6429 100644
--- a/support/win32/ApacheMonitor.c
+++ b/support/win32/ApacheMonitor.c
@@ -53,7 +53,6 @@
#define AM_STRINGIFY_HELPER(n) #n
#endif
-#define OS_VERSION_WIN9X 1
#define OS_VERSION_WINNT 2
#define OS_VERSION_WIN2K 3
@@ -112,13 +111,7 @@ HWND g_hwndConnectDlg;
HCURSOR g_hCursorHourglass;
HCURSOR g_hCursorArrow;
-HANDLE g_hpipeOutRead;
-HANDLE g_hpipeOutWrite;
-HANDLE g_hpipeInRead;
-HANDLE g_hpipeInWrite;
-HANDLE g_hpipeStdError;
LANGID g_LangID;
-PROCESS_INFORMATION g_lpRedirectProc;
CRITICAL_SECTION g_stcSection;
LPTSTR g_szLocalHost;
@@ -226,7 +219,7 @@ void ErrorMessage(LPCTSTR szError, BOOL bFatal)
}
-int am_RespawnAsUserAdmin(HWND hwnd, DWORD op, LPCTSTR szService,
+int am_RespawnAsUserAdmin(HWND hwnd, DWORD op, LPCTSTR szService,
LPCTSTR szComputerName)
{
TCHAR args[MAX_PATH + MAX_COMPUTERNAME_LENGTH + 12];
@@ -236,7 +229,7 @@ int am_RespawnAsUserAdmin(HWND hwnd, DWORD op, LPCTSTR szService,
return 0;
}
- _sntprintf(args, sizeof(args) / sizeof(TCHAR),
+ _sntprintf(args, sizeof(args) / sizeof(TCHAR),
_T("%d \"%s\" \"%s\""), op, szService,
szComputerName ? szComputerName : _T(""));
if (!ShellExecute(hwnd, _T("runas"), __targv[0], args, NULL, SW_NORMAL)) {
@@ -266,7 +259,7 @@ BOOL am_ConnectComputer(LPTSTR szComputerName)
}
if (RegConnectRegistry(szComputerName, HKEY_LOCAL_MACHINE, &hKeyRemote)
!= ERROR_SUCCESS) {
- _sntprintf(szTmp, sizeof(szTmp) / sizeof(TCHAR),
+ _sntprintf(szTmp, sizeof(szTmp) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_ECONNECT - IDS_MSG_FIRST],
szComputerName);
ErrorMessage(szTmp, FALSE);
@@ -310,13 +303,10 @@ BOOL GetSystemOSVersion(LPDWORD dwVersion)
if (osvi.dwMajorVersion >= 5)
*dwVersion = OS_VERSION_WIN2K;
else
- *dwVersion = OS_VERSION_WINNT;
+ *dwVersion = OS_VERSION_WINNT;
break;
case VER_PLATFORM_WIN32_WINDOWS:
- *dwVersion = OS_VERSION_WIN9X;
- break;
-
case VER_PLATFORM_WIN32s:
default:
*dwVersion = 0;
@@ -361,11 +351,11 @@ static VOID ShowNotifyIcon(HWND hWnd, DWORD dwMessage)
_tcscpy(nid.szTip, g_lpMsg[IDS_MSG_RUNNINGALL - IDS_MSG_FIRST]);
}
else if (n) {
- _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
+ _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_RUNNING - IDS_MSG_FIRST], n, i);
}
else if (i) {
- _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
+ _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_RUNNINGNONE - IDS_MSG_FIRST], i);
}
else {
@@ -443,11 +433,9 @@ void ShowTryPopupMenu(HWND hWnd)
appendMenuItem(hMenu, IDM_RESTORE,
g_lpMsg[IDS_MSG_MNUSHOW - IDS_MSG_FIRST],
TRUE, TRUE);
- if (g_dwOSVersion >= OS_VERSION_WINNT) {
- appendMenuItem(hMenu, IDC_SMANAGER,
- g_lpMsg[IDS_MSG_MNUSERVICES - IDS_MSG_FIRST],
- FALSE, TRUE);
- }
+ appendMenuItem(hMenu, IDC_SMANAGER,
+ g_lpMsg[IDS_MSG_MNUSERVICES - IDS_MSG_FIRST],
+ FALSE, TRUE);
appendMenuItem(hMenu, 0, _T(""), FALSE, TRUE);
appendMenuItem(hMenu, IDM_EXIT,
g_lpMsg[IDS_MSG_MNUEXIT - IDS_MSG_FIRST],
@@ -549,191 +537,10 @@ static void addListBoxString(HWND hListBox, LPTSTR lpStr)
}
-#ifndef UNICODE
-#define addListBoxStringA addListBoxString
-#else
-static void addListBoxStringA(HWND hListBox, LPSTR lpStr)
-{
- static int nItems = 0;
- TCHAR WStr[16384];
-
- if (!g_bDlgServiceOn) {
- return;
- }
- if (!MultiByteToWideChar(CP_ACP, 0, lpStr, (int)strlen(lpStr) + 1,
- WStr, (int) (sizeof(WStr) / sizeof(TCHAR))))
- return;
- ++nItems;
- if (nItems > MAX_LOADSTRING)
- {
- SendMessage(hListBox, LB_RESETCONTENT, 0, 0);
- nItems = 1;
- }
- ListBox_SetCurSel(hListBox,
- ListBox_AddString(hListBox, WStr));
-}
-#endif
-
-
-static DWORD WINAPI ConsoleOutputThread(LPVOID lpThreadParameter)
-{
- static BYTE lpBuffer[MAX_PATH+1];
- int nPtr = 0;
- BYTE ch;
- DWORD dwReaded;
-
- while (ReadFile(g_hpipeOutRead, &ch, 1, &dwReaded, NULL) == TRUE)
- {
- if (dwReaded > 0)
- {
- if (ch == '\n' || nPtr >= MAX_PATH)
- {
- lpBuffer[nPtr] = '\0';
- addListBoxStringA(g_hwndStdoutList, lpBuffer);
- nPtr = 0;
- }
- else if (ch == '\t' && nPtr < (MAX_PATH - 4))
- {
- int i;
- for (i = 0; i < 4; ++i) {
- lpBuffer[nPtr++] = ' ';
- }
- }
- else if (ch != '\r') {
- lpBuffer[nPtr++] = ch;
- }
- }
- }
- CloseHandle(g_hpipeInWrite);
- CloseHandle(g_hpipeOutRead);
- CloseHandle(g_hpipeStdError);
- return 0;
-}
-
-
-DWORD WINAPI ConsoleWaitingThread(LPVOID lpThreadParameter)
-{
- WaitForSingleObject(g_lpRedirectProc.hThread, INFINITE);
- CloseHandle(g_lpRedirectProc.hThread);
- MessageBeep(100);
- g_bConsoleRun = FALSE;
- SetCursor(g_hCursorArrow);
- return 0;
-}
-
-
-BOOL RunRedirectedConsole(LPTSTR szCmdLine)
-{
- DWORD dwThreadId;
- HANDLE hProc;
- STARTUPINFO stInfo;
- BOOL bResult;
-
- memset(&stInfo, 0, sizeof(stInfo));
- stInfo.cb = sizeof(stInfo);
- stInfo.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
- stInfo.wShowWindow = SW_HIDE;
-
- hProc = GetCurrentProcess();
-
- if (!CreatePipe(&g_hpipeInRead, &g_hpipeInWrite, NULL, MAX_PATH)) {
- ErrorMessage(NULL, TRUE);
- }
- if (!CreatePipe(&g_hpipeOutRead, &g_hpipeOutWrite, NULL, MAX_PATH*8)) {
- ErrorMessage(NULL, TRUE);
- }
- DuplicateHandle(hProc, g_hpipeInRead, hProc, &g_hpipeInRead, 0, TRUE,
- DUPLICATE_CLOSE_SOURCE|DUPLICATE_SAME_ACCESS);
- DuplicateHandle(hProc, g_hpipeOutWrite, hProc, &g_hpipeOutWrite, 0, TRUE,
- DUPLICATE_CLOSE_SOURCE|DUPLICATE_SAME_ACCESS);
- DuplicateHandle(hProc, g_hpipeOutWrite, hProc, &g_hpipeStdError, 0, TRUE,
- DUPLICATE_SAME_ACCESS);
- if (!g_hpipeInRead && !g_hpipeOutWrite && !g_hpipeStdError) {
- ErrorMessage(NULL, TRUE);
- }
- stInfo.hStdInput = g_hpipeInRead;
- stInfo.hStdOutput = g_hpipeOutWrite;
- stInfo.hStdError = g_hpipeStdError;
-
- bResult = CreateProcess(NULL,
- szCmdLine,
- NULL,
- NULL,
- TRUE,
- CREATE_SUSPENDED,
- NULL,
- NULL,
- &stInfo,
- &g_lpRedirectProc);
-
-
- CloseHandle(g_hpipeInRead);
- CloseHandle(g_hpipeOutWrite);
- CloseHandle(g_hpipeStdError);
-
- if (!bResult)
- {
- CloseHandle(g_hpipeInWrite);
- CloseHandle(g_hpipeOutRead);
- CloseHandle(g_hpipeStdError);
- return FALSE;
- }
-
- CloseHandle(CreateThread(NULL, 0, ConsoleOutputThread,
- 0, 0, &dwThreadId));
- ResumeThread(g_lpRedirectProc.hThread);
- CloseHandle(CreateThread(NULL, 0, ConsoleWaitingThread,
- 0, 0, &dwThreadId));
-
- return TRUE;
-}
-
-
-BOOL RunAndForgetConsole(LPTSTR szCmdLine, BOOL bRedirectConsole)
-{
- STARTUPINFO stInfo;
- PROCESS_INFORMATION prInfo;
- BOOL bResult;
-
- if (bRedirectConsole) {
- return RunRedirectedConsole(szCmdLine);
- }
-
- memset(&stInfo, 0, sizeof(stInfo));
- stInfo.cb = sizeof(stInfo);
- stInfo.dwFlags = STARTF_USESHOWWINDOW;
- stInfo.wShowWindow = SW_HIDE;
-
- bResult = CreateProcess(NULL,
- szCmdLine,
- NULL,
- NULL,
- TRUE,
- CREATE_NEW_CONSOLE,
- NULL,
- NULL,
- &stInfo,
- &prInfo);
-
- if (!bResult) {
- return FALSE;
- }
- if (g_dwOSVersion == OS_VERSION_WIN9X) {
- /* give some time to rescan the status */
- Sleep(2000);
- }
- CloseHandle(prInfo.hThread);
- CloseHandle(prInfo.hProcess);
- return TRUE;
-}
-
-
BOOL ApacheManageService(LPCTSTR szServiceName, LPCTSTR szImagePath,
LPTSTR szComputerName, DWORD dwCommand)
{
- TCHAR szBuf[MAX_PATH];
TCHAR szMsg[MAX_PATH];
- LPTSTR sPos;
BOOL retValue;
BOOL serviceFlag = TRUE;
SC_HANDLE schService;
@@ -741,206 +548,148 @@ BOOL ApacheManageService(LPCTSTR szServiceName, LPCTSTR szImagePath,
SERVICE_STATUS schSStatus;
int ticks;
- if (g_dwOSVersion == OS_VERSION_WIN9X)
- {
- sPos = _tcsstr(szImagePath, _T("-k start"));
- if (sPos)
- {
- _tcsncpy(szBuf, szImagePath, (int)(sPos - szImagePath));
- switch (dwCommand)
- {
- case SERVICE_CONTROL_STOP:
- _tcscat(szBuf, _T(" -k shutdown -n "));
- break;
-
- case SERVICE_CONTROL_CONTINUE:
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
- g_lpMsg[IDS_MSG_SRVSTART - IDS_MSG_FIRST],
- szServiceName);
- addListBoxString(g_hwndStdoutList, szMsg);
- _tcscat(szBuf, _T(" -k start -n "));
- serviceFlag = FALSE;
- break;
-
- case SERVICE_APACHE_RESTART:
- _tcscat(szBuf, _T(" -k restart -n "));
- break;
+ schSCManager = OpenSCManager(szComputerName, NULL,
+ SC_MANAGER_CONNECT);
+ if (!schSCManager) {
+ ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
+ FALSE);
+ return FALSE;
+ }
- default:
- return FALSE;
- }
- _tcscat(szBuf, szServiceName);
+ schService = OpenService(schSCManager, szServiceName,
+ SERVICE_QUERY_STATUS | SERVICE_START |
+ SERVICE_STOP | SERVICE_USER_DEFINED_CONTROL);
+ if (schService == NULL)
+ {
+ /* Avoid recursion of ImagePath NULL (from this Respawn) */
+ if (szImagePath) {
+ am_RespawnAsUserAdmin(g_hwndMain, dwCommand,
+ szServiceName, szComputerName);
}
else {
- return FALSE;
- }
- g_bConsoleRun = TRUE;
- SetCursor(g_hCursorHourglass);
- if (!RunAndForgetConsole(szBuf, serviceFlag))
- {
- ErrorMessage(NULL, FALSE);
- g_bConsoleRun = FALSE;
- SetCursor(g_hCursorArrow);
- return FALSE;
- }
- else if (!serviceFlag)
- {
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
- g_lpMsg[IDS_MSG_SRVSTARTED - IDS_MSG_FIRST],
- szServiceName);
- addListBoxString(g_hwndStdoutList, szMsg);
- g_bConsoleRun = FALSE;
- SetCursor(g_hCursorArrow);
- return TRUE;
+ ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
+ FALSE);
}
+ CloseServiceHandle(schSCManager);
+ return FALSE;
}
else
{
- schSCManager = OpenSCManager(szComputerName, NULL,
- SC_MANAGER_CONNECT);
- if (!schSCManager) {
- ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
- FALSE);
- return FALSE;
- }
-
- schService = OpenService(schSCManager, szServiceName,
- SERVICE_QUERY_STATUS | SERVICE_START |
- SERVICE_STOP | SERVICE_USER_DEFINED_CONTROL);
- if (schService == NULL)
- {
- /* Avoid recursion of ImagePath NULL (from this Respawn) */
- if (szImagePath) {
- am_RespawnAsUserAdmin(g_hwndMain, dwCommand,
- szServiceName, szComputerName);
- }
- else {
- ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
- FALSE);
- }
- CloseServiceHandle(schSCManager);
- return FALSE;
- }
- else
+ retValue = FALSE;
+ g_bConsoleRun = TRUE;
+ SetCursor(g_hCursorHourglass);
+ switch (dwCommand)
{
- retValue = FALSE;
- g_bConsoleRun = TRUE;
- SetCursor(g_hCursorHourglass);
- switch (dwCommand)
- {
- case SERVICE_CONTROL_STOP:
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
- g_lpMsg[IDS_MSG_SRVSTOP - IDS_MSG_FIRST],
- szServiceName);
- addListBoxString(g_hwndStdoutList, szMsg);
- if (ControlService(schService, SERVICE_CONTROL_STOP,
- &schSStatus)) {
- Sleep(1000);
- while (QueryServiceStatus(schService, &schSStatus))
- {
- if (schSStatus.dwCurrentState == SERVICE_STOP_PENDING)
- {
- Sleep(1000);
- }
- else {
- break;
- }
- }
- }
- if (QueryServiceStatus(schService, &schSStatus))
+ case SERVICE_CONTROL_STOP:
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVSTOP - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+ if (ControlService(schService, SERVICE_CONTROL_STOP,
+ &schSStatus)) {
+ Sleep(1000);
+ while (QueryServiceStatus(schService, &schSStatus))
{
- if (schSStatus.dwCurrentState == SERVICE_STOPPED)
+ if (schSStatus.dwCurrentState == SERVICE_STOP_PENDING)
{
- retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
- g_lpMsg[IDS_MSG_SRVSTOPPED - IDS_MSG_FIRST],
- szServiceName);
- addListBoxString(g_hwndStdoutList, szMsg);
+ Sleep(1000);
}
- }
- break;
-
- case SERVICE_CONTROL_CONTINUE:
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
- g_lpMsg[IDS_MSG_SRVSTART - IDS_MSG_FIRST],
- szServiceName);
- addListBoxString(g_hwndStdoutList, szMsg);
-
- if (StartService(schService, 0, NULL))
- {
- Sleep(1000);
- while (QueryServiceStatus(schService, &schSStatus))
- {
- if (schSStatus.dwCurrentState == SERVICE_START_PENDING)
- {
- Sleep(1000);
- }
- else {
- break;
- }
+ else {
+ break;
}
}
- if (QueryServiceStatus(schService, &schSStatus))
+ }
+ if (QueryServiceStatus(schService, &schSStatus))
+ {
+ if (schSStatus.dwCurrentState == SERVICE_STOPPED)
{
- if (schSStatus.dwCurrentState == SERVICE_RUNNING)
- {
- retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
- g_lpMsg[IDS_MSG_SRVSTARTED - IDS_MSG_FIRST],
- szServiceName);
- addListBoxString(g_hwndStdoutList, szMsg);
- }
+ retValue = TRUE;
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVSTOPPED - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
}
- break;
+ }
+ break;
- case SERVICE_APACHE_RESTART:
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
- g_lpMsg[IDS_MSG_SRVRESTART - IDS_MSG_FIRST],
- szServiceName);
- addListBoxString(g_hwndStdoutList, szMsg);
- if (ControlService(schService, SERVICE_APACHE_RESTART,
- &schSStatus))
+ case SERVICE_CONTROL_CONTINUE:
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVSTART - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+
+ if (StartService(schService, 0, NULL))
+ {
+ Sleep(1000);
+ while (QueryServiceStatus(schService, &schSStatus))
{
- ticks = 60;
- while (schSStatus.dwCurrentState == SERVICE_START_PENDING)
+ if (schSStatus.dwCurrentState == SERVICE_START_PENDING)
{
Sleep(1000);
- if (!QueryServiceStatus(schService, &schSStatus))
- {
- CloseServiceHandle(schService);
- CloseServiceHandle(schSCManager);
- g_bConsoleRun = FALSE;
- SetCursor(g_hCursorArrow);
- return FALSE;
- }
- if (!--ticks) {
- break;
- }
+ }
+ else {
+ break;
}
}
+ }
+ if (QueryServiceStatus(schService, &schSStatus))
+ {
if (schSStatus.dwCurrentState == SERVICE_RUNNING)
{
retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
- g_lpMsg[IDS_MSG_SRVRESTARTED - IDS_MSG_FIRST],
- szServiceName);
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVSTARTED - IDS_MSG_FIRST],
+ szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
}
- break;
}
- CloseServiceHandle(schService);
- CloseServiceHandle(schSCManager);
- if (!retValue) {
- ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
- FALSE);
+ break;
+
+ case SERVICE_APACHE_RESTART:
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVRESTART - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+ if (ControlService(schService, SERVICE_APACHE_RESTART,
+ &schSStatus))
+ {
+ ticks = 60;
+ while (schSStatus.dwCurrentState == SERVICE_START_PENDING)
+ {
+ Sleep(1000);
+ if (!QueryServiceStatus(schService, &schSStatus))
+ {
+ CloseServiceHandle(schService);
+ CloseServiceHandle(schSCManager);
+ g_bConsoleRun = FALSE;
+ SetCursor(g_hCursorArrow);
+ return FALSE;
+ }
+ if (!--ticks) {
+ break;
+ }
+ }
+ }
+ if (schSStatus.dwCurrentState == SERVICE_RUNNING)
+ {
+ retValue = TRUE;
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVRESTARTED - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
}
- g_bConsoleRun = FALSE;
- SetCursor(g_hCursorArrow);
- return retValue;
+ break;
}
- return FALSE;
+ CloseServiceHandle(schService);
+ CloseServiceHandle(schSCManager);
+ if (!retValue) {
+ ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
+ FALSE);
+ }
+ g_bConsoleRun = FALSE;
+ SetCursor(g_hCursorArrow);
+ return retValue;
}
-
return FALSE;
}
@@ -949,55 +698,36 @@ BOOL IsServiceRunning(LPCTSTR szServiceName, LPCTSTR szComputerName,
LPDWORD lpdwPid)
{
DWORD dwPid;
- HWND hWnd;
SC_HANDLE schService;
SC_HANDLE schSCManager;
SERVICE_STATUS schSStatus;
- if (g_dwOSVersion == OS_VERSION_WIN9X)
- {
- hWnd = FindWindow(_T("ApacheWin95ServiceMonitor"), szServiceName);
- if (hWnd && GetWindowThreadProcessId(hWnd, &dwPid))
- {
- *lpdwPid = 1;
- return TRUE;
- }
- else {
- return FALSE;
- }
+ dwPid = 0;
+ schSCManager = OpenSCManager(szComputerName, NULL,
+ SC_MANAGER_CONNECT);
+ if (!schSCManager) {
+ return FALSE;
}
- else
- {
- dwPid = 0;
- schSCManager = OpenSCManager(szComputerName, NULL,
- SC_MANAGER_CONNECT);
- if (!schSCManager) {
- return FALSE;
- }
- schService = OpenService(schSCManager, szServiceName,
- SERVICE_QUERY_STATUS);
- if (schService != NULL)
+ schService = OpenService(schSCManager, szServiceName,
+ SERVICE_QUERY_STATUS);
+ if (schService != NULL)
+ {
+ if (QueryServiceStatus(schService, &schSStatus))
{
- if (QueryServiceStatus(schService, &schSStatus))
- {
- dwPid = schSStatus.dwCurrentState;
- if (lpdwPid) {
- *lpdwPid = 1;
- }
+ dwPid = schSStatus.dwCurrentState;
+ if (lpdwPid) {
+ *lpdwPid = 1;
}
- CloseServiceHandle(schService);
- CloseServiceHandle(schSCManager);
- return dwPid == SERVICE_RUNNING ? TRUE : FALSE;
- }
- else {
- g_bRescanServices = TRUE;
}
+ CloseServiceHandle(schService);
CloseServiceHandle(schSCManager);
- return FALSE;
-
+ return dwPid == SERVICE_RUNNING ? TRUE : FALSE;
}
-
+ else {
+ g_bRescanServices = TRUE;
+ }
+ CloseServiceHandle(schSCManager);
return FALSE;
}
@@ -1240,14 +970,8 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
g_lpMsg[IDS_MSG_SERVICES - IDS_MSG_FIRST]);
SetWindowText(GetDlgItem(hDlg, IDC_SCONNECT),
g_lpMsg[IDS_MSG_CONNECT - IDS_MSG_FIRST]);
- SetWindowText(GetDlgItem(hDlg, IDC_SEXIT),
- g_lpMsg[IDS_MSG_MNUEXIT - IDS_MSG_FIRST]);
- if (g_dwOSVersion < OS_VERSION_WINNT)
- {
- ShowWindow(GetDlgItem(hDlg, IDC_SMANAGER), SW_HIDE);
- ShowWindow(GetDlgItem(hDlg, IDC_SCONNECT), SW_HIDE);
- ShowWindow(GetDlgItem(hDlg, IDC_SDISCONN), SW_HIDE);
- }
+ SetWindowText(GetDlgItem(hDlg, IDCANCEL),
+ g_lpMsg[IDS_MSG_OK - IDS_MSG_FIRST]);
hListBox = GetDlgItem(hDlg, IDL_SERVICES);
g_hwndStdoutList = GetDlgItem(hDlg, IDL_STDOUT);
hStatusBar = CreateStatusWindow(0x0800 /* SBT_TOOLTIPS */
@@ -1326,6 +1050,7 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
}
switch (lpdis->itemAction)
{
+ case ODA_FOCUS:
case ODA_SELECT:
case ODA_DRAWENTIRE:
g_hBmpPicture = (HBITMAP)SendMessage(lpdis->hwndItem,
@@ -1358,6 +1083,7 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
if (g_hBmpPicture == g_hBmpStop)
{
Button_Enable(GetDlgItem(hDlg, IDC_SSTART), TRUE);
+ Button_SetStyle(GetDlgItem(hDlg, IDC_SSTART), BS_DEFPUSHBUTTON, TRUE);
Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
}
@@ -1365,6 +1091,7 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
{
Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), TRUE);
+ Button_SetStyle(GetDlgItem(hDlg, IDC_SSTOP), BS_DEFPUSHBUTTON, TRUE);
Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE);
}
else {
@@ -1387,9 +1114,16 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
else {
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
}
- SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
- FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_HIGHLIGHTTEXT));
+ if (lpdis->itemState & ODS_FOCUS) {
+ SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
+ SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
+ FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_HIGHLIGHT+1));
+ }
+ else {
+ SetTextColor(lpdis->hDC, GetSysColor(COLOR_INACTIVECAPTIONTEXT));
+ SetBkColor(lpdis->hDC, GetSysColor(COLOR_INACTIVECAPTION));
+ FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_INACTIVECAPTION+1));
+ }
}
else
{
@@ -1399,9 +1133,6 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
}
TextOut(lpdis->hDC, XBITMAP + 6, y, szBuf, (int)_tcslen(szBuf));
break;
-
- case ODA_FOCUS:
- break;
}
return TRUE;
case WM_COMMAND:
@@ -1433,7 +1164,7 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
}
break;
- case IDOK:
+ case IDCANCEL:
EndDialog(hDlg, TRUE);
return TRUE;
@@ -1480,11 +1211,6 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
}
return TRUE;
- case IDC_SEXIT:
- EndDialog(hDlg, TRUE);
- SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)IDM_EXIT, 0);
- return TRUE;
-
case IDC_SCONNECT:
DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DLGCONNECT),
hDlg, (DLGPROC)ConnectDlgProc);
@@ -1573,7 +1299,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
case WM_TIMER_REFRESH:
{
- int nPrev = 0, nNew = 0;
EnterCriticalSection(&g_stcSection);
if (g_bRescanServices)
{
@@ -1749,7 +1474,7 @@ static int KillAllMonitors(void)
int exitcode = 0;
PWTS_PROCESS_INFO tsProcs;
DWORD tsProcCount, i;
- DWORD thisProcId;
+ DWORD thisProcId;
/* This is graceful, close our own Window, clearing the icon */
if ((appwindow = FindWindow(g_szWindowClass, g_szTitle)) != NULL)
@@ -1773,7 +1498,7 @@ static int KillAllMonitors(void)
for (i = 0; i < tsProcCount; ++i) {
if (_tcscmp(tsProcs[i].pProcessName, _T(AM_STRINGIFY(BIN_NAME))) == 0
&& tsProcs[i].ProcessId != thisProcId)
- WTSTerminateProcess(WTS_CURRENT_SERVER_HANDLE,
+ WTSTerminateProcess(WTS_CURRENT_SERVER_HANDLE,
tsProcs[i].ProcessId, 1);
}
WTSFreeMemory(tsProcs);
diff --git a/support/win32/ApacheMonitor.dep b/support/win32/ApacheMonitor.dep
deleted file mode 100644
index f1f38154..00000000
--- a/support/win32/ApacheMonitor.dep
+++ /dev/null
@@ -1,17 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by ApacheMonitor.mak
-
-.\ApacheMonitor.c : \
- ".\ApacheMonitor.h"\
-
-
-.\ApacheMonitor.rc : \
- "..\..\build\win32\httpd.rc"\
- "..\..\include\ap_release.h"\
- ".\apache_header.bmp"\
- ".\ApacheMonitor.h"\
- ".\ApacheMonitor.ico"\
- ".\aprun.ico"\
- ".\apstop.ico"\
- ".\srun.bmp"\
- ".\sstop.bmp"\
-
diff --git a/support/win32/ApacheMonitor.h b/support/win32/ApacheMonitor.h
index 085c45f8..87109aaa 100644
--- a/support/win32/ApacheMonitor.h
+++ b/support/win32/ApacheMonitor.h
@@ -38,7 +38,6 @@
#define IDC_SSTART 117
#define IDC_SSTOP 118
#define IDC_SRESTART 119
-#define IDC_SEXIT 120
#define IDC_SMANAGER 121
#define IDD_DLGCONNECT 122
#define IDC_LREMOTE 123
@@ -69,7 +68,8 @@
#define IDS_MSG_SERVICES 275
#define IDS_MSG_CONNECT 276
#define IDS_MSG_ECONNECT 277
-#define IDS_MSG_LAST 277
+#define IDS_MSG_OK 278
+#define IDS_MSG_LAST 278
#define IDM_SM_SERVICE 0x1100
#define IDM_SM_START 0x1200
#define IDM_SM_STOP 0x1400
diff --git a/support/win32/ApacheMonitor.mak b/support/win32/ApacheMonitor.mak
deleted file mode 100644
index 51431554..00000000
--- a/support/win32/ApacheMonitor.mak
+++ /dev/null
@@ -1,309 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on ApacheMonitor.dsp
-!IF "$(CFG)" == ""
-CFG=ApacheMonitor - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to ApacheMonitor - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "ApacheMonitor - Win32 Release" && "$(CFG)" != "ApacheMonitor - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "ApacheMonitor.mak" CFG="ApacheMonitor - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ApacheMonitor - Win32 Release" (based on "Win32 (x86) Application")
-!MESSAGE "ApacheMonitor - Win32 Debug" (based on "Win32 (x86) Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "ApacheMonitor - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\ApacheMonitor.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\ApacheMonitor.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\ApacheMonitor.obj"
- -@erase "$(INTDIR)\ApacheMonitor.res"
- -@erase "$(INTDIR)\ApacheMonitor_src.idb"
- -@erase "$(INTDIR)\ApacheMonitor_src.pdb"
- -@erase "$(OUTDIR)\ApacheMonitor.exe"
- -@erase "$(OUTDIR)\ApacheMonitor.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../../include" /I "../../srclib/apr/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ApacheMonitor_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-MTL=midl.exe
-MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ApacheMonitor.res" /i "../../include" /i "../../srclib/apr/include" /d "NDEBUG" /d "APP_FILE"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\ApacheMonitor.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib wtsapi32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\ApacheMonitor.pdb" /debug /out:"$(OUTDIR)\ApacheMonitor.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\ApacheMonitor.obj" \
- "$(INTDIR)\ApacheMonitor.res" \
- "..\..\srclib\apr\LibR\apr-1.lib" \
- "..\..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\ApacheMonitor.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\ApacheMonitor.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\ApacheMonitor.exe"
- if exist .\Release\ApacheMonitor.exe.manifest mt.exe -manifest .\Release\ApacheMonitor.exe.manifest -outputresource:.\Release\ApacheMonitor.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\ApacheMonitor.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\ApacheMonitor.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\ApacheMonitor.obj"
- -@erase "$(INTDIR)\ApacheMonitor.res"
- -@erase "$(INTDIR)\ApacheMonitor_src.idb"
- -@erase "$(INTDIR)\ApacheMonitor_src.pdb"
- -@erase "$(OUTDIR)\ApacheMonitor.exe"
- -@erase "$(OUTDIR)\ApacheMonitor.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Gm /Zi /Od /I "../../include" /I "../../srclib/apr/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ApacheMonitor_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-MTL=midl.exe
-MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ApacheMonitor.res" /i "../../include" /i "../../srclib/apr/include" /d "_DEBUG" /d "APP_FILE"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\ApacheMonitor.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib wtsapi32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\ApacheMonitor.pdb" /debug /out:"$(OUTDIR)\ApacheMonitor.exe"
-LINK32_OBJS= \
- "$(INTDIR)\ApacheMonitor.obj" \
- "$(INTDIR)\ApacheMonitor.res" \
- "..\..\srclib\apr\LibD\apr-1.lib" \
- "..\..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\ApacheMonitor.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\ApacheMonitor.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\ApacheMonitor.exe"
- if exist .\Debug\ApacheMonitor.exe.manifest mt.exe -manifest .\Debug\ApacheMonitor.exe.manifest -outputresource:.\Debug\ApacheMonitor.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("ApacheMonitor.dep")
-!INCLUDE "ApacheMonitor.dep"
-!ELSE
-!MESSAGE Warning: cannot find "ApacheMonitor.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "ApacheMonitor - Win32 Release" || "$(CFG)" == "ApacheMonitor - Win32 Debug"
-
-!IF "$(CFG)" == "ApacheMonitor - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support\win32"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support\win32"
-
-!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support\win32"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support\win32"
-
-!ENDIF
-
-!IF "$(CFG)" == "ApacheMonitor - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support\win32"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support\win32"
-
-!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support\win32"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support\win32"
-
-!ENDIF
-
-SOURCE=.\ApacheMonitor.c
-
-"$(INTDIR)\ApacheMonitor.obj" : $(SOURCE) "$(INTDIR)"
-
-
-SOURCE=.\ApacheMonitor.rc
-
-"$(INTDIR)\ApacheMonitor.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) $(RSC_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/support/win32/ApacheMonitor.manifest b/support/win32/ApacheMonitor.manifest
new file mode 100644
index 00000000..94860b0b
--- /dev/null
+++ b/support/win32/ApacheMonitor.manifest
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity version="3.1.0.0" processorArchitecture="*" name="Apache.ApacheMonitor" type="win32" />
+<description>Apache Service Monitor</description>
+<dependency>
+<dependentAssembly>
+<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />
+</dependentAssembly>
+</dependency>
+</assembly>
diff --git a/support/win32/ApacheMonitor.rc b/support/win32/ApacheMonitor.rc
index 4e44a293..d4203bf9 100644
--- a/support/win32/ApacheMonitor.rc
+++ b/support/win32/ApacheMonitor.rc
@@ -19,7 +19,6 @@
#include "ApacheMonitor.h"
#define LONG_NAME Apache HTTP Server Monitor
-#define BIN_NAME ApacheMonitor.exe
#include "../../build/win32/httpd.rc"
@@ -27,29 +26,29 @@
IDI_APSRVMON ICON DISCARDABLE "ApacheMonitor.ico"
IDI_ICOSTOP ICON DISCARDABLE "apstop.ico"
IDI_ICORUN ICON DISCARDABLE "aprun.ico"
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "ApacheMonitor.manifest"
-IDD_DLGSERVICES DIALOGEX 0, 0, 350, 188
+IDD_DLGSERVICES DIALOGEX 0, 0, 350, 192
STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_MINIMIZEBOX | WS_VISIBLE |
WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Apache Service Monitor"
FONT 8, "MS Sans Serif"
BEGIN
- DEFPUSHBUTTON "&OK",IDOK,298,49,50,14
+ PUSHBUTTON "OK",IDCANCEL,298,161,50,14
+ CONTROL IDB_BMPHEADER,IDC_STATIC,"Static",SS_BITMAP,0,0,349,38
LTEXT "Service St&atus :",IDC_SSTATUS,3,40,272,8
LISTBOX IDL_SERVICES,2,49,285,73,LBS_OWNERDRAWFIXED |
LBS_HASSTRINGS | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT |
LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
LISTBOX IDL_STDOUT,2,124,285,51,LBS_NOINTEGRALHEIGHT |
LBS_DISABLENOSCROLL | LBS_NOSEL | WS_VSCROLL
- PUSHBUTTON "&Start",IDC_SSTART,298,65,50,14
- PUSHBUTTON "S&top",IDC_SSTOP,298,81,50,14
- PUSHBUTTON "&Restart",IDC_SRESTART,298,97,50,14
- PUSHBUTTON "Ser&vices",IDC_SMANAGER,298,113,50,14
- CONTROL IDB_BMPHEADER,IDC_STATIC,"Static",SS_BITMAP,0,0,349,38
- PUSHBUTTON "&Connect",IDC_SCONNECT,298,129,50,14
- PUSHBUTTON "&Disconnect",IDC_SDISCONN,298,145,50,14
- PUSHBUTTON "E&xit",IDC_SEXIT,298,161,50,14
+ PUSHBUTTON "&Start",IDC_SSTART,298,49,50,14
+ PUSHBUTTON "S&top",IDC_SSTOP,298,65,50,14
+ PUSHBUTTON "&Restart",IDC_SRESTART,298,81,50,14
+ PUSHBUTTON "Ser&vices",IDC_SMANAGER,298,97,50,14
+ PUSHBUTTON "&Connect",IDC_SCONNECT,298,113,50,14
+ PUSHBUTTON "&Disconnect",IDC_SDISCONN,298,129,50,14
END
IDD_DLGCONNECT DIALOGEX 0, 0, 240, 54
@@ -87,6 +86,7 @@ BEGIN
IDS_MSG_MNUSERVICES "Open &Services"
IDS_MSG_MNUSHOW "&Open Apache Monitor"
IDS_MSG_MNUEXIT "E&xit"
+ IDS_MSG_OK "OK"
IDS_MSG_SRVSTART "The %s service is starting."
IDS_MSG_SRVSTARTED "The %s service has started."
IDS_MSG_SRVSTOP "The %s service is stopping."
diff --git a/support/win32/wintty.dep b/support/win32/wintty.dep
deleted file mode 100644
index 8f574096..00000000
--- a/support/win32/wintty.dep
+++ /dev/null
@@ -1,5 +0,0 @@
-# Microsoft Developer Studio Generated Dependency File, included by wintty.mak
-
-..\..\build\win32\httpd.rc : \
- "..\..\include\ap_release.h"\
-
diff --git a/support/win32/wintty.mak b/support/win32/wintty.mak
deleted file mode 100644
index b2612b00..00000000
--- a/support/win32/wintty.mak
+++ /dev/null
@@ -1,317 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on wintty.dsp
-!IF "$(CFG)" == ""
-CFG=wintty - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to wintty - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "wintty - Win32 Release" && "$(CFG)" != "wintty - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "wintty.mak" CFG="wintty - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "wintty - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "wintty - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "wintty - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\wintty.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\wintty.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\wintty.obj"
- -@erase "$(INTDIR)\wintty.res"
- -@erase "$(INTDIR)\wintty_src.idb"
- -@erase "$(INTDIR)\wintty_src.pdb"
- -@erase "$(OUTDIR)\wintty.exe"
- -@erase "$(OUTDIR)\wintty.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\wintty_src" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\wintty.res" /i "../../include" /i "../../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\wintty.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\wintty.pdb" /debug /out:"$(OUTDIR)\wintty.exe" /opt:ref
-LINK32_OBJS= \
- "$(INTDIR)\wintty.obj" \
- "$(INTDIR)\wintty.res" \
- "..\..\srclib\apr\LibR\apr-1.lib" \
- "..\..\srclib\apr-util\LibR\aprutil-1.lib"
-
-"$(OUTDIR)\wintty.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Release\wintty.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Release
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\wintty.exe"
- if exist .\Release\wintty.exe.manifest mt.exe -manifest .\Release\wintty.exe.manifest -outputresource:.\Release\wintty.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\wintty.exe" "$(DS_POSTBUILD_DEP)"
-
-!ELSE
-
-ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\wintty.exe" "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-!IF "$(RECURSE)" == "1"
-CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
-!ELSE
-CLEAN :
-!ENDIF
- -@erase "$(INTDIR)\wintty.obj"
- -@erase "$(INTDIR)\wintty.res"
- -@erase "$(INTDIR)\wintty_src.idb"
- -@erase "$(INTDIR)\wintty_src.pdb"
- -@erase "$(OUTDIR)\wintty.exe"
- -@erase "$(OUTDIR)\wintty.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\wintty_src" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\wintty.res" /i "../../include" /i "../../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe"
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\wintty.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\wintty.pdb" /debug /out:"$(OUTDIR)\wintty.exe"
-LINK32_OBJS= \
- "$(INTDIR)\wintty.obj" \
- "$(INTDIR)\wintty.res" \
- "..\..\srclib\apr\LibD\apr-1.lib" \
- "..\..\srclib\apr-util\LibD\aprutil-1.lib"
-
-"$(OUTDIR)\wintty.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-TargetPath=.\Debug\wintty.exe
-SOURCE="$(InputPath)"
-PostBuild_Desc=Embed .manifest
-DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
-
-# Begin Custom Macros
-OutDir=.\Debug
-# End Custom Macros
-
-"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\wintty.exe"
- if exist .\Debug\wintty.exe.manifest mt.exe -manifest .\Debug\wintty.exe.manifest -outputresource:.\Debug\wintty.exe;1
- echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("wintty.dep")
-!INCLUDE "wintty.dep"
-!ELSE
-!MESSAGE Warning: cannot find "wintty.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "wintty - Win32 Release" || "$(CFG)" == "wintty - Win32 Debug"
-
-!IF "$(CFG)" == "wintty - Win32 Release"
-
-"apr - Win32 Release" :
- cd ".\..\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
- cd "..\..\support\win32"
-
-"apr - Win32 ReleaseCLEAN" :
- cd ".\..\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support\win32"
-
-!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
-
-"apr - Win32 Debug" :
- cd ".\..\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
- cd "..\..\support\win32"
-
-"apr - Win32 DebugCLEAN" :
- cd ".\..\..\srclib\apr"
- $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support\win32"
-
-!ENDIF
-
-!IF "$(CFG)" == "wintty - Win32 Release"
-
-"aprutil - Win32 Release" :
- cd ".\..\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
- cd "..\..\support\win32"
-
-"aprutil - Win32 ReleaseCLEAN" :
- cd ".\..\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
- cd "..\..\support\win32"
-
-!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
-
-"aprutil - Win32 Debug" :
- cd ".\..\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
- cd "..\..\support\win32"
-
-"aprutil - Win32 DebugCLEAN" :
- cd ".\..\..\srclib\apr-util"
- $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
- cd "..\..\support\win32"
-
-!ENDIF
-
-SOURCE=..\..\build\win32\httpd.rc
-
-!IF "$(CFG)" == "wintty - Win32 Release"
-
-
-"$(INTDIR)\wintty.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\wintty.res" /i "../../include" /i "../../srclib/apr/include" /i ".\..\..\build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe" $(SOURCE)
-
-
-!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
-
-
-"$(INTDIR)\wintty.res" : $(SOURCE) "$(INTDIR)"
- $(RSC) /l 0x409 /fo"$(INTDIR)\wintty.res" /i "../../include" /i "../../srclib/apr/include" /i ".\..\..\build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe" $(SOURCE)
-
-
-!ENDIF
-
-SOURCE=.\wintty.c
-
-"$(INTDIR)\wintty.obj" : $(SOURCE) "$(INTDIR)"
-
-
-
-!ENDIF
-