mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
afsweb: remove unsupported afsweb component
The afsweb component is marked as obsolete. The last substantial change other than global changes was in 2002 to add build support for netscape (afsweb-add-netscape-config-script-20020213 0e04c507b). The documentation and build configuration implies support for Apache 1.3.6 which was released in 1999; and the Apache 1.3 series as a whole was EOL in 2010. By default the afsweb component isn't built. Clean out the source and references for the afsweb component (src/afsweb). Change-Id: Ibb3f91260d4e8d703619fafbad70cd3f7e4da7bc Reviewed-on: https://gerrit.openafs.org/14849 Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
parent
cbfdf1ed97
commit
2856a350d0
@ -506,9 +506,6 @@ libuafs: libuafs_setup vlserver_depinstall tvlserver_depinstall rx_depinstall \
|
||||
${COMPILE_PART1} libuafs ${COMPILE_PART2} ;; \
|
||||
esac
|
||||
|
||||
afsweb: kauth
|
||||
+${COMPILE_PART1} afsweb ${COMPILE_PART2}
|
||||
|
||||
update: cmd comerr auth sys
|
||||
+${COMPILE_PART1} update ${COMPILE_PART2}
|
||||
|
||||
@ -717,7 +714,6 @@ clean2:
|
||||
-${COMPILE_PART1} tsm41 ${COMPILE_CLEAN}
|
||||
-${COMPILE_PART1} aklog ${COMPILE_CLEAN}
|
||||
-${COMPILE_PART1} pam ${COMPILE_CLEAN}
|
||||
-${COMPILE_PART1} afsweb ${COMPILE_CLEAN}
|
||||
-${COMPILE_PART1} update ${COMPILE_CLEAN}
|
||||
-${COMPILE_PART1} log ${COMPILE_CLEAN}
|
||||
-${COMPILE_PART1} bu_utils ${COMPILE_CLEAN}
|
||||
@ -790,7 +786,6 @@ distclean: clean
|
||||
src/afs/Makefile \
|
||||
src/afsd/Makefile \
|
||||
src/afsmonitor/Makefile \
|
||||
src/afsweb/Makefile \
|
||||
src/aklog/Makefile \
|
||||
src/audit/Makefile \
|
||||
src/auth/Makefile \
|
||||
|
@ -59,7 +59,6 @@ AC_CONFIG_FILES([
|
||||
src/afs/Makefile
|
||||
src/afsd/Makefile
|
||||
src/afsmonitor/Makefile
|
||||
src/afsweb/Makefile
|
||||
src/aklog/Makefile
|
||||
src/audit/Makefile
|
||||
src/auth/Makefile
|
||||
|
@ -166,7 +166,6 @@ longer actively maintained.
|
||||
|
||||
| directory | description |
|
||||
| --------- | ----------- |
|
||||
| afsweb | Authenticated AFS access for older versions of Apache |
|
||||
| kauth | Obsolete Kerberos-4 server (`kaserver`) and related programs |
|
||||
| log | Obsolete programs to show and forget Kerberos-4 tokens |
|
||||
| lwp | Lightweight user-level non-preemptive cooperative threading library |
|
||||
|
@ -1,240 +0,0 @@
|
||||
# Copyright 2000, International Business Machines Corporation and others.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# This software has been released under the terms of the IBM Public
|
||||
# License. For details, see the LICENSE file in the top-level source
|
||||
# directory or online at http://www.openafs.org/dl/license10.html
|
||||
|
||||
srcdir=@srcdir@
|
||||
include @TOP_OBJDIR@/src/config/Makefile.config
|
||||
include @TOP_OBJDIR@/src/config/Makefile.lwp
|
||||
|
||||
|
||||
|
||||
|
||||
UKSRCS=nsafs.h nsafs.c securehash.c
|
||||
|
||||
#
|
||||
# Targets for Apache AFS Web Secure
|
||||
#
|
||||
APACHE_AFS_LIB=libapacheafs.a
|
||||
APACHE_AFS_COMMON_LIB=libcommon.a
|
||||
|
||||
BINARIES=weblog weblog_starter
|
||||
SRC_MODULE=afs_module.c
|
||||
## This module is made compatible with Apache 1.3.1 by including a file called
|
||||
## ap_compat.h provided by Apache (basically all they do is #define all the old API calls
|
||||
## as the new ones with ap_ prepended to the old API calls. The makefile takes care of this
|
||||
## while building afs_module.c and adding the AFS_component_version_number.c file's contents
|
||||
## in comments.
|
||||
|
||||
APACHEAFS_DOC=README
|
||||
APACHE_INSTALL_SCRIPT=afswsApache_config.sh
|
||||
NETSCAPE_INSTALL_SCRIPT=afswsNetscape_config.sh
|
||||
|
||||
system apache_afs_web_secure:
|
||||
case "${SYS_NAME}" in \
|
||||
rs_aix* ) \
|
||||
echo Clean, make, and install the lib for 1.2 ; \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_CFLAGS=-DAIX $(APACHE_AFS_LIB) ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.2 ; \
|
||||
${INSTALL_DATA} ${APACHE_AFS_LIB} ${DEST}/root.afsweb/lib/apache_1.2/${APACHE_AFS_LIB} ; \
|
||||
echo Make and install source for 1.2 ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG=-DAPACHE_1_2 ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.2 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.2/$(SRC_MODULE) ; \
|
||||
echo Make and install the lib for 1.3.1 ; \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_CFLAGS=-DAIX $(APACHE_AFS_LIB) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_1" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.3.1 ; \
|
||||
${INSTALL_DATA} $(APACHE_AFS_LIB) ${DEST}/root.afsweb/lib/apache_1.3.1/$(APACHE_AFS_LIB) ; \
|
||||
echo Make and install source for 1.3.1 ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_1" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.3.1 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.3.1/$(SRC_MODULE) ; \
|
||||
echo Clean, make, and install the lib for 1.3.6 ; \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_CFLAGS=-DAIX $(APACHE_AFS_LIB) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_6"; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.3.6 ; \
|
||||
${INSTALL_DATA} $(APACHE_AFS_LIB) ${DEST}/root.afsweb/lib/apache_1.3.6/$(APACHE_AFS_LIB) ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
echo Make and install source for 1.3.1 ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_6" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.3.6 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.3.6 ; \
|
||||
echo Do the binaries ; \
|
||||
$(MAKE) AUX_CFLAGS=-DAIX $(BINARIES) ;; \
|
||||
sun*) \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_FLAGS=-DSOLARIS $(APACHE_AFS_LIB) ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.2 ; \
|
||||
${INSTALL_DATA} $(APACHE_AFS_LIB) ${DEST}/root.afsweb/lib/apache_1.2/$(APACHE_AFS_LIB) ; \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_FLAGS=-DSOLARIS $(APACHE_AFS_LIB) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_1" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.3.1 ; \
|
||||
${INSTALL_DATA} $(APACHE_AFS_LIB) ${DEST}/root.afsweb/lib/apache_1.3.1/$(APACHE_AFS_LIB) ; \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_FLAGS=-DSOLARIS $(APACHE_AFS_LIB) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_6" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.3.6 ; \
|
||||
${INSTALL_DATA} $(APACHE_AFS_LIB) ${DEST}/root.afsweb/lib/apache_1.3.6/$(APACHE_AFS_LIB) ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG=-DAPACHE_1_2 ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.2 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.2/$(SRC_MODULE) ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_1" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.3.1 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.3.1/$(SRC_MODULE) ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_6" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.3.6 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.3.6/$(SRC_MODULE) ; \
|
||||
$(MAKE) AUX_CFLAGS=-DSOLARIS "XLIBS=-lsocket -lnsl" $(BINARIES) ;; \
|
||||
*linux*) \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_FLAGS=-DLINUX $(APACHE_AFS_LIB) ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.2 ; \
|
||||
${INSTALL_DATA} $(APACHE_AFS_LIB) ${DEST}/root.afsweb/lib/apache_1.2/$(APACHE_AFS_LIB) ; \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_FLAGS=-DLINUX $(APACHE_AFS_LIB) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_1" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.3.1 ; \
|
||||
${INSTALL_DATA} $(APACHE_AFS_LIB) ${DEST}/root.afsweb/lib/apache_1.3.1/$(APACHE_AFS_LIB) ; \
|
||||
$(MAKE) libclean ; \
|
||||
$(MAKE) AUX_FLAGS=-DLINUX $(APACHE_AFS_LIB) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_6" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/lib/apache_1.3.6 ; \
|
||||
${INSTALL_DATA} $(APACHE_AFS_LIB) ${DEST}/root.afsweb/lib/apache_1.3.6/$(APACHE_AFS_LIB) ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG=-DAPACHE_1_2 ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.2 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.2/$(SRC_MODULE) ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_1" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.3.1 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.3.1/$(SRC_MODULE) ; \
|
||||
/bin/rm -f $(SRC_MODULE) ; \
|
||||
$(MAKE) $(SRC_MODULE) VERSION_CFLAG="-DAPACHE_1_3 -DAPACHE_1_3_6" ; \
|
||||
${INSTALL} -d ${DEST}/root.afsweb/src/apache_1.3.6 ; \
|
||||
${INSTALL_DATA} $(SRC_MODULE) ${DEST}/root.afsweb/src/apache_1.3.6/$(SRC_MODULE) ; \
|
||||
$(MAKE) AUX_CFLAGS=-DLINUX "XLIBS=-lnsl" $(BINARIES) ;; \
|
||||
* ) \
|
||||
echo "NOT BUILT FOR ${SYS_NAME}"; ;; \
|
||||
esac
|
||||
${INSTALL} -d ${DEST}/root.afsweb/doc
|
||||
${INSTALL_DATA} ${APACHEAFS_DOC} ${DEST}/root.afsweb/doc/${APACHEAFS_DOC}
|
||||
${INSTALL} -d ${DEST}/root.afsweb/install
|
||||
${INSTALL_SCRIPT} ${APACHE_INSTALL_SCRIPT} ${DEST}/root.afsweb/install/${APACHE_INSTALL_SCRIPT}
|
||||
${INSTALL} -d ${DEST}/root.afsweb/bin
|
||||
${INSTALL_PROGRAM} $(BINARIES) ${DEST}/root.afsweb/bin
|
||||
|
||||
netscape_afs_web_secure:
|
||||
${INSTALL} -d ${DEST}/root.afsweb/install
|
||||
${INSTALL} -m 755 ${NETSCAPE_INSTALL_SCRIPT} ${DEST}/root.afsweb/install
|
||||
|
||||
all:
|
||||
|
||||
install:
|
||||
|
||||
##
|
||||
## For Apache Afs Web Secure libraries and binaries
|
||||
## NOTE: APACHE_INCLUDES should point to the Apache src directory where
|
||||
## httpd.h and all it's included files reside which right now is src/afsweb/include
|
||||
## and we have Apache versions as subdirectories but these are taken care of by the
|
||||
## code. Be sure to compile with the VERSION_CFLAG=-DAPACHE_1_3 option for Apache 1.3
|
||||
##
|
||||
APACHE_INCLUDES=-Iapache_includes
|
||||
|
||||
XLIBS=
|
||||
DEFINES=-DSTATUS
|
||||
OPTF=
|
||||
DEBUG_FLAG=
|
||||
AUX_CFLAGS=
|
||||
VERSION_CFLAG=
|
||||
AFS_INCL=-I${TOP_INCDIR} -I.. -I../config
|
||||
XCFLAGS= $(CFLAGS) $(OPTF) $(DEFINES) -I. -I.. $(VERSION_CFLAG) $(DEBUG_FLAG)
|
||||
INCLS=${TOP_INCDIR}/ubik.h \
|
||||
${TOP_INCDIR}/lwp.h \
|
||||
${TOP_INCDIR}/lock.h \
|
||||
${TOP_INCDIR}/rx/rx.h \
|
||||
${TOP_INCDIR}/rx/xdr.h \
|
||||
${TOP_INCDIR}/rx/rxkad.h \
|
||||
${TOP_INCDIR}/afs/com_err.h \
|
||||
weblog_errors.h $(DCE_DLOG_INCLUDES)
|
||||
deslib=${TOP_LIBDIR}/libdes.a
|
||||
rxkadlib=${TOP_LIBDIR}/librxkad.a
|
||||
authlib=${TOP_LIBDIR}/libauth.a
|
||||
cmdlib=${TOP_LIBDIR}/libcmd.a
|
||||
utilib=${TOP_LIBDIR}/util.a
|
||||
kauthlib=${TOP_LIBDIR}/libkauth.a
|
||||
|
||||
LIBS=${kauthlib} ${TOP_LIBDIR}/libubik.a ${TOP_LIBDIR}/libprot.a \
|
||||
${authlib} ${rxkadlib} ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/librx.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/liblwp.a ${deslib} ${cmdlib} \
|
||||
${TOP_LIBDIR}/libafscom_err.a ${utilib} \
|
||||
$(DBM) $(XLIBS)
|
||||
|
||||
AR=ar
|
||||
ARFLAGS=rv
|
||||
LIBCOMMON_OBJS=apache_afs_utils.o apache_afs_cache.o
|
||||
LIBAPACHE_OBJS=apache_afs_client.o apache_afs_plugin.o
|
||||
LIBOBJS=$(LIBCOMMON_OBJS) $(LIBAPACHE_OBJS)
|
||||
OBJS=$(LIBOBJS) apache_afs_weblog.o weblog.o
|
||||
|
||||
.c.o:
|
||||
$(CCOBJ) -c $(XCFLAGS) $(AFS_INCL) $(AUX_CFLAGS) $<
|
||||
%.o: %.c
|
||||
$(CCOBJ) -c $(XCFLAGS) $(AFS_INCL) $(AUX_CFLAGS) $<
|
||||
|
||||
weblog: weblog.o $(APACHE_AFS_COMMON_LIB)
|
||||
$(CC) -o $@ weblog.o $(APACHE_AFS_COMMON_LIB) $(LIBS) $(XLIBS)
|
||||
|
||||
weblog_starter: apache_afs_weblog.o weblog_errors.h
|
||||
$(CC) -o $@ apache_afs_weblog.o
|
||||
|
||||
$(APACHE_AFS_COMMON_LIB):$(LIBCOMMON_OBJS)
|
||||
- /bin/rm -f $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBCOMMON_OBJS)
|
||||
|
||||
$(APACHE_AFS_LIB): $(LIBOBJS) AFS_component_version_number.o
|
||||
- /bin/rm -f $@
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
|
||||
afs_module.c: apache_afs_module.c
|
||||
-/bin/rm -f afs_module.c \
|
||||
; echo "/*" > afs_module.c \
|
||||
; cat AFS_component_version_number.c >> afs_module.c \
|
||||
; echo "*/" >> afs_module.c \
|
||||
; case "${VERSION_CFLAG}" in \
|
||||
-DAPACHE_1_3*) echo '#include "ap_compat.h"' >> afs_module.c ;; \
|
||||
esac \
|
||||
; cat apache_afs_module.c >> afs_module.c
|
||||
|
||||
##
|
||||
##Dependencies
|
||||
##
|
||||
|
||||
$(OBJS): Makefile
|
||||
|
||||
apache_afs_weblog.o: apache_afs_weblog.c weblog_errors.h AFS_component_version_number.o
|
||||
apache_afs_utils.o: apache_afs_utils.c apache_afs_utils.h
|
||||
apache_afs_cache.o: apache_afs_cache.c apache_afs_cache.h
|
||||
weblog.o: weblog.c weblog_errors.h $(APACHE_AFS_COMMON_LIB)
|
||||
apache_afs_client.o: apache_api.h apache_afs_client.c apache_afs_utils.o apache_afs_cache.o AFS_component_version_number.o
|
||||
$(CC) -c $(XCFLAGS) $(AFS_INCL) $(APACHE_INCLUDES) $(AUX_CFLAGS) apache_afs_client.c
|
||||
apache_afs_plugin.o: apache_api.h apache_afs_plugin.c apache_afs_client.o apache_afs_utils.o apache_afs_cache.o
|
||||
$(CC) -c $(XCFLAGS) $(APACHE_INCLUDES) $(AUX_CFLAGS) apache_afs_plugin.c
|
||||
|
||||
|
||||
clean:
|
||||
-/bin/rm -f *.o $(BINARIES) $(APACHE_AFS_LIB) $(APACHE_AFS_COMMON_LIB)
|
||||
|
||||
libclean:
|
||||
-/bin/rm -f $(APACHE_AFS_LIB) $(LIBOBJS)
|
||||
|
||||
include ../config/Makefile.version
|
||||
|
||||
dest:
|
||||
|
@ -1,79 +0,0 @@
|
||||
Copyright 2000, International Business Machines Corporation and others.
|
||||
All Rights Reserved.
|
||||
|
||||
This software has been released under the terms of the IBM Public
|
||||
License. For details, see the LICENSE file in the top-level source
|
||||
directory or online at http://www.openafs.org/dl/license10.html
|
||||
|
||||
AFS Web Security Pack for the Apache Web Server, Version 1.0
|
||||
|
||||
|
||||
Release Notes
|
||||
|
||||
I. Introduction
|
||||
|
||||
The AFS Web Security Pack is an extension available for selected Web servers
|
||||
that enables system administrators to provide secure access via a
|
||||
Web browser to documents stored in the AFS filespace. This document
|
||||
provides information specific to this release of the AFS Web Security Pack.
|
||||
|
||||
Note: Due the long filenames and file extensions used for the AFS Web
|
||||
Secure distribution files, download of the AFS Web Secure product to
|
||||
a PC sometimes results in incorrect filenames. Note that all AFS Web
|
||||
Secure distribution files are g-zipped tar files, even if the *.tar.gz
|
||||
file extension is lost during the download process.
|
||||
|
||||
II. Installation Prerequisites
|
||||
|
||||
Note: If you have installed a previous version of the AFS Web Security Pack,
|
||||
you must first remove the previous version, including any modifications made
|
||||
to your Apache Web server configuration and runtime configuration files
|
||||
before installing this version of the product.
|
||||
|
||||
Your system must meet the following software and disk space requirements
|
||||
to install this version of the AFS Web Security Pack.
|
||||
|
||||
Operating system: Solaris 2.5.1, AIX 4.2x, AIX 4.3, or AIX 4.3.1
|
||||
Web server: Apache 1.2.6 or Apache 1.3.1
|
||||
AFS (client): AFS Client 3.4a
|
||||
Disk Space: 650 KB
|
||||
|
||||
Note: Due to security considerations, OpenAFS strongly recommends that the
|
||||
AFS Web Security Pack be used only on a server enabled with Secure Sockets
|
||||
Layer (SSL).
|
||||
|
||||
|
||||
IV. Known Defects and Limitations
|
||||
|
||||
* Due to a preexisting problem in the AFS UNIX product, the Apache
|
||||
server Fancy Indexing option does not function as expected when AFS
|
||||
directories are displayed. If the Fancy Indexing option is enabled
|
||||
on the Apache server, when a user initially browses an ACL-protected
|
||||
directory (with "system:anyuser l" access), the user is able to see
|
||||
file details for directories and links, but not for files. Once the
|
||||
user selects a file and enters a username and password, details for
|
||||
the files are then displayed. This problem is not caused by the AFS Web
|
||||
Security Pack or the Apache server, but is due to a defect in the UNIX-based
|
||||
AFS code. We are working to address this problem and will make an
|
||||
announcement when a corrected version is available. In the interim,
|
||||
please be aware of this limitation as you use the AFS Web Security Pack.
|
||||
|
||||
*If the AFS Web Security Pack is used on the Apache server version 1.3.1, user
|
||||
directories cannot be directly accessed through the use of a special character
|
||||
such as a tilde (~) despite use of the Apache server User Directory directive.
|
||||
|
||||
VII. AFS Web Security Pack Documentation
|
||||
|
||||
Postscript and HTML versions of the documentation for the AFS Web Security
|
||||
Pack are available in the doc directory.
|
||||
|
||||
VIII. Additional Information about Apache and SSL
|
||||
|
||||
The following sites on the World Wide Web provide additional information
|
||||
about the Apache Web Server and SSL.
|
||||
|
||||
* Apache Home Page http://www.apache.org
|
||||
* Stronghold Home http://www.c2.net
|
||||
* Stronghold International http://www.int.c2.net
|
||||
* Apache-SSL Home http://www.apache-ssl.org
|
||||
* SSLeay FAQ http://www.psy.uq.edu.au:8080/~ftp/Crypto/
|
@ -1,127 +0,0 @@
|
||||
Copyright 2000, International Business Machines Corporation and others.
|
||||
All Rights Reserved.
|
||||
|
||||
This software has been released under the terms of the IBM Public
|
||||
License. For details, see the LICENSE file in the top-level source
|
||||
directory or online at http://www.openafs.org/dl/license10.html
|
||||
|
||||
Installation instructions for Apache AFS Web Secure
|
||||
(Version 1 for Apache version 1.2.6)
|
||||
|
||||
Prerequisites:-
|
||||
|
||||
Ensure the following files exist:-
|
||||
|
||||
- weblog
|
||||
- weblog_starter
|
||||
- libapacheafs.a
|
||||
- mod_afs.c
|
||||
|
||||
In addition to these you should know the location of the AFS library
|
||||
libsys.a
|
||||
|
||||
|
||||
The mod_afs.c file should be in the apache src directory with all the other
|
||||
module files. weblog and weblog_starter should be in the same directory - this
|
||||
could be any directory (preferably outside AFS - if it is in AFS then
|
||||
system:anyuser should have the appropriate ACL on that directory).
|
||||
|
||||
Editing the following files in the apache src and conf directories:-
|
||||
|
||||
1. Configuration (or the current Configuration file)
|
||||
|
||||
EXTRA_LIBS= <whatever you had here before> libapacheafs.a libsys.a
|
||||
|
||||
NOTE - specify the full path of these libraries - libsys.a is probably
|
||||
in /usr/afsws/lib/afs/libsys.a and you can put libapacheafs.a wherever you
|
||||
want.
|
||||
|
||||
At the end of the configuration file where the modules are add
|
||||
|
||||
Module afs_module mod_afs.o
|
||||
|
||||
Optional: if you want the server to attempt to stop completely if AFS
|
||||
initialization fails then add -DSHUTDOWN_IF_AFS_FAILS to the EXTRA_CFLAGS line.
|
||||
Otherwise, on startup if the initialization procedure fails, the apache
|
||||
server will continue running but AFS authentication will always fail.
|
||||
|
||||
2. httpd.conf (or whatever configuration file the server uses on startup
|
||||
with the -f flag)
|
||||
|
||||
NOTE: ensure that you provide the entire path for the ErrorLog and PidFile
|
||||
Directives instead of attempting to have apache prepend ServerRoot.
|
||||
|
||||
See below for an explanation of arguments to these
|
||||
Apache Directives.
|
||||
|
||||
SetAFSDefaultCell [cell]
|
||||
SetAFSMountpointDir [dir]
|
||||
SetAFSCacheExpiration [time]
|
||||
SetAFSTokenExpiration [time]
|
||||
SetAFSWeblogPath [path]
|
||||
SetAFSLocation [loc]
|
||||
|
||||
<Location <loc>>
|
||||
SetHandler afs-Authentication
|
||||
</Location>
|
||||
|
||||
<Directory full path to [dir]>
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
|
||||
NOTE:- SetAFSLocation <text> should be the same as the Location <text>
|
||||
and should be a path relative to the server-document-root
|
||||
|
||||
NOTE: loc and dir should *NOT* be the same. There should be no symbolic link,
|
||||
file or directory in the DocumentRoot directory with the same name as the loc
|
||||
directive.
|
||||
|
||||
cell: REQUIRED directive.
|
||||
Default AFS cell name. This cell will be used unless the user
|
||||
specifies a different cell by using the user@cellname syntax
|
||||
when prompted for a username and password. REQUIRED OPTION.
|
||||
|
||||
dir: REQUIRED directive.
|
||||
Path to the directory or symbolic link relative to the server document
|
||||
root directory where the AFS cell mount points are. If you want symbolic
|
||||
links to be followed make sure you have the
|
||||
Options FollowSymLinks
|
||||
directive set.
|
||||
|
||||
time: OPTIONAL directive
|
||||
Seconds for AFS token cache expiration (cacheExpiration is for the local
|
||||
cache and tokenExpiration is for the AFS kernel cache manager).
|
||||
|
||||
|
||||
path: REQUIRED directive.
|
||||
The full or relative (to server binary) path for weblog binary.
|
||||
|
||||
loc: REQUIRED directive.
|
||||
Some location relative to the server root
|
||||
MAKE SURE THAT THERE DOESN"T ALREADY EXIST A DIRECTORY BY
|
||||
THIS SAME NAME. This should be the same (case sensitive)
|
||||
as the argument to the Location directive. Eg. /afs
|
||||
|
||||
|
||||
Configure and make apache and start it up with the new config file.
|
||||
|
||||
NOTE: Add the following to the shutdown or stopd file to shutdown the
|
||||
weblog_starter process BEFORE the kill -TERM for httpd.pid
|
||||
|
||||
kill -TERM `cat <path to httpd.pid>.afs`
|
||||
|
||||
Eg. if the httpd.pid file is in /local/stronghold/apache/logs/httpd.pid
|
||||
then the stopd file should look something like this
|
||||
|
||||
kill -TERM `cat /local/stronghold/apache/logs/httpd.pid.afs`
|
||||
|
||||
kill -TERM `cat /local/stronghold/apache/logs/httpd.pid`
|
||||
|
||||
|
||||
POINTERS TO APACHE AND SSL:-
|
||||
|
||||
1. Apache Home Page http://www.apache.org
|
||||
2. Stronghold Home: http://www.c2.net International: http://www.int.c2.net
|
||||
3. Apache-SSL Home: http://www.apache-ssl.org
|
||||
4. SSLeay FAQ http://www.psy.uq.edu.au:8080/~ftp/Crypto/
|
||||
|
@ -1,374 +0,0 @@
|
||||
Copyright 2000, International Business Machines Corporation and others.
|
||||
All Rights Reserved.
|
||||
|
||||
This software has been released under the terms of the IBM Public
|
||||
License. For details, see the LICENSE file in the top-level source
|
||||
directory or online at http://www.openafs.org/dl/license10.html
|
||||
|
||||
AFS Web Security Pack Version 1.0 for the Apache Web Server.
|
||||
|
||||
Release Notes
|
||||
|
||||
I. Introduction
|
||||
|
||||
AFS Web Security Pack is an extension available for selected Web servers
|
||||
that enables system administrators to provide secure access via a
|
||||
Web browser to documents stored in the AFS filespace. This document
|
||||
summarizes the changes made to AFS Web Security for this release, and
|
||||
provides installation and configuration instructions.
|
||||
|
||||
Note: Due the long filenames and file extensions used for the AFS Web
|
||||
Security Pack distribution files, download of the AFS Web Security Pack
|
||||
product to a PC sometimes results in incorrect filenames. Note that all
|
||||
AFS Web Security Pack distribution files are g-zipped tar files, even if the
|
||||
*.tar.gz file extension is lost during the download process.
|
||||
|
||||
II. Installation Prerequisites
|
||||
|
||||
Your system must meet the following software and disk space requirements
|
||||
to install this version of AFS Web Security Pack.
|
||||
|
||||
Operating system: Solaris 2.5.1, AIX 4.1, AIX 4.2, or AIX 4.2.1
|
||||
Web server: Apache 1.2.6
|
||||
AFS (client): AFS Client 3.4a
|
||||
Disk Space: 650 KB
|
||||
|
||||
Note: Due to security considerations, OpenAFS strongly recommends that
|
||||
AFS Web Security Pack be used only on a server enabled with Secure
|
||||
Sockets Layer (SSL).
|
||||
|
||||
III. New Features and Product Changes
|
||||
|
||||
The following list describes new features and changes that are included
|
||||
in this version of AFS Web Security Pack.
|
||||
|
||||
* Configuration of AFS Web Security Pack is now easier and more flexible. The
|
||||
AFSMountPointDir and AFSLocation directives are no longer required.
|
||||
Instead, during configuration of AFS Web Security Pack, an authorization type
|
||||
(AFSAuthType) of AFS is now specified. (See the Installation and Configuration
|
||||
instructions that follow for additional details.)
|
||||
|
||||
* The Log In dialog box that is displayed when users attempt to access
|
||||
the AFS file space via a web browser can now be customized adding the
|
||||
AFSLoginPrompt directive to the Apache server runtime configuration
|
||||
file. (See the Installation and Configuration instructions that follow for
|
||||
additional details.)
|
||||
|
||||
|
||||
|
||||
* AFS Web Security Pack now provides the ability to log attempts to
|
||||
access AFS in which permission is denied. This logging can be used to
|
||||
determine if users are attempting to access information that they are not
|
||||
authorized to view. To configure this logging, you must add the
|
||||
SetAFSAccessLog directive to the Apache server runtime configuration file.
|
||||
(See the Installation and Configuration instructions that follow for
|
||||
additional details.)
|
||||
|
||||
* AFS Web Security Pack now provides the ability to translate and access user
|
||||
directories that are specified with a special character such as a tilde (~),
|
||||
for example. http://www.yourcompany.com/~smith. To enable this feature, you
|
||||
must add the User Directory directive to the Apache server runtime
|
||||
configuration file. (See the Installation and Configuration instructions
|
||||
that follow for additional details.)
|
||||
|
||||
* The previous version of AFS Web Security Pack did not correctly permit
|
||||
directory indexing of directories for which a user was assigned lookup
|
||||
permission. In addition, the Parent Link in directory indexes did not
|
||||
always work correctly. This version of AFS Web Security Pack corrects these
|
||||
problems.
|
||||
|
||||
* This version of AFS Web Security Pack corrects a problem with the token cache
|
||||
that occasionally caused access to AFS to be incorrectly denied.
|
||||
|
||||
* The previous version of AFS Web Security Pack did not accept AFS passwords
|
||||
that included a space. This version of AFS Web Security Pack corrects this problem.
|
||||
|
||||
* This version of AFS Web Security Pack corrects a communication (pipe) problem
|
||||
that occasionally caused the message SERVER_ERROR to be returned. In
|
||||
addition, this version improves performance of AFS Web Security Pack.
|
||||
|
||||
IV. Known Defects and Limitations
|
||||
|
||||
* Due to a preexisting problem in the AFS UNIX product, the Apache
|
||||
server Fancy Indexing option does not function as expected when AFS
|
||||
directories are displayed. If the Fancy Indexing option is enabled
|
||||
on the Apache server, when a user initially browses an ACL-protected
|
||||
directory (with "system:anyuser l" access), the user is able to see
|
||||
file details for directories and links, but not for files. Once the
|
||||
user selects a file and enters a username and password, details for
|
||||
the files are then displayed. This problem is not caused by AFS Web
|
||||
Security Pack or the Apache server, but is due to a defect in the UNIX-based
|
||||
AFS code. We are working to address this problem and will make an
|
||||
announcement when a corrected version is available. In the interim,
|
||||
please be aware of this limitation as you continue testing.
|
||||
|
||||
V. Upgrade Instructions for AFS Web Security Pack for the Apache Web Server
|
||||
|
||||
Note: Use the following instructions to upgrade AFS Web Security Pack on
|
||||
your Apache Web Server if Beta Version 1 or Beta Version 2 of the product
|
||||
is already installed. (If this is the first time you are installing AFS Web
|
||||
Security Pack, follow the instructions in the next section, Installing and
|
||||
Configuring AFS Web Security PAck 1.0 for the Apache Web Server.)
|
||||
|
||||
1. Replace the existing versions of the weblog, weblog_starter and
|
||||
libapacheafs.a files with the new files provided with this version
|
||||
of AFS Web Security Pack 1.0. Also, in the Apache src directory,
|
||||
replace the mod_afs.c or afs_module.c file with the new AFS Web Security Pack
|
||||
Module, afs_module.c.
|
||||
|
||||
2. In the Apache server Configuration file, change the line that
|
||||
references the AFS Web Security Pack module so that the line appears as
|
||||
follows:
|
||||
|
||||
Module afs_module afs_module.o
|
||||
|
||||
Note: If you want to enable AFS Web Security Pack to translate and access user
|
||||
home directories, you must include the userdir_module when you build
|
||||
the Apache server. For information on including modules when building
|
||||
the Apache server, consult you Apache server documentation.
|
||||
|
||||
3. In the Apache server src directory, run the Configure script to
|
||||
create a new configuration Makefile for your operating system.
|
||||
|
||||
4. Stop the Apache server process (httpd). Then, issue the make
|
||||
command to compile the Apache server.
|
||||
|
||||
5. In the Apache server runtime configuration file, remove (or comment
|
||||
out) the following two lines:
|
||||
|
||||
SetAFSMountpointDir /afs_mountpoint_directory
|
||||
SetAFSLocation /afs_location
|
||||
|
||||
6. In the Apache server runtime configuration file, replace (or
|
||||
comment out) the SetHandler afs-authentication parameter with the
|
||||
AFSAuthType AFS parameter, so that the Location directive appears as
|
||||
follows:
|
||||
|
||||
<Location /afs>
|
||||
AFSAuthType AFS
|
||||
</Location>
|
||||
|
||||
where /afs is the directory (or symbolic link to the directory)
|
||||
that contains the mount points to AFS to be used by the Apache
|
||||
server and AFS Web Security Pack.
|
||||
|
||||
Note: You can specify AFSAuthType AFS for multiple locations to indicate
|
||||
that AFS Web Security Pack authentication must be used when a user attempts to
|
||||
access a specific location. (In specifying a location, you can use wildcard
|
||||
characters if desired.)
|
||||
|
||||
7. (Optional) To customize the authorization dialog box that is
|
||||
displayed when users attempt to access the AFS file space via a
|
||||
web browser, add the following line within the Location directive:
|
||||
|
||||
AFSLoginPrompt [Custom Text]
|
||||
|
||||
where [Custom Text] is the text that you want to appear in the dialog
|
||||
box that prompts users to enter a user name and password to access AFS
|
||||
filespace.
|
||||
|
||||
8. (Optional) To enable AFS Web Security Pack to access user directories,
|
||||
add the following lines to the Apache server runtime configuration
|
||||
file. This directive specifies the syntax used to access user
|
||||
directories and indicates that attempts to access user directories
|
||||
in the AFS filespace must be passed to AFS Web Security Pack:
|
||||
|
||||
<Location /~*>
|
||||
AFSAuthtype AFS
|
||||
</Location>
|
||||
|
||||
Then, add the following line to the Apache server runtime configuration
|
||||
file to indicate the location of user directories in AFS:
|
||||
|
||||
UserDir [Users Directory]
|
||||
|
||||
where Users Directory indicates the location of user's home directories.
|
||||
|
||||
Note: To enable user directory access in this manner, the Apache Server
|
||||
must include the UserDir module. For information on including this
|
||||
module when building the Apache server, consult you Apache server
|
||||
documentation.
|
||||
|
||||
9. (Optional) To enable logging of attempts to access AFS in which
|
||||
permission is denied, add the SetAFSAccessLog directive to the Apache
|
||||
server runtime configuration file as follows:
|
||||
|
||||
SetAFSAccessLog [Access Log File]
|
||||
|
||||
where [Access Log File] is the full path log file in which failed access
|
||||
attempts are to be recorded.
|
||||
|
||||
10. If necessary, rename the symbolic link to the AFS filespace in the
|
||||
Apache server's document root directory with the name specified in the
|
||||
Location directive for the AFS filespace in the server's runtime
|
||||
configuration file.
|
||||
|
||||
VI. Installing and Configuring AFS Web Security Pack 1.0 for the Apache Web Server
|
||||
|
||||
This section provides brief installation and configuration instructions
|
||||
for Apache AFS Web Security Pack (Version 1.0 for Apache version 1.2.6
|
||||
and Apache version 1.3.1). See the product documentation for complete installation
|
||||
and configuration instructions and for details about using the configuration script to
|
||||
set up AFS Web Security Pack on the Apache server.
|
||||
|
||||
1. Uncompress and extract the files from the .tar.gz file, placing the
|
||||
files in the following locations, where Apache Installation Directory
|
||||
is the full pathname of the directory where the Apache Web server is
|
||||
installed:
|
||||
|
||||
- Place both the weblog and weblog_starter files in one directory,
|
||||
for example, Apache Installation Directory/afswebsecurity. These files
|
||||
can be placed in any directory as long as they remain together. However,
|
||||
if the weblog and weblog_starter files are placed in a directory in AFS,
|
||||
ensure that either the user that the Apache Web server runs as, or the
|
||||
AFS group system:anyuser is designated as having read and lookup privileges
|
||||
on the directory's Access Control List (ACL).
|
||||
|
||||
- Place the libapacheafs.a file in any directory, for example,
|
||||
Apache Installation Directory/afswebsecurity.
|
||||
|
||||
- Place the afs_module.c file in the Apache src directory (Apache version 1.2.6)
|
||||
or in the src/modules/extra directory (Apache version 1.3.1)
|
||||
(generally located directly beneath the Apache Installation Directory).
|
||||
|
||||
In addition, note the location of the AFS library file, libsys.a. This
|
||||
file is installed with the AFS client, and is generally located in the
|
||||
/usr/afsws/lib/afs directory.
|
||||
|
||||
2. Modify the Apache Server Configuration File as follows.
|
||||
|
||||
Locate the EXTRA_LIBS line in the file, and add the paths to the
|
||||
libapacheafs.a and libsys.a libraries so that the line reads as follows:
|
||||
|
||||
EXTRA_LIBS=[full path to libapacheafs.a] [full path to libsys.a]
|
||||
|
||||
In the Module configuration section of the file, add a reference to the
|
||||
AFS Web Security Pack module. It is recommended that the AFS Web Security Pack
|
||||
module be the first Authentication module.
|
||||
To add the AFS module to the list of Apache server modules, add the following line
|
||||
to the Configuration file:
|
||||
|
||||
Module afs_module afs_module.o
|
||||
|
||||
Note: If you want the server to attempt to stop completely if AFS
|
||||
initialization fails, also add -DSHUTDOWN_IF_AFS_FAILS to the
|
||||
EXTRA_CFLAGS line in this file. Otherwise, on startup if the
|
||||
initialization procedure fails on startup, the Apache server
|
||||
will continue to run but AFS authentication will always fail.
|
||||
|
||||
3. Modify the Apache Server Runtime Configuration File (for example,
|
||||
httpd.conf) as follows.
|
||||
|
||||
Add the following lines to the runtime configuration file:
|
||||
|
||||
SetAFSDefault [Cell cellname]
|
||||
SetAFSCacheExpiration [cache_expiration]
|
||||
SetAFSTokenExpiration [token_expiration]
|
||||
SetAFSWeblogPath [weblog_starter_path]
|
||||
|
||||
where the arguments for these Apache server directives are as follows:
|
||||
|
||||
[cellname] - The name of the default AFS cell to be accessed via the
|
||||
Apache server and AFS Web Security Pack.
|
||||
|
||||
[cache_expiration] -The maximum lifetime in seconds of an AFS token
|
||||
that is stored in the local cache. The default recommendation for
|
||||
this argument is 300 seconds (5 minutes).
|
||||
|
||||
[token_expiration] -The maximum lifetime in seconds of an AFS token
|
||||
that is stored in the AFS kernel Cache Manager. The default
|
||||
recommendation for this argument is 60 seconds (1 minute).
|
||||
|
||||
[weblog_starter_path] -The path to the AFS Web Security Pack weblog_starter program.
|
||||
Specify the full path or a path relative to the path set by the ServerRoot Apache
|
||||
directive.
|
||||
|
||||
Note: To enable logging of failed attempts to access AFS in which permission
|
||||
is denied, also add the directive:
|
||||
|
||||
SetAFSAccessLog [Access Log File]
|
||||
|
||||
where [Access Log File] is the full path of the log file in which
|
||||
failed access attempts are to be recorded.
|
||||
|
||||
Then, add the following additional lines to the runtime configuration file:
|
||||
|
||||
<Location /[afs]>
|
||||
AFSAuthType AFS
|
||||
</Location>
|
||||
|
||||
where [afs] is the request provided by users in combination with the
|
||||
server hostname and domain in order to access AFS filespace.
|
||||
|
||||
Note: This directive only works within Location (and LocationMatch for Apache 1.3.1)
|
||||
tags and not in any other tags such as Directory or File.
|
||||
|
||||
Note: You can specify AFSAuthType AFS for multiple locations to indicate
|
||||
that AFS Web Security Pack authentication must be used when a user attempts to
|
||||
access a specific location. (In specifying a location, you can use wildcard
|
||||
characters if desired.)
|
||||
|
||||
(Optional) To customize the authorization dialog box that is displayed
|
||||
when a user attempts to access the AFS file space via a web browser,
|
||||
add the following line to the Location directive added in the previous
|
||||
step. The Location directive then appears as follows:
|
||||
|
||||
AFSLoginPrompt [Custom Text]
|
||||
|
||||
where [Custom Text] is the text that you want to appear in the dialog box
|
||||
that prompts users to enter an AFS user name and password to access the
|
||||
AFS filespace.
|
||||
|
||||
(Optional) To enable AFS Web Security Pack to access user directories, add the
|
||||
following additional Location directive to the Apache server runtime
|
||||
configuration file.
|
||||
|
||||
<Location /~*>
|
||||
AFSAuthType AFS
|
||||
</Location>
|
||||
|
||||
Then, also add the following additional line to the Apache server runtime
|
||||
configuration file to indicate the location of user directories in AFS.
|
||||
|
||||
UserDir [Users Directory]
|
||||
|
||||
where [Users Directory] indicates the location of user's home
|
||||
directories in AFS. The location is specified relative to the
|
||||
server document root directory.
|
||||
|
||||
Note: To enable user directory access in this manner, the Apache
|
||||
server must include the User Dir module.
|
||||
|
||||
Save and close the modified runtime configuration file.
|
||||
|
||||
4. Stop the Apache server process (httpd). Then, configure and make
|
||||
the Apache server and start it up with the new runtime configuration
|
||||
file.
|
||||
|
||||
5. Add the following to the shutdown or stopd file to shutdown the
|
||||
weblog_starter process BEFORE the kill -TERM for httpd.pid:
|
||||
|
||||
kill -TERM `cat [path to httpd.pid].afs`
|
||||
|
||||
For example, if the httpd.pid file is in
|
||||
/local/stronghold/apache/logs/httpd.pid, then the stopd file should
|
||||
look something like this:
|
||||
|
||||
kill -TERM `cat /local/stronghold/apache/logs/httpd.pid.afs`
|
||||
kill -TERM `cat /local/stronghold/apache/logs/httpd.pid`
|
||||
|
||||
VII. AFS Web Security Pack Documentation
|
||||
|
||||
Postscript and HTML versions of the documentation for the initial
|
||||
Beta release AFS Web Security Pack are available in the doc directory.
|
||||
|
||||
VIII. Additional Information about Apache and SSL
|
||||
|
||||
The following sites on the World Wide Web provide additional information
|
||||
about the Apache Web Server and SSL.
|
||||
|
||||
* Apache Home Page http://www.apache.org
|
||||
* Stronghold Home http://www.c2.net
|
||||
* Stronghold International http://www.int.c2.net
|
||||
* Apache-SSL Home http://www.apache-ssl.org
|
||||
* SSLeay FAQ http://www.psy.uq.edu.au:8080/~ftp/Crypto/
|
@ -1,50 +0,0 @@
|
||||
Copyright 2000, International Business Machines Corporation and others.
|
||||
All Rights Reserved.
|
||||
|
||||
This software has been released under the terms of the IBM Public
|
||||
License. For details, see the LICENSE file in the top-level source
|
||||
directory or online at http://www.openafs.org/dl/license10.html
|
||||
|
||||
A very basic document describing some test ideas for AFS Web Secure (Apache)
|
||||
|
||||
1. HTTP tests
|
||||
|
||||
Ensure corect return codes (as per HTTP standards) are being reported for all methods (GET, HEAD, PUT, POST, etc.).
|
||||
|
||||
2. Authentication tests
|
||||
|
||||
Ensure ACL's and return codes match. ie. ensure that if the AFS acl
|
||||
permits access then the return code from the web server reflcts it and vice
|
||||
versa.
|
||||
|
||||
3. Cache consistency tests
|
||||
|
||||
Ensure that the token caches are updated and expiration times checked
|
||||
and expired tokens purged.
|
||||
|
||||
4. PAG tests
|
||||
|
||||
Ensure that each child process for the Apache Server has it's own PAG
|
||||
and authentication credentials for PAG's do not get mixed up.
|
||||
|
||||
5. CGI tests
|
||||
|
||||
Ensure that AFS acls permit or forbid CGI scripts executing.
|
||||
|
||||
6. Locking
|
||||
|
||||
Apache child processes use a shared pipe (synchromized by file locking)
|
||||
for inter process communication with the weblog process. This test would
|
||||
ensure that this communication is indeed synchronized and the request for
|
||||
an AFS token from one child process does indeed allow the token to be returned
|
||||
to that same child process with a unique PAG.
|
||||
|
||||
7. Performance testing
|
||||
|
||||
Memory leaks, speed.
|
||||
|
||||
|
||||
8. Propogate changes (release) from a read-write colume to read-only volumes
|
||||
and ensure the web server gives consistent file updates.
|
||||
|
||||
|
@ -1,138 +0,0 @@
|
||||
Copyright 2000, International Business Machines Corporation and others.
|
||||
All Rights Reserved.
|
||||
|
||||
This software has been released under the terms of the IBM Public
|
||||
License. For details, see the LICENSE file in the top-level source
|
||||
directory or online at http://www.openafs.org/dl/license10.html
|
||||
|
||||
AFS WEB SECURE DESIGN DOCUMENT
|
||||
|
||||
|
||||
Functionality (common to both Servers)
|
||||
|
||||
Any URL beginning with /afs is handled by the plug-in. If a username and
|
||||
password accompanies the request then the plug-in attempts to authenticate
|
||||
the user with AFS and uses that token for serving the request.
|
||||
However in the absense of any Authentication header it attempts to serve
|
||||
the request as it normally would (without the plug-in). If the request
|
||||
returns an OK status, the document is served as is. If it returns HTTP
|
||||
status FORBIDDEN, then the plug-in responds with an AUTHENTICATION_REQUIRED
|
||||
response with a part of the URL giving the /afs/<cell_name> as the part of
|
||||
the WWW-Authenticate header.
|
||||
|
||||
|
||||
Netscape Enterprise Server Plug-in
|
||||
|
||||
The Netscape Server is multithreaded (each incoming HTTP request is
|
||||
handled by a thread). This design led to the requirement of per thread
|
||||
authentication credentials for AFS, (without which there would be one common
|
||||
token for all the threads handling requests for possibly different users).
|
||||
Since the AFS kernel cache manager only provides per process authentication
|
||||
credentials (using Process Authentication Groups or PAG's), the plug-in
|
||||
required a user-space cache manager. Within this user space cache manager
|
||||
a data structure stores the authentication credentials in a manner similar
|
||||
to PAG's (first two bits used). The user space cache manager provides the
|
||||
capability of per thread authentication required for the Netscape Server.
|
||||
|
||||
|
||||
The Netscape Server API provides an initialization routine using which the
|
||||
user space cache manager is started up. Unlike the Apache Server plug-in, the
|
||||
Netscape AFS Web Secure Server does not have to be on an AFS client machine.
|
||||
Configuration files permit the administrator to specify disk cache directories
|
||||
other than that used by any other cache managers. Therefore it is possible
|
||||
to have more than one user space cache manager running on the same machine
|
||||
along with a kernel cache manager.
|
||||
|
||||
The configuration allows the administrator to specify what URL it should
|
||||
look for files in AFS. Tokens for user credentials are obtained and cached
|
||||
in the user-space cache manager, which essentially is a port of the kernel
|
||||
cache manager into user-space.
|
||||
|
||||
|
||||
|
||||
Apache Server Module
|
||||
|
||||
The Apache Server software provides an API for adding modules to the web server
|
||||
and for creating handlers for requests. AFS Web Secure for Apache is built as
|
||||
a standard Apache module (mod_afs.c) along with a library (libapacheafs.a) and
|
||||
two binaries (weblog_starter and weblog).
|
||||
|
||||
The web server is not multithreaded but each request is served by child
|
||||
processes (the number of which is configurable). AFS Authentication requires
|
||||
each child process to communicate with the weblog process over a UNIX pipe
|
||||
(file locking is used to provide exclusive access to the pipe). The child
|
||||
processes send authentication credentials (username, password and cellname)
|
||||
to the weblog process which authenticates the user with AFS using the
|
||||
ka_AuthenticateUserGeneral system call (as in klog). Once an AFS token is
|
||||
obtained it gets the token fro the cache manager using the lpioctl system
|
||||
call and sends the token back to the child process that requested it.
|
||||
Note that since AFS permits one token per cell per PAG, it is essential for
|
||||
each of the child processes to be in a unique PAG. The lsetpag system call
|
||||
is used on startup to ensure each child process and the weblog process
|
||||
belong to a unique PAG. Once the child process obtains the token from the
|
||||
weblog process it sets it using the lpioctl system call to set a token. It
|
||||
can then access files in AFS with the appropriate ACL's.
|
||||
|
||||
Caching of tokens is done at two levels - the weblog process caches all tokens
|
||||
for all user credentials that it recieves from all Apache child processes.
|
||||
Each child process in turn caches the credentials it recieves. Token times
|
||||
are configurable using the SetAFSCacheExpiration directive. The kernel cache
|
||||
manager may cache tokens for the time specified using the SetAFSTokenExpiration
|
||||
directive. This is similar to using klog -lifetime <time>.
|
||||
|
||||
The sequence of events for AFS authentication is :
|
||||
|
||||
On startup the web-server creates two pipes and spawns the weblog_starter
|
||||
process (nanny process to watch over the weblog process and restart it or log
|
||||
an error in case it dies), which in turn starts up the weblog process with
|
||||
the pipes' file descriptors (inherited) as command line parameters.
|
||||
|
||||
Apache Server Process recieves request and hands it to a child process
|
||||
|
||||
Child process checks to see if request should be handled by Web Secure
|
||||
(using a configurable parameter set using the SetAFSLocation directive)
|
||||
|
||||
If Authentication credentials accompany the request, the child process checks
|
||||
its local cache for a matching (username, password, cellname, checksum) token.
|
||||
If one is found it sets the token using lpioctl and attempts to serve the
|
||||
request normally. If no token is found in the local cache, it sends a request
|
||||
to the weblog process over the pipe (again inherited) consisting of a username
|
||||
password and cellname after locking the pipe for exclusive access. The weblog
|
||||
process checks it's own cache or obtains a token after authentication if
|
||||
the cache lookup fails, and sends the token back to the child process which
|
||||
caches it and sets it (lpioctl).
|
||||
|
||||
The child process then serves the document normally.
|
||||
|
||||
All the web server-side communication and system calls are in the
|
||||
libapacheafs.a library, except for the "hook" to plug-in to the apache source
|
||||
which is in mod_afs.c for which the source code must be provided. The library
|
||||
libapacheafs.a consists of the following object files:
|
||||
|
||||
apache_afs_plugin.o - Initialization routines - interface to calls in
|
||||
apache_afs_client.o. Lies in between mod_afs.o and
|
||||
apache_afs_client.o.
|
||||
|
||||
apache_afs_client.o - Apache child process functionality for obtaining
|
||||
the user credentials from the HTTP request, getting
|
||||
and caching AFS tokens, communicating with the weblog
|
||||
process.
|
||||
|
||||
apache_afs_utils.o - wrapper around pioctl and setpag system calls and
|
||||
debugging utilities common to both weblog and apache plug
|
||||
in.
|
||||
|
||||
apache_afs_cache.o - token caching routines common to weblog and apache
|
||||
plug-in
|
||||
|
||||
In order to use the pioctl and setpag system calls the web server binary must
|
||||
link to libsys.a which is usually in /usr/afsws/lib/afs/ on AFS client machines
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,397 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $Header$
|
||||
#
|
||||
# Installation and Configuration script for AFS Web Security Pack
|
||||
#
|
||||
# History:
|
||||
#
|
||||
# 19-Mar-1998 Created. (wvh@transarc.com)
|
||||
#
|
||||
# 06-May-1998 Added tar file stuff and tweaked to add CellServDb
|
||||
# edits, etc.
|
||||
#
|
||||
# The suggested procedure would be to install everything from the CD
|
||||
# (maybe using tar?), and then run the this script.
|
||||
#
|
||||
# Suggested final installation heirarchy would look like:
|
||||
#
|
||||
# /usr/<something>/etc - conf files for AFSWebSecure
|
||||
# /usr/<something>/lib - location of shared library
|
||||
# /usr/<something>/cache - real cache or symlink elsewhere
|
||||
# /usr/<something>/log - log files
|
||||
#
|
||||
##########################################################################
|
||||
#
|
||||
# Actual install script begins here.
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
PRODUCT="AFS Web Security Pack"
|
||||
|
||||
#
|
||||
# Handle various types of failures
|
||||
#
|
||||
trap 'echo "" ; \
|
||||
echo "$PRODUCT Installation cancelled." ; \
|
||||
echo "" ; \
|
||||
exit 1' 1 2 3 6 9 12 13 15 16 17 24 25 29
|
||||
|
||||
rm -f /tmp/newconf
|
||||
|
||||
#
|
||||
# Figure out what OS we're running on so that we try to
|
||||
# exec the right binaries in the script. (The uname
|
||||
# binary lives in the same place on AIX and SunOS
|
||||
# (Solaris) systems, else we'd have to conditionalize
|
||||
# that, too.)
|
||||
#
|
||||
OSTYPE=`/usr/bin/uname | sed -e 's;\([a-zA-Z]*\).*;\1;'`
|
||||
|
||||
if [ x$OSTYPE = "xSunOS" ] ; then
|
||||
HOSTNAME=/usr/ucb/hostname
|
||||
NSLOOKUP=/usr/sbin/nslookup
|
||||
EX=/usr/ucb/ex
|
||||
ECHO=/bin/echo
|
||||
ECHOFLAG="\c"
|
||||
AFSWSLIB=nsafs.so
|
||||
elif [ x$OSTYPE = "xAIX" ] ; then
|
||||
HOSTNAME=/usr/bin/hostname
|
||||
NSLOOKUP=/usr/bin/nslookup
|
||||
EX=/usr/bin/ex
|
||||
ECHO=echo
|
||||
ECHOFLAG=""
|
||||
AFSWSLIB=nsafs.a
|
||||
else
|
||||
$ECHO " ERROR: unsupported OSTYPE \"$OSTYPE\" returned by /usr/bin/uname."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for the existence of the file to install from, and exit
|
||||
# if not in pwd.
|
||||
#
|
||||
if [ ! -f ns_afswebsecure.tar ] ; then
|
||||
$ECHO " File ns_afswebsecure.tar not found in working directory."
|
||||
$ECHO ""
|
||||
exit 1
|
||||
fi
|
||||
#
|
||||
# Find out where the server is installed
|
||||
#
|
||||
$ECHO "Enter the directory where the Web server's bin directory is located [/usr/netscape/suitespot]: " $ECHOFLAG
|
||||
read ws_srvdir
|
||||
if [ x$ws_srvdir = "x" ] ; then
|
||||
ws_srvdir="/usr/netscape/suitespot"
|
||||
fi
|
||||
|
||||
$ECHO ""
|
||||
#
|
||||
# Find out the name of the Web server. Sets three variables for
|
||||
# the hostname: lhn, which is the full host name; shn, which is
|
||||
# the short (non-domain) host name; and dhn, which is the domain
|
||||
# name. This uses nslookup, since we can't depend on the host
|
||||
# actually being in /etc/hosts due to DNS and YP.
|
||||
#
|
||||
tmp=`$HOSTNAME`
|
||||
lhn=`$NSLOOKUP $tmp | grep Name: | sed -e 's;Name:[ ]*;;'`
|
||||
shn=`echo $lhn | sed -e 's;\([-_a-zA-Z0-9]*\).*;\1;'`
|
||||
dhn=`echo $lhn | sed -e "s;$shn\.;;"`
|
||||
|
||||
# echo ""
|
||||
# echo "Long host name is $lhn."
|
||||
# echo "Short host name is $shn."
|
||||
# echo "Domain name is $dhn."
|
||||
# echo ""
|
||||
|
||||
$ECHO "Enter the Web server to use to access AFS data [$shn]: " $ECHOFLAG
|
||||
read ws_wsname
|
||||
case $ws_wsname in
|
||||
'') ;;
|
||||
*) shn=$ws_wsname;;
|
||||
esac
|
||||
|
||||
ws_conf=$ws_srvdir"/https-"$shn"/config/obj.conf"
|
||||
|
||||
if [ ! -f $ws_conf ] ; then
|
||||
$ECHO " ERROR: server config file \"$ws_conf\" not found."
|
||||
exit 1
|
||||
else
|
||||
$ECHO ""
|
||||
fi
|
||||
#
|
||||
# Make sure we can actually modify the obj.conf file
|
||||
#
|
||||
|
||||
touch $ws_conf 1> /dev/null 2> /dev/null
|
||||
if [ $? != 0 ] ; then
|
||||
$ECHO " ERROR: No write permission to configuration file $ws_conf."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Check if AFS WebSecure is already installed
|
||||
#
|
||||
grep nsafs $ws_conf 1> /dev/null 2> /dev/null
|
||||
if [ $? = 0 ] ; then
|
||||
$ECHO " ERROR: $PRODUCT entries already exist in $ws_conf."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Find out where the AFSWebSecure stuff should be installed.
|
||||
#
|
||||
|
||||
$ECHO "Enter the $PRODUCT installation directory [/usr/afsweb]: " $ECHOFLAG
|
||||
read ws_wsdir
|
||||
if [ x$ws_wsdir = "x" ] ; then
|
||||
ws_wsdir="/usr/afsweb"
|
||||
fi
|
||||
|
||||
#
|
||||
# Install WebSecure from tar file in same directory from which the
|
||||
# ws_config script was started. The convoluted directory creation
|
||||
# loop lets people install in a directory tree that doesn't exist
|
||||
# yet, which would not typically be the case, but...
|
||||
#
|
||||
if [ ! -d $ws_wsdir ] ; then
|
||||
base=""
|
||||
root=""
|
||||
target=$ws_wsdir
|
||||
while [ x$target != "x" ] ; do
|
||||
base=`echo $target | sed -e 's;\(/[^/]*\)[-/a-zA-Z0-9_]*;\1;'`
|
||||
target=`echo $target | sed -e 's;\(/[^/]*\)\([-/a-zA-Z0-9_]*\);\2;'`
|
||||
if [ ! -d $root$base ] ; then
|
||||
echo "Creating $root$base"
|
||||
mkdir $root$base 1> /dev/null 2> /dev/null
|
||||
if [ $? != 0 ] ; then
|
||||
$ECHO "ERROR: Could not create $ws_wsdir. Check permissions and retry."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
root=$root$base
|
||||
done
|
||||
fi
|
||||
|
||||
$ECHO ""
|
||||
wd=`pwd`
|
||||
cd $ws_wsdir
|
||||
tar xvf $wd"/ns_afswebsecure.tar"
|
||||
|
||||
#
|
||||
# Use this as a check that everything went OK.
|
||||
#
|
||||
if [ ! -f $ws_wsdir"/lib/${AFSWSLIB}" ] ; then
|
||||
$ECHO " ERROR: $PRODUCT shared library \"$ws_wsdir/lib/${AFSWSLIB}\" not found."
|
||||
exit 1
|
||||
else
|
||||
$ECHO ""
|
||||
fi
|
||||
|
||||
#
|
||||
# Ensure that the cache dir and log files are owned by the user
|
||||
# specified in magnus.conf that this server runs as
|
||||
#
|
||||
ws_mconf=$ws_srvdir/https-$shn/config/magnus.conf
|
||||
|
||||
if [ ! -f $ws_mconf ] ; then
|
||||
$ECHO " ERROR: server config file \"$ws_mconf\" not found."
|
||||
exit 1
|
||||
else
|
||||
$ECHO ""
|
||||
fi
|
||||
|
||||
username=`grep -i User $ws_mconf | awk '{ print $2 }'`
|
||||
chown $username $ws_wsdir/cache $ws_wsdir/log
|
||||
|
||||
#
|
||||
# Enter the size of the AFS cache in 1K blocks
|
||||
#
|
||||
|
||||
$ECHO "Enter the size of the $PRODUCT cache in 1K blocks [5000]: " $ECHOFLAG
|
||||
read ws_csize
|
||||
if [ x$ws_csize = "x" ] ; then
|
||||
ws_csize="5000"
|
||||
fi
|
||||
$ECHO ""
|
||||
|
||||
expr $ws_csize + 1 1> /dev/null 2> /dev/null
|
||||
if [ $? != 0 ] ; then
|
||||
$ECHO " ERROR: Cache size must be numeric. You entered \"$ws_csize\"."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Set default value for advanced options - number of files in the cache
|
||||
# and number of receiving threads.
|
||||
#
|
||||
ws_cfiles=`expr $ws_csize / 10`
|
||||
ws_numt="2"
|
||||
|
||||
#
|
||||
# Enter the number of AFS daemon processes
|
||||
#
|
||||
|
||||
$ECHO "Enter the number of AFS daemons to run [3]: " $ECHOFLAG
|
||||
read ws_numd
|
||||
if [ x$ws_numd = "x" ] ; then
|
||||
ws_numd="3"
|
||||
fi
|
||||
$ECHO ""
|
||||
|
||||
expr $ws_numd + 1 1> /dev/null 2> /dev/null
|
||||
if [ $? != 0 ] ; then
|
||||
$ECHO " ERROR: The number of AFS daemons must be numeric. You entered \"$ws_numd\"."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Enter the number of entries in the AFS Stat cache
|
||||
# Default is the number of files in the cache.
|
||||
#
|
||||
|
||||
$ECHO "Enter the number of entries in the AFS stat cache [$ws_cfiles]: " $ECHOFLAG
|
||||
read ws_nums
|
||||
if [ x$ws_nums = "x" ] ; then
|
||||
ws_nums=$ws_cfiles
|
||||
fi
|
||||
$ECHO ""
|
||||
|
||||
expr $ws_nums + 1 1> /dev/null 2> /dev/null
|
||||
if [ $? != 0 ] ; then
|
||||
$ECHO " ERROR: The number of entries in the stat cache must be numeric. You entered \"$ws_nums\"."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Find out which cells $PRODUCT should work with
|
||||
#
|
||||
|
||||
$ECHO "Enter the AFS cell to access using $PRODUCT [$dhn]: " $ECHOFLAG
|
||||
read ws_cell
|
||||
if [ x$ws_cell = "x" ] ; then
|
||||
ws_cell=$dhn
|
||||
fi
|
||||
|
||||
#
|
||||
# Create appropriate ThisCell file
|
||||
#
|
||||
echo $ws_cell > $ws_wsdir"/etc/ThisCell"
|
||||
|
||||
#
|
||||
# If necessary, add entries to generic cellServDB file
|
||||
#
|
||||
grep $ws_cell $ws_wsdir"/etc/CellServDB" 1> /dev/null 2> /dev/null
|
||||
if [ $? != 0 ] ; then
|
||||
$ECHO " Cell $ws_cell not found in default CellServDB file."
|
||||
$ECHO ""
|
||||
$ECHO "Enter a one-line text description for this cell: " $ECHOFLAG
|
||||
read exp
|
||||
$ECHO ">$ws_cell # $exp" >> $ws_wsdir"/etc/CellServDB"
|
||||
$ECHO ""
|
||||
$ECHO "Enter the IP address of a database server for this cell ('.' to exit): " $ECHOFLAG
|
||||
read ws_dbsrv
|
||||
while [ x$ws_dbsrv != "x." ] ; do
|
||||
ws_dbname=`grep $ws_dbsrv /etc/hosts | sed -e 's;[0-9\.]*[ ]*\([a-z\.A-Z0-9]*\).*;\1;'`
|
||||
if [ x$ws_dbname = "x" ] ; then
|
||||
ws_dbname="Unknown"
|
||||
fi
|
||||
$ECHO " Appending $ws_dbname, IP address $ws_dbsrv."
|
||||
$ECHO "$ws_dbsrv #$ws_dbname" >> $ws_wsdir"/etc/CellServDB"
|
||||
$ECHO "Enter the IP address of a database server for this cell ('.' to exit): " $ECHOFLAG
|
||||
read ws_dbsrv
|
||||
done
|
||||
else
|
||||
$ECHO " Found cell $ws_cell in $ws_wsdir/etc/CellServDB."
|
||||
fi
|
||||
|
||||
$ECHO ""
|
||||
#
|
||||
#
|
||||
# "Advanced" configuration items - optional. These are:
|
||||
#
|
||||
# - number of RX threads
|
||||
# - number of files in the AFS WebSecure cache
|
||||
#
|
||||
#
|
||||
# $ECHO "Do you want to configure advanced options? (y/n): " $ECHOFLAG
|
||||
# read ans
|
||||
# let=`echo $ans | sed -e 's;\(.\).*;\1;' | tr [A-Z] [a-z]`
|
||||
# $ECHO ""
|
||||
# if [ x$let = "xy" ] ; then
|
||||
#
|
||||
#
|
||||
# Enter the number of files in the AFS cache - default is ws_csize/10
|
||||
#
|
||||
#
|
||||
# $ECHO "Enter the number of files in the Websecure cache [$ws_cfiles]: " $ECHOFLAG
|
||||
# read ws_cfiles
|
||||
# if [ x$ws_cfiles = "x" ] ; then
|
||||
# ws_cfiles=`expr $ws_csize / 10`
|
||||
# fi
|
||||
# $ECHO ""
|
||||
#
|
||||
# expr $ws_cfiles + 1 1> /dev/null 2> /dev/null
|
||||
# if [ $? != 0 ] ; then
|
||||
# $ECHO " ERROR: Number of cache files must be numeric. You entered \"$ws_cfiles\"."
|
||||
# exit 1
|
||||
# fi
|
||||
#
|
||||
#
|
||||
# Enter the number of threads to process RX packets
|
||||
#
|
||||
#
|
||||
# $ECHO "Enter the number of threads to process RX requests [2]: " $ECHOFLAG
|
||||
# read ws_numt
|
||||
# if [ x$ws_numt = "x" ] ; then
|
||||
# ws_numt="2"
|
||||
# fi
|
||||
# $ECHO ""
|
||||
#
|
||||
# expr $ws_numt + 1 1> /dev/null 2> /dev/null
|
||||
# if [ $? != 0 ] ; then
|
||||
# $ECHO " ERROR: The number of RX threads must be numeric. You entered \"$ws_numt\"."
|
||||
# exit 1
|
||||
# fi
|
||||
#
|
||||
# fi
|
||||
#
|
||||
#
|
||||
# Now that we have all the info we need, time to actually edit the obj.conf file
|
||||
#
|
||||
# Back up the old one if no previous backup exists
|
||||
#
|
||||
if [ -f $ws_conf".pre_ws" ] ; then
|
||||
$ECHO "NOTE: Backup file \"$ws_conf.pre_ws\" already exists."
|
||||
$ECHO " Not backing up current obj.conf file."
|
||||
else
|
||||
cp $ws_conf $ws_conf".pre_ws"
|
||||
$ECHO " Creating backup copy of obj.conf file..."
|
||||
fi
|
||||
|
||||
$EX $ws_conf << END_OF_FILE 1> /dev/null
|
||||
1
|
||||
/mime-types
|
||||
a
|
||||
Init fn="load-modules" shlib="$ws_wsdir/lib/${AFSWSLIB}" funcs="nsafs-init,nsafs-basic,nsafs-mount,nsafs-public,nsafs-nolinks,nsafs-check,nsafs-nocheck,nsafs-find-index,nsafs-send,nsafs-force-type,nsafs-put,nsafs-delete,nsafs-move,nsafs-index,nsafs-mkdir,nsafs-rmdir"
|
||||
Init fn="nsafs-init" cell="$ws_cell" blocks="$ws_csize" files="$ws_cfiles" stat="$ws_nums" daemons="$ws_numd" cachedir="$ws_wsdir/cache" confdir="$ws_wsdir/etc" logfile="$ws_wsdir/log/nsafs.log" exp-max="120" timeout="30" rcvthreads="$ws_numt"
|
||||
.
|
||||
/default
|
||||
a
|
||||
AuthTrans fn="nsafs-basic"
|
||||
NameTrans fn="nsafs-mount" mount="/afs"
|
||||
PathCheck fn="nsafs-public" public="/afs"
|
||||
PathCheck fn="nsafs-nolinks" nolinks="/afs/$ws_cell/usr"
|
||||
.
|
||||
/Service
|
||||
i
|
||||
Service method="(GET|HEAD)" fn="nsafs-send" index="fancy"
|
||||
.
|
||||
w! /tmp/newconf
|
||||
q
|
||||
END_OF_FILE
|
||||
|
||||
cp /tmp/newconf $ws_conf
|
||||
|
||||
$ECHO ""
|
||||
|
||||
$ECHO " Installation of $PRODUCT complete."
|
@ -1,534 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/* This code borrows from nsafs.c - slightly modified - names,etc. */
|
||||
|
||||
#include <afsconfig.h>
|
||||
#include <afs/param.h>
|
||||
|
||||
|
||||
#include "apache_afs_cache.h"
|
||||
|
||||
/*
|
||||
* Value used to initialize SHA checksums on username/password pairs
|
||||
*/
|
||||
afs_uint32 weblog_login_pad[SHA_HASH_INTS] = {
|
||||
0x0D544971, 0x2281AC5B, 0x58B51218, 0x4085E08D, 0xB68C484B
|
||||
};
|
||||
|
||||
/*
|
||||
* Cache of AFS logins
|
||||
*/
|
||||
struct {
|
||||
struct weblog_login *head;
|
||||
struct weblog_login *tail;
|
||||
} weblog_login_cache[WEBLOG_LOGIN_HASH_SIZE];
|
||||
|
||||
/* shchecksum.c copied here */
|
||||
|
||||
/*
|
||||
* This module implements the Secure Hash Algorithm (SHA) as specified in
|
||||
* the Secure Hash Standard (SHS, FIPS PUB 180.1).
|
||||
*/
|
||||
|
||||
static int big_endian;
|
||||
|
||||
static const sha_int hashinit[] = {
|
||||
0x67452301, 0xEFCDAB89, 0x98BADCFE,
|
||||
0x10325476, 0xC3D2E1F0
|
||||
};
|
||||
|
||||
#define ROTL(n, x) (((x) << (n)) | ((x) >> (SHA_BITS_PER_INT - (n))))
|
||||
|
||||
#ifdef DISABLED_CODE_HERE
|
||||
static sha_int
|
||||
f(int t, sha_int x, sha_int y, sha_int z)
|
||||
{
|
||||
if (t < 0 || t >= SHA_ROUNDS)
|
||||
return 0;
|
||||
if (t < 20)
|
||||
return (z ^ (x & (y ^ z)));
|
||||
if (t < 40)
|
||||
return (x ^ y ^ z);
|
||||
if (t < 60)
|
||||
return ((x & y) | (z & (x | y))); /* saves 1 boolean op */
|
||||
return (x ^ y ^ z); /* 60-79 same as 40-59 */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This is the "magic" function used for each round. */
|
||||
/* Were this a C function, the interface would be: */
|
||||
/* static sha_int f(int t, sha_int x, sha_int y, sha_int z) */
|
||||
/* The function call version preserved above until stable */
|
||||
|
||||
#define f_a(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define f_b(x, y, z) (x ^ y ^ z)
|
||||
#define f_c(x, y, z) (( (x & y) | (z & (x | y))))
|
||||
|
||||
#define f(t, x, y, z) \
|
||||
( (t < 0 || t >= SHA_ROUNDS) ? 0 : \
|
||||
( (t < 20) ? f_a(x, y, z) : \
|
||||
( (t < 40) ? f_b(x, y, z) : \
|
||||
( (t < 60) ? f_c(x, y, z) : f_b(x, y, z)))))
|
||||
|
||||
/*
|
||||
*static sha_int K(int t)
|
||||
*{
|
||||
* if (t < 0 || t >= SHA_ROUNDS) return 0;
|
||||
* if (t < 20)
|
||||
* return 0x5A827999;
|
||||
* if (t < 40)
|
||||
* return 0x6ED9EBA1;
|
||||
* if (t < 60)
|
||||
* return 0x8F1BBCDC;
|
||||
* return 0xCA62C1D6;
|
||||
* }
|
||||
*/
|
||||
|
||||
/* This macro/function supplies the "magic" constant for each round. */
|
||||
/* The function call version preserved above until stable */
|
||||
|
||||
static const sha_int k_vals[] =
|
||||
{ 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 };
|
||||
|
||||
#define K(t) ( (t < 0 || t >= SHA_ROUNDS) ? 0 : k_vals[ t/20 ] )
|
||||
|
||||
/*
|
||||
* Update the internal state based on the given chunk.
|
||||
*/
|
||||
static void
|
||||
transform(shaState * shaStateP, sha_int * chunk)
|
||||
{
|
||||
sha_int A = shaStateP->digest[0];
|
||||
sha_int B = shaStateP->digest[1];
|
||||
sha_int C = shaStateP->digest[2];
|
||||
sha_int D = shaStateP->digest[3];
|
||||
sha_int E = shaStateP->digest[4];
|
||||
sha_int TEMP = 0;
|
||||
|
||||
int t;
|
||||
sha_int W[SHA_ROUNDS];
|
||||
|
||||
for (t = 0; t < SHA_CHUNK_INTS; t++)
|
||||
W[t] = chunk[t];
|
||||
for (; t < SHA_ROUNDS; t++) {
|
||||
TEMP = W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16];
|
||||
W[t] = ROTL(1, TEMP);
|
||||
}
|
||||
|
||||
for (t = 0; t < SHA_ROUNDS; t++) {
|
||||
TEMP = ROTL(5, A) + f(t, B, C, D) + E + W[t] + K(t);
|
||||
E = D;
|
||||
D = C;
|
||||
C = ROTL(30, B);
|
||||
B = A;
|
||||
A = TEMP;
|
||||
}
|
||||
|
||||
shaStateP->digest[0] += A;
|
||||
shaStateP->digest[1] += B;
|
||||
shaStateP->digest[2] += C;
|
||||
shaStateP->digest[3] += D;
|
||||
shaStateP->digest[4] += E;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function takes an array of SHA_CHUNK_BYTES bytes
|
||||
* as input and produces an output array of ints that is
|
||||
* SHA_CHUNK_INTS long.
|
||||
*/
|
||||
static void
|
||||
buildInts(const char *data, sha_int * chunk)
|
||||
{
|
||||
/*
|
||||
* Need to copy the data because we can't be certain that
|
||||
* the input buffer will be aligned correctly.
|
||||
*/
|
||||
memcpy((void *)chunk, (void *)data, SHA_CHUNK_BYTES);
|
||||
|
||||
if (!big_endian) {
|
||||
/* This loop does nothing but waste time on a big endian machine. */
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SHA_CHUNK_INTS; i++)
|
||||
chunk[i] = ntohl(chunk[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function updates the internal state of the hash by using
|
||||
* buildInts to break the input up into chunks and repeatedly passing
|
||||
* these chunks to transform().
|
||||
*/
|
||||
void
|
||||
sha_update(shaState * shaStateP, const char *buffer, int bufferLen)
|
||||
{
|
||||
int i;
|
||||
sha_int chunk[SHA_CHUNK_INTS];
|
||||
sha_int newLo;
|
||||
|
||||
if (buffer == NULL || bufferLen == 0)
|
||||
return;
|
||||
|
||||
newLo = shaStateP->bitcountLo + (bufferLen << 3);
|
||||
if (newLo < shaStateP->bitcountLo)
|
||||
shaStateP->bitcountHi++;
|
||||
shaStateP->bitcountLo = newLo;
|
||||
shaStateP->bitcountHi += ((bufferLen >> (SHA_BITS_PER_INT - 3)) & 0x07);
|
||||
|
||||
/*
|
||||
* If we won't have enough for a full chunk, just tack this
|
||||
* buffer onto the leftover piece and return.
|
||||
*/
|
||||
if (shaStateP->leftoverLen + bufferLen < SHA_CHUNK_BYTES) {
|
||||
memcpy((void *)&(shaStateP->leftover[shaStateP->leftoverLen]),
|
||||
(void *)buffer, bufferLen);
|
||||
shaStateP->leftoverLen += bufferLen;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we have a leftover chunk, process it first. */
|
||||
if (shaStateP->leftoverLen > 0) {
|
||||
i = (SHA_CHUNK_BYTES - shaStateP->leftoverLen);
|
||||
memcpy((void *)&(shaStateP->leftover[shaStateP->leftoverLen]),
|
||||
(void *)buffer, i);
|
||||
buffer += i;
|
||||
bufferLen -= i;
|
||||
buildInts(shaStateP->leftover, chunk);
|
||||
shaStateP->leftoverLen = 0;
|
||||
transform(shaStateP, chunk);
|
||||
}
|
||||
|
||||
while (bufferLen >= SHA_CHUNK_BYTES) {
|
||||
buildInts(buffer, chunk);
|
||||
transform(shaStateP, chunk);
|
||||
buffer += SHA_CHUNK_BYTES;
|
||||
bufferLen -= SHA_CHUNK_BYTES;
|
||||
}
|
||||
/* assert((bufferLen >= 0) && (bufferLen < SHA_CHUNK_BYTES)); */
|
||||
if ((bufferLen < 0) || (bufferLen > SHA_CHUNK_BYTES)) {
|
||||
fprintf(stderr, "apache_afs_cache: ASSERTION FAILED...exiting\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (bufferLen > 0) {
|
||||
memcpy((void *)&shaStateP->leftover[0], (void *)buffer, bufferLen);
|
||||
shaStateP->leftoverLen = bufferLen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This method updates the internal state of the hash using
|
||||
* any leftover data plus appropriate padding and incorporation
|
||||
* of the hash bitcount to finish the hash. The hash value
|
||||
* is not valid until finish() has been called.
|
||||
*/
|
||||
void
|
||||
sha_finish(shaState * shaStateP)
|
||||
{
|
||||
sha_int chunk[SHA_CHUNK_INTS];
|
||||
int i;
|
||||
|
||||
if (shaStateP->leftoverLen > (SHA_CHUNK_BYTES - 9)) {
|
||||
shaStateP->leftover[shaStateP->leftoverLen++] = 0x80;
|
||||
memset(&(shaStateP->leftover[shaStateP->leftoverLen]), 0,
|
||||
(SHA_CHUNK_BYTES - shaStateP->leftoverLen));
|
||||
buildInts(shaStateP->leftover, chunk);
|
||||
transform(shaStateP, chunk);
|
||||
memset(chunk, 0, SHA_CHUNK_BYTES);
|
||||
} else {
|
||||
shaStateP->leftover[shaStateP->leftoverLen++] = 0x80;
|
||||
memset(&(shaStateP->leftover[shaStateP->leftoverLen]), 0,
|
||||
(SHA_CHUNK_BYTES - shaStateP->leftoverLen));
|
||||
buildInts(shaStateP->leftover, chunk);
|
||||
}
|
||||
shaStateP->leftoverLen = 0;
|
||||
|
||||
chunk[SHA_CHUNK_INTS - 2] = shaStateP->bitcountHi;
|
||||
chunk[SHA_CHUNK_INTS - 1] = shaStateP->bitcountLo;
|
||||
transform(shaStateP, chunk);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the hash to its "magic" initial value specified by the
|
||||
* SHS standard, and clear out the bitcount and leftover vars.
|
||||
* This should be used to initialize an shaState.
|
||||
*/
|
||||
void
|
||||
sha_clear(shaState * shaStateP)
|
||||
{
|
||||
big_endian = (0x01020304 == htonl(0x01020304));
|
||||
|
||||
memcpy((void *)&shaStateP->digest[0], (void *)&hashinit[0],
|
||||
SHA_HASH_BYTES);
|
||||
shaStateP->bitcountLo = shaStateP->bitcountHi = 0;
|
||||
shaStateP->leftoverLen = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Hash the buffer and place the result in *shaStateP.
|
||||
*/
|
||||
void
|
||||
sha_hash(shaState * shaStateP, const char *buffer, int bufferLen)
|
||||
{
|
||||
sha_clear(shaStateP);
|
||||
sha_update(shaStateP, buffer, bufferLen);
|
||||
sha_finish(shaStateP);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the current state of the hash as an array of 20 bytes.
|
||||
* This will be an interim result if finish() has not yet been called.
|
||||
*/
|
||||
void
|
||||
sha_bytes(const shaState * shaStateP, char *bytes)
|
||||
{
|
||||
sha_int temp[SHA_HASH_INTS];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SHA_HASH_INTS; i++)
|
||||
temp[i] = htonl(shaStateP->digest[i]);
|
||||
memcpy(bytes, (void *)&temp[0], SHA_HASH_BYTES);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Hash function for the AFS login cache
|
||||
*/
|
||||
int
|
||||
weblog_login_hash(char *name, char *cell)
|
||||
{
|
||||
char *p;
|
||||
afs_uint32 val;
|
||||
for (val = *name, p = name; *p != '\0'; p++) {
|
||||
val = (val << 2) ^ val ^ (afs_uint32) (*p);
|
||||
}
|
||||
for (p = cell; *p != '\0'; p++) {
|
||||
val = (val << 2) ^ val ^ (afs_uint32) (*p);
|
||||
}
|
||||
return val & (WEBLOG_LOGIN_HASH_SIZE - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute a SHA checksum on the username, cellname, and password
|
||||
*/
|
||||
void
|
||||
weblog_login_checksum(char *user, char *cell, char *passwd, char *cksum)
|
||||
{
|
||||
int passwdLen;
|
||||
int userLen;
|
||||
int cellLen;
|
||||
char *shaBuffer;
|
||||
shaState state;
|
||||
|
||||
/*
|
||||
* Compute SHA(username,SHA(password,pad))
|
||||
*/
|
||||
passwdLen = strlen(passwd);
|
||||
userLen = strlen(user);
|
||||
cellLen = strlen(cell);
|
||||
shaBuffer =
|
||||
(char *)malloc(MAX(userLen + cellLen, passwdLen) + SHA_HASH_BYTES);
|
||||
strcpy(shaBuffer, passwd);
|
||||
memcpy((void *)(shaBuffer + passwdLen), (void *)(&weblog_login_pad[0]),
|
||||
SHA_HASH_BYTES);
|
||||
sha_clear(&state);
|
||||
sha_hash(&state, shaBuffer, passwdLen + SHA_HASH_BYTES);
|
||||
memcpy(shaBuffer, user, userLen);
|
||||
memcpy(shaBuffer + userLen, cell, cellLen);
|
||||
sha_bytes(&state, shaBuffer + userLen + cellLen);
|
||||
sha_clear(&state);
|
||||
sha_hash(&state, shaBuffer, userLen + cellLen + SHA_HASH_BYTES);
|
||||
sha_bytes(&state, &cksum[0]);
|
||||
memset(shaBuffer, 0, MAX(userLen + cellLen, passwdLen) + SHA_HASH_BYTES);
|
||||
free(shaBuffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up a login ID in the cache. If an entry name is found for the
|
||||
* given username, and the SHA checksums match, then
|
||||
* set the token parameter and return 1, otherwise return 0.
|
||||
*/
|
||||
int
|
||||
weblog_login_lookup(char *user, char *cell, char *cksum, char *token)
|
||||
{
|
||||
int index;
|
||||
long curTime;
|
||||
struct weblog_login *loginP, *tmpP, loginTmp;
|
||||
|
||||
/*
|
||||
* Search the hash chain for a matching entry, free
|
||||
* expired entries as we search
|
||||
*/
|
||||
index = weblog_login_hash(user, cell);
|
||||
curTime = time(NULL);
|
||||
|
||||
loginP = weblog_login_cache[index].head;
|
||||
while (loginP != NULL) {
|
||||
if (loginP->expiration < curTime) {
|
||||
tmpP = loginP;
|
||||
loginP = tmpP->next;
|
||||
|
||||
DLL_DELETE(tmpP, weblog_login_cache[index].head,
|
||||
weblog_login_cache[index].tail, next, prev);
|
||||
free(tmpP);
|
||||
continue;
|
||||
}
|
||||
if (strcmp(loginP->username, user) == 0
|
||||
&& strcmp(loginP->cellname, cell) == 0
|
||||
&& memcmp((void *)&loginP->cksum[0], (void *)cksum,
|
||||
SHA_HASH_BYTES) == 0) {
|
||||
|
||||
memcpy((void *)token, (void *)&loginP->token[0], MAXBUFF);
|
||||
return loginP->tokenLen;
|
||||
}
|
||||
loginP = loginP->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert a login token into the cache. If the user already has an entry,
|
||||
* then overwrite the old entry.
|
||||
*/
|
||||
int
|
||||
weblog_login_store(char *user, char *cell, char *cksum, char *token,
|
||||
int tokenLen, afs_uint32 expiration)
|
||||
{
|
||||
int index;
|
||||
long curTime;
|
||||
struct weblog_login *loginP, *tmpP, loginTmp;
|
||||
|
||||
int parseToken(char *tokenBuf);
|
||||
|
||||
/*
|
||||
* Search the hash chain for a matching entry, free
|
||||
* expired entries as we search
|
||||
*/
|
||||
index = weblog_login_hash(user, cell);
|
||||
curTime = time(NULL);
|
||||
loginP = weblog_login_cache[index].head;
|
||||
|
||||
while (loginP != NULL) {
|
||||
if (strcmp(loginP->username, user) == 0
|
||||
&& strcmp(loginP->cellname, cell) == 0) {
|
||||
break;
|
||||
}
|
||||
if (loginP->expiration < curTime) {
|
||||
tmpP = loginP;
|
||||
loginP = tmpP->next;
|
||||
|
||||
DLL_DELETE(tmpP, weblog_login_cache[index].head,
|
||||
weblog_login_cache[index].tail, next, prev);
|
||||
free(tmpP);
|
||||
continue;
|
||||
}
|
||||
loginP = loginP->next;
|
||||
}
|
||||
if (loginP == NULL) {
|
||||
loginP = (struct weblog_login *)malloc(sizeof(struct weblog_login));
|
||||
strcpy(&loginP->username[0], user);
|
||||
strcpy(&loginP->cellname[0], cell);
|
||||
} else {
|
||||
DLL_DELETE(loginP, weblog_login_cache[index].head,
|
||||
weblog_login_cache[index].tail, next, prev);
|
||||
}
|
||||
|
||||
memcpy((void *)&loginP->cksum[0], (void *)cksum, SHA_HASH_BYTES);
|
||||
loginP->expiration = expiration;
|
||||
loginP->tokenLen = getTokenLen(token);
|
||||
memcpy((void *)&loginP->token[0], (void *)token, MAXBUFF);
|
||||
|
||||
DLL_INSERT_TAIL(loginP, weblog_login_cache[index].head,
|
||||
weblog_login_cache[index].tail, next, prev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
token_cache_init()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < WEBLOG_LOGIN_HASH_SIZE; i++) {
|
||||
DLL_INIT_LIST(weblog_login_cache[i].head, weblog_login_cache[i].tail);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
getTokenLen(char *buf)
|
||||
{
|
||||
afs_int32 len = 0;
|
||||
afs_int32 rc = 0;
|
||||
char cellName[WEBLOG_CELLNAME_MAX];
|
||||
char *tp;
|
||||
int n = sizeof(afs_int32);
|
||||
struct ClearToken {
|
||||
afs_int32 AuthHandle;
|
||||
char HandShakeKey[8];
|
||||
afs_int32 ViceId;
|
||||
afs_int32 BeginTimestamp;
|
||||
afs_int32 EndTimestamp;
|
||||
} token;
|
||||
tp = buf;
|
||||
memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */
|
||||
rc = (len + sizeof(afs_int32));
|
||||
tp += (sizeof(afs_int32) + len); /* skip secret token and its length */
|
||||
memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */
|
||||
if (len != sizeof(struct ClearToken)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"apache_afs_cache.c:getExpiration:"
|
||||
"something's wrong with the length of ClearToken:%d\n", len);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
rc += (sizeof(afs_int32) + len); /* length of clear token + length itself */
|
||||
tp += (sizeof(afs_int32) + len); /* skip clear token and its length */
|
||||
rc += sizeof(afs_int32); /* length of primary flag */
|
||||
tp += sizeof(afs_int32); /* skip over primary flag */
|
||||
strcpy(cellName, tp);
|
||||
if (cellName != NULL)
|
||||
rc += strlen(cellName);
|
||||
return rc;
|
||||
}
|
||||
|
||||
long
|
||||
getExpiration(char *buf)
|
||||
{
|
||||
afs_int32 len = 0;
|
||||
char *tp;
|
||||
int n = sizeof(afs_int32);
|
||||
struct ClearToken {
|
||||
afs_int32 AuthHandle;
|
||||
char HandShakeKey[8];
|
||||
afs_int32 ViceId;
|
||||
afs_int32 BeginTimestamp;
|
||||
afs_int32 EndTimestamp;
|
||||
} token;
|
||||
|
||||
tp = buf;
|
||||
memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */
|
||||
tp += (sizeof(afs_int32) + len); /* skip secret token and its length */
|
||||
memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */
|
||||
if (len != sizeof(struct ClearToken)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"apache_afs_cache.c:getExpiration:"
|
||||
"something's wrong with the length of ClearToken:%d\n", len);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
tp += sizeof(afs_int32); /* skip length of clear token */
|
||||
memcpy(&token, tp, sizeof(struct ClearToken)); /* copy the token */
|
||||
return token.EndTimestamp;
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
#ifndef _APACHE_AFS_CACHE_H_INCLUDED_
|
||||
#define _APACHE_AFS_CACHE_H_INCLUDED_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsafs.h"
|
||||
|
||||
#ifdef AIX
|
||||
#include <sys/types.h>
|
||||
#include <net/nh.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(A,B) ((A)>(B)?(A):(B))
|
||||
#endif /* !MAX */
|
||||
#ifndef MIN
|
||||
#define MIN(A,B) ((A)<(B)?(A):(B))
|
||||
#endif /* !MAX */
|
||||
|
||||
/*
|
||||
* Macros to manipulate doubly linked lists
|
||||
*/
|
||||
|
||||
#define DLL_INIT_LIST(_HEAD, _TAIL) \
|
||||
{ _HEAD = NULL ; _TAIL = NULL; }
|
||||
|
||||
#define DLL_INSERT_TAIL(_ELEM, _HEAD, _TAIL, _NEXT, _PREV) \
|
||||
{ \
|
||||
if (_HEAD == NULL) { \
|
||||
_ELEM->_NEXT = NULL; \
|
||||
_ELEM->_PREV = NULL; \
|
||||
_HEAD = _ELEM; \
|
||||
_TAIL = _ELEM; \
|
||||
} else { \
|
||||
_ELEM->_NEXT = NULL; \
|
||||
_ELEM->_PREV = _TAIL; \
|
||||
_TAIL->_NEXT = _ELEM; \
|
||||
_TAIL = _ELEM; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DLL_DELETE(_ELEM, _HEAD, _TAIL, _NEXT, _PREV) \
|
||||
{ \
|
||||
if (_ELEM->_NEXT == NULL) { \
|
||||
_TAIL = _ELEM->_PREV; \
|
||||
} else { \
|
||||
_ELEM->_NEXT->_PREV = _ELEM->_PREV; \
|
||||
} \
|
||||
if (_ELEM->_PREV == NULL) { \
|
||||
_HEAD = _ELEM->_NEXT; \
|
||||
} else { \
|
||||
_ELEM->_PREV->_NEXT = _ELEM->_NEXT; \
|
||||
} \
|
||||
_ELEM->_NEXT = NULL; \
|
||||
_ELEM->_PREV = NULL; \
|
||||
}
|
||||
|
||||
|
||||
#define WEBLOG_BUFFER_SIZE 4096 /* Send/Receive buffer size */
|
||||
#define WEBLOG_MAX_PATH 1024 /* Maximum path length */
|
||||
#define WEBLOG_USERNAME_MAX 64 /* Maximum username length */
|
||||
#define WEBLOG_CELLNAME_MAX 64 /* Maximum password length */
|
||||
#define WEBLOG_PASSWORD_MAX 64
|
||||
#define WEBLOG_LOGIN_HASH_SIZE 1024 /* MUST be power of two */
|
||||
#define TEN_MINUTES 600 /* 10 minutes = 600 seconds */
|
||||
|
||||
#define MAXBUFF 1024 /* CHECK THIS - size of token */
|
||||
/*
|
||||
* Structure user to store entries in AFS login cache
|
||||
*/
|
||||
struct weblog_login {
|
||||
afs_uint32 expiration;
|
||||
char token[MAXBUFF];
|
||||
int tokenLen;
|
||||
char username[WEBLOG_USERNAME_MAX];
|
||||
char cellname[WEBLOG_CELLNAME_MAX];
|
||||
char cksum[SHA_HASH_BYTES];
|
||||
struct weblog_login *next;
|
||||
struct weblog_login *prev;
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern int weblog_login_hash(char *name, char *cell);
|
||||
extern void weblog_login_checksum(char *user, char *cell, char *passwd,
|
||||
char *cksum);
|
||||
extern int weblog_login_lookup(char *user, char *cell, char *cksum,
|
||||
char *token);
|
||||
extern int weblog_login_store(char *user, char *cell, char *cksum,
|
||||
char *token, int tokenLen,
|
||||
afs_uint32 expiration);
|
||||
extern int getTokenLen(char *token);
|
||||
|
||||
#endif /* _APACHE_AFS_CACHE_H_INCLUDED_ */
|
File diff suppressed because it is too large
Load Diff
@ -1,403 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* afs_module Version 1.3 < for Apache Server version 1.2.6 and 1.3.1 >
|
||||
*
|
||||
* Add to Configuration file (before any of the Authentication modules)
|
||||
* Module afs_module afs_module.o
|
||||
*
|
||||
* Add to server configuration file:
|
||||
* SetAFSDefaultCell <cell name>
|
||||
* SetAFSCacheExpiration <seconds for AFS client cache expiration>
|
||||
* SetAFSTokenExpiration <seconds for AFS token expiration>
|
||||
* SetAFSWeblogPath <path (full or relative to ServerRoot to the weblog_starter binary>
|
||||
* SetAFSDebugLevel <positive integer for verbosity level of error logs>
|
||||
* Per directory configuration for locations that AFS access is desired may
|
||||
* be specified as follows Eg.
|
||||
* <Location /afs>
|
||||
* ## Optionally set default cell for this location AFSDefaultCell <cell name>
|
||||
* AFSAuthType AFS
|
||||
* AFSLoginPrompt AFS Login for <%c/%d>
|
||||
* </Location>
|
||||
*/
|
||||
|
||||
#include "httpd.h"
|
||||
#include "http_config.h"
|
||||
#include "http_core.h"
|
||||
#include "http_conf_globals.h"
|
||||
|
||||
|
||||
/*
|
||||
* default parameters - if none are specified in the config file
|
||||
* these are used
|
||||
*/
|
||||
#define DEFAULT_WEBLOG_PATH "./weblog_starter"
|
||||
#define DEFAULT_CACHE_EXPIRATION 300 /* 5 minutes */
|
||||
#define DEFAULT_TOKEN_EXPIRATION 600 /* 10 minutes */
|
||||
#define DEFAULT_DEBUG_LEVEL 0
|
||||
#define null ((void*)0)
|
||||
|
||||
extern u_long afsDebugLevel;
|
||||
|
||||
/* forward declaration, see defination at end of file */
|
||||
module afs_module;
|
||||
|
||||
/* Data type for server configuration */
|
||||
typedef struct {
|
||||
char *afs_defaultCell;
|
||||
u_long afs_cacheExpiration;
|
||||
u_long afs_tokenExpiration;
|
||||
char *afs_weblogPath;
|
||||
char *afs_accessLog;
|
||||
u_long afs_debugLevel;
|
||||
} afs_server_config_rec;
|
||||
|
||||
|
||||
/* Data type for per directory configuration */
|
||||
typedef struct {
|
||||
char *afs_authtype;
|
||||
char *afs_prompt;
|
||||
char *afs_cell;
|
||||
} afs_dir_config_rec;
|
||||
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
static char defaultCell[64];
|
||||
static u_long cacheExpiration;
|
||||
int logAccessErrors = 0;
|
||||
int logfd = -1;
|
||||
|
||||
static int afsAccessFile_flags = (O_WRONLY | O_APPEND | O_CREAT);
|
||||
#ifdef __EMX__
|
||||
/* OS/2 dosen't support users and groups */
|
||||
static mode_t afsAccessFile_mode = (S_IREAD | S_IWRITE);
|
||||
#else
|
||||
static mode_t afsAccessFile_mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
#endif
|
||||
|
||||
void
|
||||
afs_init(server_rec * s, pool * p)
|
||||
{
|
||||
if (!initialized) {
|
||||
char *weblogPath;
|
||||
afs_server_config_rec *src =
|
||||
get_module_config(s->module_config, &afs_module);
|
||||
int tokenExpiration = src->afs_tokenExpiration;
|
||||
|
||||
initialized = 1;
|
||||
if (src->afs_weblogPath)
|
||||
weblogPath = pstrdup(p, src->afs_weblogPath);
|
||||
else
|
||||
weblogPath = pstrdup(p, DEFAULT_WEBLOG_PATH);
|
||||
|
||||
if (src->afs_defaultCell)
|
||||
strcpy(defaultCell, src->afs_defaultCell);
|
||||
else {
|
||||
fprintf(stderr,
|
||||
"AFS Module: SetAFSDEfaultCell <cellname> "
|
||||
"is a required directive for module to work. Exiting\n");
|
||||
exit(1);
|
||||
}
|
||||
tokenExpiration = src->afs_tokenExpiration;
|
||||
cacheExpiration = src->afs_cacheExpiration;
|
||||
afsDebugLevel = src->afs_debugLevel;
|
||||
|
||||
if ((src->afs_accessLog == NULL) || (src->afs_accessLog == "")) {
|
||||
logAccessErrors = 0;
|
||||
} else {
|
||||
char *filename = server_root_relative(p, src->afs_accessLog);
|
||||
logfd = open(filename, afsAccessFile_flags, afsAccessFile_mode);
|
||||
if (logfd < 0) {
|
||||
fprintf(stderr,
|
||||
"afs_module:Error opening afs access log file:%s\n"
|
||||
"Error:%s,Exiting\n", strerror(errno), filename);
|
||||
exit(-1);
|
||||
}
|
||||
logAccessErrors = 1;
|
||||
}
|
||||
|
||||
if (cacheExpiration < 0) {
|
||||
cacheExpiration = DEFAULT_CACHE_EXPIRATION;
|
||||
}
|
||||
if (tokenExpiration < 0) {
|
||||
tokenExpiration = DEFAULT_TOKEN_EXPIRATION;
|
||||
}
|
||||
|
||||
if (afsDebugLevel < 0) {
|
||||
afsDebugLevel = DEFAULT_DEBUG_LEVEL;
|
||||
}
|
||||
|
||||
if (cacheExpiration > tokenExpiration) {
|
||||
fprintf(stderr,
|
||||
"tokenExpiration:%d is less than cacheExpiration:%d\n",
|
||||
tokenExpiration, cacheExpiration);
|
||||
fprintf(stderr, "\n\n");
|
||||
fprintf(stderr,
|
||||
"Ensure that this does not happen, since you will "
|
||||
"not be allowed access to files if the cached token has expired "
|
||||
"because the token lifetime is less than the cache expiration "
|
||||
"time. Restart the server after editing the config file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!cacheExpiration && tokenExpiration) {
|
||||
fprintf(stderr,
|
||||
"cacheExpiration is set to infinity (0), but "
|
||||
"tokenExpiration:%d is finite\n", tokenExpiration);
|
||||
fprintf(stderr, "\n\n");
|
||||
fprintf(stderr,
|
||||
"Ensure that this does not happen, since you will "
|
||||
"not be allowed access to files if the cached token has expired "
|
||||
"because the token lifetime is less than the cache expiration "
|
||||
"time (infinite). "
|
||||
"Restart the server after editing the config file\n");
|
||||
}
|
||||
#ifdef SHUTDOWN_IF_AFS_FAILS
|
||||
afs_plugin_init(tokenExpiration, server_root_relative(p, weblogPath),
|
||||
server_root_relative(p, s->error_fname),
|
||||
server_root_relative(p, pid_fname), defaultCell, NULL,
|
||||
cacheExpiration, NULL, 1);
|
||||
#else
|
||||
afs_plugin_init(tokenExpiration, server_root_relative(p, weblogPath),
|
||||
server_root_relative(p, s->error_fname),
|
||||
server_root_relative(p, pid_fname), defaultCell, NULL,
|
||||
cacheExpiration, NULL, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
check_weblog(char *path)
|
||||
{
|
||||
struct stat fs;
|
||||
int rc = stat(path, &fs);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (!((fs.st_mode & S_IXUSR) || (fs.st_mode & S_IXGRP)
|
||||
|| (fs.st_mode & S_IXOTH)))
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* per-server configuration creator
|
||||
*/
|
||||
void *
|
||||
create_afs_server_config(pool * p, server_rec * s)
|
||||
{
|
||||
afs_server_config_rec *scr =
|
||||
(afs_server_config_rec *) pcalloc(p, sizeof(afs_server_config_rec));
|
||||
scr->afs_cacheExpiration = 0;
|
||||
scr->afs_tokenExpiration = 0;
|
||||
scr->afs_debugLevel = 0;
|
||||
return (void *)scr;
|
||||
}
|
||||
|
||||
/*
|
||||
* per-dir configuration record creator
|
||||
*/
|
||||
void *
|
||||
create_afs_dir_config(pool * p, char *dummy)
|
||||
{
|
||||
afs_dir_config_rec *new =
|
||||
(afs_dir_config_rec *) pcalloc(p, sizeof(afs_dir_config_rec));
|
||||
return (void *)new;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handlers for server config lines - set afs default cell, weblog path, access log,
|
||||
* token and cache expiration time to the server configuration. As well as per-dir
|
||||
* configs like AFSAuthentication.
|
||||
*/
|
||||
const char *
|
||||
set_afscell(cmd_parms * cmd, void *dummy, char *arg)
|
||||
{
|
||||
void *sc = cmd->server->module_config;
|
||||
afs_server_config_rec *sr = get_module_config(sc, &afs_module);
|
||||
|
||||
if ((arg == NULL) || (arg[0] == '\0'))
|
||||
return "AFS Default cell is a required directive";
|
||||
|
||||
sr->afs_defaultCell = arg;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
set_afsweblogpath(cmd_parms * cmd, void *dummy, char *arg)
|
||||
{
|
||||
void *sc = cmd->server->module_config;
|
||||
afs_server_config_rec *sr = get_module_config(sc, &afs_module);
|
||||
int rc = check_weblog(arg);
|
||||
if (rc) {
|
||||
switch (rc) {
|
||||
case 1:
|
||||
return
|
||||
"Weblog Path should be the full path to the weblog_starter binary";
|
||||
case 2:
|
||||
return "weblog_starter not executable";
|
||||
}
|
||||
}
|
||||
sr->afs_weblogPath = arg;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
set_afsacceslog(cmd_parms * cmd, void *dummy, char *arg)
|
||||
{
|
||||
void *sc = cmd->server->module_config;
|
||||
afs_server_config_rec *sr = get_module_config(sc, &afs_module);
|
||||
sr->afs_accessLog = arg;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
set_afs_CacheExpiration(cmd_parms * cmd, void *dummy, char *expTime)
|
||||
{
|
||||
afs_server_config_rec *sr =
|
||||
get_module_config(cmd->server->module_config, &afs_module);
|
||||
sr->afs_cacheExpiration = atol(expTime);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
set_afs_TokenExpiration(cmd_parms * cmd, void *dummy, char *expTime)
|
||||
{
|
||||
afs_server_config_rec *sr =
|
||||
get_module_config(cmd->server->module_config, &afs_module);
|
||||
sr->afs_tokenExpiration = atol(expTime);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
set_afs_DebugLevel(cmd_parms * cmd, void *dummy, char *debugLevel)
|
||||
{
|
||||
afs_server_config_rec *sr = get_module_config(cmd->server->module_config,
|
||||
&afs_module);
|
||||
sr->afs_debugLevel = atol(debugLevel);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Commands this module needs to handle */
|
||||
command_rec afs_cmds[] = {
|
||||
{"SetAFSDefaultCell", set_afscell, NULL,
|
||||
RSRC_CONF, TAKE1, "the AFS cell you want to access by default"}
|
||||
,
|
||||
|
||||
{"SetAFSCacheExpiration", set_afs_CacheExpiration, NULL, RSRC_CONF, TAKE1,
|
||||
"time for tokens in the client cache to live"}
|
||||
,
|
||||
|
||||
{"SetAFSWeblogPath", set_afsweblogpath, NULL, RSRC_CONF, TAKE1,
|
||||
"full or relative to ServerRoot path to the weblog_starter binary"}
|
||||
,
|
||||
|
||||
{"SetAFSTokenExpiration", set_afs_TokenExpiration, NULL, RSRC_CONF, TAKE1,
|
||||
"time for tokens in the kernel cache to live"}
|
||||
,
|
||||
|
||||
{"SetAFSAccessLog", set_afsacceslog, NULL, RSRC_CONF, TAKE1,
|
||||
"log afs access errors to this file"}
|
||||
,
|
||||
|
||||
{"SetAFSDebugLevel", set_afs_DebugLevel, NULL, RSRC_CONF, TAKE1,
|
||||
"Set Verbosity level for logging stuff to the error log"}
|
||||
,
|
||||
|
||||
{"AFSLoginPrompt", set_string_slot,
|
||||
(void *)XtOffsetOf(afs_dir_config_rec, afs_prompt), ACCESS_CONF, TAKE1,
|
||||
"Prompt to show on Authenticating Window - similar to AuthName"},
|
||||
|
||||
{"AFSAuthType", set_string_slot,
|
||||
(void *)XtOffsetOf(afs_dir_config_rec, afs_authtype), ACCESS_CONF, TAKE1,
|
||||
"Authentication type for AFS"},
|
||||
|
||||
{"AFSDefaultCell", set_string_slot,
|
||||
(void *)XtOffsetOf(afs_dir_config_rec, afs_cell), ACCESS_CONF, TAKE1,
|
||||
"Default AFS cell for this location"},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
|
||||
char *
|
||||
get_afsauthtype(request_rec * r)
|
||||
{
|
||||
afs_dir_config_rec *dr = (afs_dir_config_rec *)
|
||||
get_module_config(r->per_dir_config, &afs_module);
|
||||
if (!dr->afs_authtype) {
|
||||
/* Try to unite CGI subprocess configuration info */
|
||||
if (r->main) {
|
||||
dr = (afs_dir_config_rec *)
|
||||
get_module_config(r->main->per_dir_config, &afs_module);
|
||||
}
|
||||
}
|
||||
return dr->afs_authtype;
|
||||
}
|
||||
|
||||
char *
|
||||
get_afs_authprompt(request_rec * r)
|
||||
{
|
||||
afs_dir_config_rec *dr =
|
||||
(afs_dir_config_rec *) get_module_config(r->per_dir_config,
|
||||
&afs_module);
|
||||
if (!dr->afs_prompt) {
|
||||
/* Try to unite CGI subprocess configuration info */
|
||||
if (r->main) {
|
||||
dr = (afs_dir_config_rec *)
|
||||
get_module_config(r->main->per_dir_config, &afs_module);
|
||||
}
|
||||
}
|
||||
return dr->afs_prompt;
|
||||
}
|
||||
|
||||
static char *
|
||||
get_afs_cell(request_rec * r)
|
||||
{
|
||||
afs_dir_config_rec *dr =
|
||||
(afs_dir_config_rec *) get_module_config(r->per_dir_config,
|
||||
&afs_module);
|
||||
if (!dr->afs_cell) {
|
||||
/* Try to unite CGI subprocess configuration info */
|
||||
if (r->main) {
|
||||
dr = (afs_dir_config_rec *)
|
||||
get_module_config(r->main->per_dir_config, &afs_module);
|
||||
}
|
||||
}
|
||||
return dr->afs_cell;
|
||||
}
|
||||
|
||||
int
|
||||
afs_auth(request_rec * r)
|
||||
{
|
||||
char *cell = get_afs_cell(r);
|
||||
return afs_auth_internal(r, cell ? cell : defaultCell, cacheExpiration);
|
||||
}
|
||||
|
||||
|
||||
|
||||
module afs_module = {
|
||||
STANDARD_MODULE_STUFF,
|
||||
afs_init,
|
||||
create_afs_dir_config,
|
||||
NULL,
|
||||
create_afs_server_config,
|
||||
NULL,
|
||||
afs_cmds,
|
||||
NULL,
|
||||
afs_auth,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
@ -1,610 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/* Apache plugin for AFS authentication - should be archived to libapacheafs.a
|
||||
* contains calls to functions in apache_afs_client.o - and is the intermediary
|
||||
* between the module that plugs into apache's source code and the
|
||||
* apache_afs_client. Shares global variables with the module and the client.
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
#include "apache_api.h"
|
||||
|
||||
#define afslog(level,str) if (level <= afsDebugLevel) (afsLogError str)
|
||||
#define afsassert(str) if(!(str)) { fprintf(stderr, "afs module: assertion failed:%s\t%d\n",__FILE__,__LINE__) ; return SERVER_ERROR; }
|
||||
|
||||
#define AFS_AUTHTYPE "AFS"
|
||||
#define AFS_DFS_AUTHTYPE "AFS-DFS"
|
||||
#define ERRSTRLEN 1024
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
/* Global vars */
|
||||
|
||||
u_long afsDebugLevel;
|
||||
const char module_name[] = "AFS Authentication Module";
|
||||
|
||||
typedef struct {
|
||||
char defaultCell[64];
|
||||
u_long cacheExpiration;
|
||||
} apache_afs_glob;
|
||||
|
||||
static apache_afs_glob *afs_str;
|
||||
|
||||
/* Global file descriptors for pipes */
|
||||
int readPipe, writePipe;
|
||||
|
||||
#ifdef AIX
|
||||
/* Global temp lock file descriptor */
|
||||
int tempfd;
|
||||
|
||||
/*
|
||||
* Create a temporary file and unlink it using the file descriptor for locking
|
||||
* as a means of synchronization for providing exclusive access to the pipe
|
||||
* for communicating with the weblog process
|
||||
*/
|
||||
static int
|
||||
create_temp_file()
|
||||
{
|
||||
char tmpFileName[L_tmpnam];
|
||||
int lockfd = 0;
|
||||
|
||||
tmpnam(tmpFileName);
|
||||
unlink(tmpFileName);
|
||||
|
||||
lockfd = open(tmpFileName, O_RDWR | O_CREAT);
|
||||
if (lockfd < 0) {
|
||||
perror("afs_plugin:Error creating temp file:");
|
||||
return lockfd;
|
||||
}
|
||||
unlink(tmpFileName);
|
||||
return lockfd;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialization: start up the weblog process. Open the pipes and pass their
|
||||
* file descriptors to the weblog process
|
||||
*/
|
||||
void
|
||||
afs_plugin_init(int tokenExpiration, char *weblogPath, char *error_fname,
|
||||
char *pf, char *cell, char *dir, int exp, char *loc,
|
||||
int shutdown)
|
||||
{
|
||||
int childpid;
|
||||
int pipe1[2], pipe2[2];
|
||||
char weblogarg1[32];
|
||||
char weblogarg2[32];
|
||||
char weblogarg3[32];
|
||||
char weblogarg4[32];
|
||||
|
||||
FILE *fp; /* for pid_fname */
|
||||
char *afs_weblog_pidfile;
|
||||
char *httpd_pid_fname = strdup(pf);
|
||||
if (httpd_pid_fname == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: malloc failed - out of memory while allocating space for httpd_pid_fname\n",
|
||||
module_name);
|
||||
exit(-1);
|
||||
}
|
||||
if (asprintf(&afs_weblog_pidfile, "%s.afs", httpd_pid_fname) < 0)
|
||||
afs_weblog_pidfile == NULL;
|
||||
if (afs_weblog_pidfile == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: malloc failed - out of memory while allocating space for afs_weblog_pidfile\n",
|
||||
module_name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (do_setpag()) {
|
||||
fprintf(stderr, "%s:Failed to set pag Error:%d\n", module_name,
|
||||
errno);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
afs_str = (apache_afs_glob *) malloc(sizeof(apache_afs_glob));
|
||||
if (afs_str == NULL) {
|
||||
fprintf(stderr, "%s:malloc failed for afs_str\n", module_name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (cell)
|
||||
strcpy(afs_str->defaultCell, cell);
|
||||
else {
|
||||
fprintf(stderr, "%s: NULL argument in cell\n", module_name);
|
||||
exit(-1);
|
||||
}
|
||||
afs_str->cacheExpiration = exp;
|
||||
|
||||
afslog(5,
|
||||
("Default Cell:%s\nCache Expiration:%d\nDebugLevel:%d",
|
||||
afs_str->defaultCell, afs_str->cacheExpiration, afsDebugLevel));
|
||||
|
||||
#ifdef AIX
|
||||
/* Get a temp file fd for locking */
|
||||
tempfd = create_temp_file();
|
||||
if (tempfd < 0) {
|
||||
fprintf(stderr, "%s: Error creating temp file", module_name);
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pipe(pipe1) < 0 || pipe(pipe2) < 0) {
|
||||
fprintf(stderr, "%s: Error creating pipes - %s", module_name,
|
||||
strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
if ((childpid = fork()) < 0) {
|
||||
fprintf(stderr, "%s: Error forking - %s", module_name,
|
||||
strerror(errno));
|
||||
exit(-1);
|
||||
} else if (childpid > 0) { /* parent */
|
||||
close(pipe1[0]);
|
||||
close(pipe2[1]);
|
||||
readPipe = pipe2[0];
|
||||
writePipe = pipe1[1];
|
||||
} else { /* child */
|
||||
close(pipe1[1]);
|
||||
close(pipe2[0]);
|
||||
fp = fopen(afs_weblog_pidfile, "w");
|
||||
if (fp == NULL) {
|
||||
perror("fopen");
|
||||
fprintf(stderr, "%s: Error opening pidfile:%s - %s\n",
|
||||
module_name, afs_weblog_pidfile, strerror(errno));
|
||||
close(pipe1[0]);
|
||||
close(pipe2[1]);
|
||||
exit(-1);
|
||||
}
|
||||
fprintf(fp, "%ld\n", (long)getpid());
|
||||
fclose(fp);
|
||||
free(afs_weblog_pidfile);
|
||||
sprintf(weblogarg1, "%d", pipe1[0]);
|
||||
sprintf(weblogarg2, "%d", pipe2[1]);
|
||||
sprintf(weblogarg3, "%d", afs_str->cacheExpiration);
|
||||
sprintf(weblogarg4, "%d", tokenExpiration);
|
||||
sleep(5);
|
||||
execlp(weblogPath, "weblog_starter", weblogPath, error_fname,
|
||||
weblogarg1, weblogarg2, weblogarg3, weblogarg4, NULL);
|
||||
fprintf(stderr, "%s: Error executing %s - %s\n", module_name,
|
||||
weblogPath, strerror(errno));
|
||||
perror("execlp");
|
||||
close(pipe1[0]);
|
||||
close(pipe2[1]);
|
||||
fclose(fp);
|
||||
|
||||
/* exit by sending a SIGTERM to the httpd process (how to get the pid?)
|
||||
* since at this point the pid file is outdated and only if we sleep for
|
||||
* a while to allow httpd_main to put it's pid in the pidfile can we
|
||||
* attempt to send it a SIGTERM for graceful shuttdown)
|
||||
* so that everything is brought down - if you want to bring everything
|
||||
* down!! Else continue with httpd without AFS authentication.
|
||||
*/
|
||||
/*#ifdef SHUTDOWN_IF_AFS_FAILS in afs_module.c */
|
||||
if (shutdown) {
|
||||
#define KILL_TIME_WAIT 1
|
||||
#define MAX_KILL_ATTEMPTS 3
|
||||
int attempts = 0;
|
||||
fp = fopen(httpd_pid_fname, "r");
|
||||
fscanf(fp, "%d", &childpid);
|
||||
fclose(fp);
|
||||
killagain:
|
||||
sleep(KILL_TIME_WAIT);
|
||||
if (kill(childpid, SIGTERM) == -1) {
|
||||
if ((errno == ESRCH) && (attempts < MAX_KILL_ATTEMPTS)) {
|
||||
attempts++;
|
||||
fprintf(stderr,
|
||||
"%s:SIGTERM to process:%d FAILED attempt:%d\nRetrying "
|
||||
" for %d more attempts every %d seconds\n",
|
||||
module_name, childpid, attempts,
|
||||
(MAX_KILL_ATTEMPTS - attempts), KILL_TIME_WAIT);
|
||||
goto killagain;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "%s:Shutdown complete ...\n", module_name);
|
||||
}
|
||||
if (attempts >= MAX_KILL_ATTEMPTS) {
|
||||
fprintf(stderr,
|
||||
"%s:httpd is still running-AFS authentication will fail "
|
||||
"because weblog startup failed\n", module_name);
|
||||
}
|
||||
exit(0);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"%s:httpd running - AFS Authentication will not work! "
|
||||
"Weblog startup failure", module_name);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns HTTP error codes based on the result of a stat error
|
||||
*/
|
||||
static int
|
||||
sort_stat_error(request_rec * r)
|
||||
{
|
||||
int status = 0;
|
||||
switch (errno) {
|
||||
case ENOENT:
|
||||
status = HTTP_NOT_FOUND;
|
||||
break;
|
||||
|
||||
case EACCES:
|
||||
status = FORBIDDEN;
|
||||
break;
|
||||
|
||||
case ENOLINK:
|
||||
status = HTTP_NOT_FOUND;
|
||||
break;
|
||||
|
||||
case ENODEV:
|
||||
status = HTTP_NOT_FOUND;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char error[ERRSTRLEN];
|
||||
sprintf(error, "%s: stat error: %s", module_name,
|
||||
strerror(errno));
|
||||
status = SERVER_ERROR;
|
||||
LOG_REASON(error, r->uri, r);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* recursively stats the path to see where we're going wrong and
|
||||
* chops off the path_info part of it -
|
||||
* Returns OK or an HTTP status code
|
||||
* Called if we get a ENOTDIR from the first stab at statting the
|
||||
* entire path - so we assume that we have some PATH_INFO and try to
|
||||
* chop it off the end and return the path itself
|
||||
* Side effects on request_rec
|
||||
- sets the filename field
|
||||
- sets the path_info field
|
||||
*/
|
||||
static int
|
||||
remove_path_info(request_rec * r, char *path, struct stat *buf)
|
||||
{
|
||||
char *cp;
|
||||
char *end;
|
||||
char *last_cp = NULL;
|
||||
int rc = 0;
|
||||
|
||||
afsassert(r);
|
||||
afsassert(path);
|
||||
afsassert(buf);
|
||||
|
||||
end = &path[strlen(path)];
|
||||
|
||||
/* Advance over trailing slashes ... NOT part of filename */
|
||||
for (cp = end; cp > path && cp[-1] == '/'; --cp)
|
||||
continue;
|
||||
|
||||
while (cp > path) {
|
||||
/* See if the pathname ending here exists... */
|
||||
*cp = '\0';
|
||||
errno = 0;
|
||||
rc = stat(path, buf);
|
||||
if (cp != end)
|
||||
*cp = '/';
|
||||
|
||||
if (!rc) {
|
||||
if (S_ISDIR(buf->st_mode) && last_cp) {
|
||||
buf->st_mode = 0; /* No such file... */
|
||||
cp = last_cp;
|
||||
}
|
||||
r->path_info = pstrdup(r->pool, cp);
|
||||
*cp = '\0';
|
||||
return OK;
|
||||
}
|
||||
|
||||
else if (errno == ENOENT || errno == ENOTDIR) {
|
||||
last_cp = cp;
|
||||
while (--cp > path && *cp != '/')
|
||||
continue;
|
||||
while (cp > path && cp[-1] == '/')
|
||||
--cp;
|
||||
} else if (errno != EACCES) {
|
||||
/*
|
||||
* this would be really bad since we checked the entire path
|
||||
* earlier and got ENOTDIR instead of EACCES - so why are we getting
|
||||
* it now? Anyway, we ought to return FORBIDDEN
|
||||
*/
|
||||
return HTTP_FORBIDDEN;
|
||||
}
|
||||
}
|
||||
r->filename = pstrdup(r->pool, path);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks to see if actual access to the URL is permitted or not
|
||||
* stats the URI first, if failure returns FORBIDDEN, if allowed then
|
||||
* checks to see if it is a file, dir or LINK (TEST), and accordingly does more
|
||||
*/
|
||||
static int
|
||||
can_access(request_rec * r)
|
||||
{
|
||||
int rc;
|
||||
char *doc_root = (char *)DOCUMENT_ROOT(r);
|
||||
struct stat buf;
|
||||
char path[MAX_STRING_LEN];
|
||||
|
||||
afsassert(r->uri);
|
||||
afsassert(doc_root);
|
||||
|
||||
if (r->filename) {
|
||||
afslog(10, ("%s: Found r->filename:%s", module_name, r->filename));
|
||||
sprintf(path, "%s", r->filename);
|
||||
} else {
|
||||
afslog(10,
|
||||
("%s: Composing path from doc_root:%s and r->uri:%s",
|
||||
module_name, doc_root, r->uri));
|
||||
sprintf(path, "%s/%s", doc_root, r->uri);
|
||||
afslog(10, ("%s: Path:%s", module_name, path));
|
||||
}
|
||||
rc = stat(path, &buf);
|
||||
if (rc == -1) {
|
||||
afslog(2,
|
||||
("%s: pid:%d\tpath:%s\tstat error:%s", module_name, getpid(),
|
||||
path, strerror(errno)));
|
||||
|
||||
/*
|
||||
* if the requested method is an HTTP PUT and the file does not
|
||||
* exist then well, we'll get a stat error but we shouldn't return
|
||||
* an error - we should try and open the file in append mode and then
|
||||
* see if we get a permission denied error
|
||||
*/
|
||||
if ((strncmp(r->method, "PUT", 3) == 0) && (errno == ENOENT)) {
|
||||
FILE *f = fopen(path, "a");
|
||||
if (f == NULL) {
|
||||
if (errno == EACCES) {
|
||||
afslog(2,
|
||||
("%s: Either AFS acls or other permissions forbid write"
|
||||
" access to file %s for user %s", module_name,
|
||||
path,
|
||||
r->connection->user ? r->connection->
|
||||
user : "UNKNOWN"));
|
||||
return FORBIDDEN;
|
||||
} else {
|
||||
log_reason
|
||||
("afs_module: Error checking file for PUT method",
|
||||
r->uri, r);
|
||||
return SERVER_ERROR;
|
||||
}
|
||||
}
|
||||
} else if (errno == ENOTDIR) {
|
||||
/*
|
||||
* maybe the special case of CGI PATH_INFO to be translated to
|
||||
* PATH_TRANSLATED - check each component of this path
|
||||
* and stat it to see what portion of the url is actually
|
||||
* the path and discard the rest for our purposes.
|
||||
*/
|
||||
rc = remove_path_info(r, path, &buf);
|
||||
afslog(10,
|
||||
("%s:remove_path_info returned %d path:%s", module_name,
|
||||
rc, path));
|
||||
if (rc)
|
||||
return rc;
|
||||
} else {
|
||||
return sort_stat_error(r);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we get here then we have something - either a file or a directory
|
||||
*/
|
||||
else {
|
||||
if (S_IFREG == (buf.st_mode & S_IFMT)) {
|
||||
/* regular file */
|
||||
FILE *f;
|
||||
char permissions[] = { 'r', '\0', '\0', '\0' }; /* room for +, etc... */
|
||||
|
||||
if ((strncmp(r->method, "PUT", 3) == 0)) {
|
||||
strcpy(permissions, "a");
|
||||
}
|
||||
if (!(f = fopen(path, permissions))) {
|
||||
if (errno == EACCES) {
|
||||
afslog(2,
|
||||
("%s: Either AFS acls or other permissions"
|
||||
" forbid access to file %s for user %s",
|
||||
module_name, path,
|
||||
r->connection->user ? r->connection->
|
||||
user : "UNKNOWN"));
|
||||
return FORBIDDEN;
|
||||
} else {
|
||||
char error[ERRSTRLEN];
|
||||
sprintf(error,
|
||||
"%s: Error checking file %s for permissions:%s",
|
||||
module_name, path, strerror(errno));
|
||||
log_reason(error, r->uri, r);
|
||||
return SERVER_ERROR;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
return OK;
|
||||
}
|
||||
if (S_IFDIR == (buf.st_mode & S_IFMT)) {
|
||||
/* path is a directory */
|
||||
|
||||
if (r->uri[strlen(r->uri) - 1] != '/') {
|
||||
/* if we don't have a trailing slash, return REDIRECT */
|
||||
char *ifile;
|
||||
if (r->args != NULL) {
|
||||
ifile =
|
||||
PSTRCAT(r->pool, escape_uri(r->pool, r->uri), "/",
|
||||
"?", r->args, NULL);
|
||||
} else {
|
||||
ifile =
|
||||
PSTRCAT(r->pool, escape_uri(r->pool, r->uri), "/",
|
||||
NULL);
|
||||
}
|
||||
TABLE_SET(r->headers_out, "Location", ifile);
|
||||
return REDIRECT;
|
||||
} else {
|
||||
DIR *d;
|
||||
if (!(d = opendir(path))) {
|
||||
if (errno == EACCES) {
|
||||
afslog(2,
|
||||
("%s: Error accessing dir %s - %s",
|
||||
module_name, path, strerror(errno)));
|
||||
return FORBIDDEN;
|
||||
} else {
|
||||
char error[ERRSTRLEN];
|
||||
sprintf(error, "%s: opendir failed with Error:%s",
|
||||
module_name, strerror(errno));
|
||||
log_reason(error, r, r->uri);
|
||||
return SERVER_ERROR;
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Logs requests which led to a FORBIDDEN return code provided a token
|
||||
* existed. Added feature (SetAFSAccessLog) in beta2
|
||||
*/
|
||||
static int
|
||||
log_Access_Error(request_rec * r)
|
||||
{
|
||||
if (FIND_LINKED_MODULE("afs_module.c") != NULL) {
|
||||
char err_msg[1024];
|
||||
int rc = 0;
|
||||
int len = 0;
|
||||
extern int logfd;
|
||||
|
||||
if (r->connection->user)
|
||||
sprintf(err_msg,
|
||||
"[%s] AFS ACL's deny permission to "
|
||||
"user: %s for URI:%s\n", GET_TIME(), r->connection->user,
|
||||
r->uri);
|
||||
else
|
||||
sprintf(err_msg,
|
||||
"[%s] AFS ACL's deny permission to user - for URI:%s\n",
|
||||
GET_TIME(), r->uri);
|
||||
|
||||
len = strlen(err_msg);
|
||||
rc = write(logfd, err_msg, len);
|
||||
|
||||
if (rc != len) {
|
||||
afslog(0,
|
||||
("%s: Error logging message:%s - %s", module_name, err_msg,
|
||||
strerror(errno)));
|
||||
return -1;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The interface - hook to obtain an AFS token if needed based on the
|
||||
* result of a stat (returned by can_access) or an open file
|
||||
*/
|
||||
int
|
||||
afs_auth_internal(request_rec * r, char *cell)
|
||||
{
|
||||
afsassert(r);
|
||||
afsassert(r->uri);
|
||||
afsassert(cell);
|
||||
if (FIND_LINKED_MODULE("afs_module.c") != NULL) {
|
||||
int rc, status;
|
||||
char *type;
|
||||
static int haveToken = 1; /* assume that we always have a token */
|
||||
extern int logAccessErrors;
|
||||
|
||||
/*
|
||||
* Get afs_authtype directive value for that directory or location
|
||||
*/
|
||||
type = (char *)get_afsauthtype(r);
|
||||
|
||||
/*
|
||||
* UserDir (tilde) support
|
||||
*/
|
||||
#ifndef APACHE_1_3
|
||||
if (FIND_LINKED_MODULE("mod_userdir.c") != NULL) {
|
||||
rc = translate_userdir(r);
|
||||
if ((rc != OK) && (rc != DECLINED)) {
|
||||
LOG_REASON("afs_module: Failure while translating userdir",
|
||||
r->uri, r);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
afslog(20, ("%s: pid:%d r->uri:%s", module_name, getpid(), r->uri));
|
||||
if (type)
|
||||
afslog(20, ("%s: AFSAuthType: %s", module_name, type));
|
||||
else
|
||||
afslog(20, ("%s: AFSAuthType NULL", module_name));
|
||||
|
||||
/* if AuthType is not AFS, then unlog any existing tokens and DECLINE */
|
||||
if (type == NULL) {
|
||||
if (haveToken)
|
||||
unlog();
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
if ((strcasecmp(type, AFS_AUTHTYPE))
|
||||
&& (strcasecmp(type, AFS_DFS_AUTHTYPE))) {
|
||||
if (haveToken)
|
||||
unlog();
|
||||
afslog(10,
|
||||
("%s: Error unknown AFSAuthType:%s returning DECLINED",
|
||||
module_name, type));
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
if (cell)
|
||||
status =
|
||||
authenticateUser(r, cell, afs_str->cacheExpiration, type);
|
||||
else
|
||||
status =
|
||||
authenticateUser(r, afs_str->defaultCell,
|
||||
afs_str->cacheExpiration, type);
|
||||
|
||||
if (status != OK) {
|
||||
afslog(10, ("%s: Returning status %d", module_name, status));
|
||||
return status;
|
||||
}
|
||||
|
||||
/* can we access this URL? */
|
||||
rc = can_access(r);
|
||||
|
||||
if (rc == OK) {
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
if (rc == REDIRECT) {
|
||||
return REDIRECT;
|
||||
}
|
||||
|
||||
if (rc == FORBIDDEN) {
|
||||
rc = forbToAuthReqd(r);
|
||||
if (rc == FORBIDDEN) {
|
||||
if (logAccessErrors) {
|
||||
log_Access_Error(r);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
return DECLINED;
|
||||
}
|
||||
}
|
@ -1,241 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains routines common to both the client and the server-
|
||||
* primarily an interface routine to the pioctl call
|
||||
* and a routine for setting the primary flag in the token structure in
|
||||
* order to create a new PAG while doing the SET TOKEN. In addition there are
|
||||
* debugging routines of interest to both the client and server processes
|
||||
*/
|
||||
|
||||
#include "apache_afs_utils.h"
|
||||
#include "apache_afs_utils.h"
|
||||
|
||||
/*
|
||||
* do_pioctl does the actual call to pioctl (or equivalent for that platform)
|
||||
* sets up the ViceIoctl buffer with all the parameters required
|
||||
* NOTE: in_buffer and out_buffer may point to the same memory buffer
|
||||
*/
|
||||
int
|
||||
do_pioctl(char *in_buffer, int in_size, char *out_buffer, int out_size,
|
||||
int opcode, char *path, int followSymLinks)
|
||||
{
|
||||
struct ViceIoctl iob;
|
||||
iob.in = in_buffer;
|
||||
iob.in_size = in_size;
|
||||
iob.out = out_buffer;
|
||||
iob.out_size = out_size;
|
||||
|
||||
#ifdef AFS_USR_SUN5_ENV
|
||||
return syscall(AFS_SYSCALL, AFSCALL_PIOCTL, path, _VICEIOCTL(opcode),
|
||||
&iob, followSymLinks);
|
||||
#else /* AFS_USR_SUN5_ENV */
|
||||
return lpioctl(path, _VICEIOCTL(opcode), &iob, followSymLinks);
|
||||
#endif /* AFS_USR_SUN5_ENV */
|
||||
}
|
||||
|
||||
int
|
||||
do_setpag()
|
||||
{
|
||||
int code;
|
||||
|
||||
do {
|
||||
code = lsetpag();
|
||||
} while (code && errno == EINTR);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return 1 if we have a token, 0 if we don't
|
||||
*/
|
||||
int
|
||||
haveToken()
|
||||
{
|
||||
char temp[1024];
|
||||
afs_int32 i = 0;
|
||||
int code;
|
||||
|
||||
memcpy((void *)temp, (void *)&i, sizeof(afs_int32));
|
||||
code =
|
||||
do_pioctl(temp, sizeof(afs_int32), temp, sizeof(temp), VIOCGETTOK,
|
||||
NULL, 0);
|
||||
if (code)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* flipPrimary sets the primary cell longword -
|
||||
* enabling a SETPAG if the same buffer is used with VICESETTOK
|
||||
*/
|
||||
flipPrimary(char *tokenBuf)
|
||||
{
|
||||
afs_int32 i;
|
||||
char *temp = tokenBuf;
|
||||
|
||||
/* skip over the secret token */
|
||||
memcpy(&i, temp, sizeof(afs_int32));
|
||||
temp += (i + sizeof(afs_int32));
|
||||
|
||||
/* skip over the clear token */
|
||||
memcpy(&i, temp, sizeof(afs_int32));
|
||||
temp += (i + sizeof(afs_int32));
|
||||
|
||||
/* set the primary flag */
|
||||
memcpy(&i, temp, sizeof(afs_int32));
|
||||
i |= 0x8000;
|
||||
memcpy(temp, &i, sizeof(afs_int32));
|
||||
temp += sizeof(afs_int32);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns the AFS pag number, if any, otherwise return -1 */
|
||||
afs_int32
|
||||
getPAG()
|
||||
{
|
||||
afs_int32 pag;
|
||||
|
||||
assert(sizeof(afs_uint32) == 4);
|
||||
assert(sizeof(afs_int32) == 4);
|
||||
|
||||
pag = ktc_curpag();
|
||||
if (pag == 0 || pag == -1)
|
||||
return -1;
|
||||
|
||||
/* high order byte is always 'A'; actual pag value is low 24 bits */
|
||||
return (pag & 0xFFFFFF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write out the formatted string to the error log if the specified level
|
||||
* is greater than or equal to the global afsDebugLevel which is set by
|
||||
* the directive SetAFSDebugLevel in the httpd.conf file
|
||||
*/
|
||||
/* VARARGS1 */
|
||||
void
|
||||
afsLogError(a, b, c, d, e, f, g, h, i, j, k, l, m, n)
|
||||
char *a;
|
||||
char *b;
|
||||
char *c;
|
||||
char *d;
|
||||
char *e;
|
||||
char *f;
|
||||
char *g;
|
||||
char *h;
|
||||
char *i;
|
||||
char *j;
|
||||
char *k;
|
||||
char *l;
|
||||
char *m;
|
||||
char *n;
|
||||
{
|
||||
char reason[1024];
|
||||
|
||||
sprintf(reason, a, b, c, d, e, f, g, h, i, j, k, l, m, n);
|
||||
/* LOG_REASON(reason,r->uri,r); */
|
||||
strcat(reason, "\n");
|
||||
fprintf(stderr, reason);
|
||||
}
|
||||
|
||||
|
||||
/* the following are debug utilities */
|
||||
|
||||
void
|
||||
hexDump(char *tbuffer, int len)
|
||||
{
|
||||
int i;
|
||||
int byte;
|
||||
char *temp = tbuffer;
|
||||
|
||||
fprintf(stderr, "HEXDUMP:\n");
|
||||
for (i = 0; i < len; i++) {
|
||||
byte = *temp;
|
||||
temp++;
|
||||
fprintf(stderr, "%x", byte);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* debugging utility to see if the group id changes - if SETPAG worked
|
||||
* call this before and after the routine to dosetpag and verify results
|
||||
*/
|
||||
|
||||
int
|
||||
printGroups()
|
||||
{
|
||||
int numGroups, i;
|
||||
gid_t grouplist[NGROUPS_MAX];
|
||||
|
||||
numGroups = getgroups(NGROUPS_MAX, &grouplist[0]);
|
||||
if (numGroups == -1) {
|
||||
perror("getgroups:");
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < numGroups; i++) {
|
||||
fprintf(stderr, "grouplist[%d]=%d\n", i, grouplist[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* prints clear token fields, cell name and primary flag to stdout
|
||||
*/
|
||||
|
||||
void
|
||||
parseToken(char *buf)
|
||||
{
|
||||
afs_int32 len = 0;
|
||||
char cellName[64];
|
||||
char *tp;
|
||||
|
||||
struct ClearToken {
|
||||
afs_int32 AuthHandle;
|
||||
char HandShakeKey[8];
|
||||
afs_int32 ViceId;
|
||||
afs_int32 BeginTimestamp;
|
||||
afs_int32 EndTimestamp;
|
||||
} clearToken;
|
||||
|
||||
assert(buf != NULL);
|
||||
|
||||
tp = buf;
|
||||
memcpy(&len, tp, sizeof(afs_int32)); /* get size of secret token */
|
||||
tp += (sizeof(afs_int32) + len); /* skip secret token */
|
||||
|
||||
memcpy(&len, tp, sizeof(afs_int32)); /* get size of clear token */
|
||||
if (len != sizeof(struct ClearToken)) {
|
||||
fprintf(stderr,
|
||||
"weblog:parseToken: error getting length of ClearToken\n");
|
||||
return;
|
||||
}
|
||||
|
||||
tp += sizeof(afs_int32); /* skip length of cleartoken */
|
||||
memcpy(&clearToken, tp, sizeof(struct ClearToken)); /* copy cleartoken */
|
||||
|
||||
tp += len; /* skip clear token itself */
|
||||
|
||||
memcpy(&len, tp, sizeof(afs_int32)); /* copy the primary flag */
|
||||
tp += sizeof(afs_int32); /* skip primary flag */
|
||||
|
||||
/* tp now points to the cell name */
|
||||
strcpy(cellName, tp);
|
||||
|
||||
fprintf(stderr, "CellName:%s\n", cellName);
|
||||
fprintf(stderr, "Primary Flag (Hex):%x\n", len);
|
||||
fprintf(stderr,
|
||||
"ClearToken Fields:-\nAuthHandle=%d\n"
|
||||
"ViceId=%d\nBeginTimestamp=%d\nEndTimestamp=%d\n",
|
||||
clearToken.AuthHandle, clearToken.ViceId,
|
||||
clearToken.BeginTimestamp, clearToken.EndTimestamp);
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
#ifndef _APACHE_AFS_UTILS_H_INCLUDED_
|
||||
#define _APACHE_AFS_UTILS_H_INCLUDED_
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <afs/vice.h>
|
||||
#include <afs/kautils.h>
|
||||
|
||||
#include <netinet/in.h> /* had to put this for in_addr used in venus.h */
|
||||
#include <afs/venus.h> /* for pioctl opcode defines */
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(A,B) ((A)>(B)?(A):(B))
|
||||
#endif /* !MAX */
|
||||
#ifndef MIN
|
||||
#define MIN(A,B) ((A)<(B)?(A):(B))
|
||||
#endif /* !MAX */
|
||||
|
||||
|
||||
extern int do_pioctl(char *in_buffer, int in_size, char *out_buffer,
|
||||
int out_size, int opcode, char *path,
|
||||
int followSymLinks);
|
||||
|
||||
extern int flipPrimary(char *tokenBuf);
|
||||
extern afs_int32 getPAG();
|
||||
extern int haveToken();
|
||||
|
||||
extern u_long afsDebugLevel;
|
||||
#define afslog(level,str) if (level <= afsDebugLevel) (afsLogError str)
|
||||
|
||||
/* these are routines used solely for debugging purposes */
|
||||
extern void hexDump(char *tbuffer, int len);
|
||||
extern void parseToken(char *buf);
|
||||
extern int printGroups();
|
||||
|
||||
|
||||
#endif /*_APACHE_AFS_UTILS_H_INCLUDED_ */
|
@ -1,259 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/* the wrapper nanny process around weblog that would restart it in case it
|
||||
* failed and hopefully log the error somewhere! The need for this nanny
|
||||
* process arises because the pipe descriptors need to be maintained. The
|
||||
* process catches SIGTERM and kills the weblog process and exits.
|
||||
* The following line needs to precede the kill -TERM line for httpd.pid
|
||||
* in the stopd script to stop the server
|
||||
kill -TERM `<cat /local/stronghold/apache/logs/httpd.pid>.afs`
|
||||
* or whatever the pid file
|
||||
*/
|
||||
|
||||
#include <afs/stds.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "weblog_errors.h"
|
||||
#include "AFS_component_version_number.c"
|
||||
|
||||
#define WEBLOG_BIN "weblog"
|
||||
|
||||
/* TODO - set restart_attempts to 0 if not within certain time period */
|
||||
#define MAX_RESTARTS 3 /* after this many restarts just die */
|
||||
static int restart_attempts = 0;
|
||||
|
||||
int error_fd; /* error file descriptor */
|
||||
|
||||
void
|
||||
sig_term()
|
||||
{
|
||||
#ifdef AIX
|
||||
pid_t pgrp = getpgrp();
|
||||
#else
|
||||
pid_t pgrp = getpgrp(0);
|
||||
#endif
|
||||
int n;
|
||||
|
||||
#ifdef DEBUG
|
||||
write(2, "weblog_starter: caught SIGTERM, shutting down", 43);
|
||||
#endif
|
||||
|
||||
log_error("weblog_starter: caught SIGTERM, shutting down");
|
||||
|
||||
if (pgrp == (pid_t) - 1) {
|
||||
log_error("getpgrp failed - kill weblog manually");
|
||||
write(2, "getpgrp failed - kill weblog manually", 38);
|
||||
exit(1);
|
||||
}
|
||||
kill(-pgrp, SIGKILL);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* strip out this binary and replace it with the weblog binary's name */
|
||||
getpath(char *this, char *path)
|
||||
{
|
||||
char *temp = &this[0];
|
||||
int len = strlen(this);
|
||||
int pos = 0, i = 0, j = 0;
|
||||
char bin_name[] = WEBLOG_BIN;
|
||||
int len1 = strlen(bin_name);
|
||||
|
||||
strcpy(path, this);
|
||||
temp += (len);
|
||||
pos = len;
|
||||
while (*temp != '/') {
|
||||
temp--;
|
||||
pos--;
|
||||
}
|
||||
for (i = (pos + 1); i < len; i++, j++) {
|
||||
path[i] = bin_name[j];
|
||||
if (j >= len1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
get_time()
|
||||
{
|
||||
time_t t;
|
||||
char *time_string;
|
||||
|
||||
t = time(NULL);
|
||||
time_string = (char *)ctime(&t);
|
||||
time_string[strlen(time_string) - 1] = '\0';
|
||||
return (time_string);
|
||||
}
|
||||
|
||||
log_error(char *msg)
|
||||
{
|
||||
char err_msg[1024];
|
||||
|
||||
sprintf(err_msg, "[%s] weblog:%s\n", get_time(), msg);
|
||||
write(error_fd, (void *)err_msg, strlen(err_msg));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
pid_t weblog_pid;
|
||||
int stat = -1;
|
||||
int exitstatus = 0;
|
||||
char rn[] = "weblog_starter";
|
||||
char path[1024];
|
||||
char error_fname[1024];
|
||||
|
||||
struct sigaction sa;
|
||||
|
||||
memset(&sa, 0, sizeof sa);
|
||||
sa.sa_handler = (void (*)())sig_term;
|
||||
if (sigaction(SIGTERM, &sa, NULL) < 0) {
|
||||
perror("sigaction(SIGTERM)");
|
||||
}
|
||||
|
||||
getpath(argv[1], path);
|
||||
strcpy(error_fname, argv[2]);
|
||||
|
||||
error_fd = open(error_fname, O_WRONLY | O_APPEND | O_CREAT);
|
||||
if (error_fd < 0) {
|
||||
fprintf(stderr, "%s:Error opening log file:%s\nExiting\n", rn,
|
||||
error_fname);
|
||||
perror("open");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
log_error("weblog_starter resuming normal operation");
|
||||
|
||||
while (restart_attempts < MAX_RESTARTS) {
|
||||
/* fork the weblog process and wait till it exits */
|
||||
if ((weblog_pid = fork()) < 0) {
|
||||
log_error("Could not fork process");
|
||||
#ifdef DEBUG
|
||||
perror("apache_afs_weblog:Could not fork process");
|
||||
#endif
|
||||
exit(-1);
|
||||
}
|
||||
switch (weblog_pid) {
|
||||
case 0:
|
||||
/* the child process - in this case weblog */
|
||||
execlp(path, "weblog", argv[3], argv[4], argv[5], argv[6], NULL);
|
||||
#ifdef DEBUG
|
||||
perror("apache_afs_weblog:Could not execute weblog");
|
||||
#endif
|
||||
exit(RESTARTERROR);
|
||||
|
||||
default:
|
||||
/* parent: just wait for the child */
|
||||
weblog_pid = waitpid((pid_t) - 1, &stat, 0);
|
||||
|
||||
if (weblog_pid == -1) {
|
||||
#ifdef DEBUG
|
||||
perror("apache_Afs_weblog: wait error");
|
||||
#endif
|
||||
log_error("wait error");
|
||||
kill(getpid(), SIGTERM);
|
||||
}
|
||||
|
||||
if (WIFEXITED(stat)) {
|
||||
exitstatus = WEXITSTATUS(stat);
|
||||
switch (exitstatus) {
|
||||
case 0:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:No error ... restarting\n", rn);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case RESTART:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:%s...Exiting\n", rn, RESTARTMSG);
|
||||
#endif
|
||||
log_error(RESTARTMSG);
|
||||
exit(-1);
|
||||
|
||||
case NULLARGS:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:%s...Exiting\n", rn, NULLARGSMSG);
|
||||
log_error(NULLARGSMSG);
|
||||
#endif
|
||||
exit(-1);
|
||||
|
||||
case PIPESEND:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:%s...Restarting\n", rn, PIPESENDMSG);
|
||||
#endif
|
||||
log_error(PIPESENDMSG);
|
||||
break;
|
||||
|
||||
case PIPEREAD:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:%s...Exiting\n", rn, PIPEREADMSG);
|
||||
#endif
|
||||
log_error(PIPEREADMSG);
|
||||
exit(-1);
|
||||
|
||||
case PARSE:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:%s...Exiting\n", rn, PARSEMSG);
|
||||
#endif
|
||||
log_error(PARSEMSG);
|
||||
exit(-1);
|
||||
|
||||
case KA:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:%s...Exiting\n", rn, KAMSG);
|
||||
#endif
|
||||
log_error(KAMSG);
|
||||
exit(-1);
|
||||
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:Unknown error...Exiting\n", rn);
|
||||
#endif
|
||||
log_error("Unknown error");
|
||||
exit(-1);
|
||||
} /* switch (exitstatus) */
|
||||
}
|
||||
/* if weblog exited */
|
||||
else { /* weblog terminated abnormally */
|
||||
if (WIFSIGNALED(stat)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"%s:The signal that terminated weblog:%d\n"
|
||||
"Restarting weblog ...\n", rn, WTERMSIG(stat));
|
||||
#endif
|
||||
}
|
||||
#ifndef AIX
|
||||
else if (WCOREDUMP(stat)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s: weblog dumped core" "Exiting ...\n",
|
||||
rn);
|
||||
#endif
|
||||
log_error("Core dump");
|
||||
exit(-1);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"%s: weblog died under STRANGE circumstances..."
|
||||
"restarting weblog\n", rn);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
} /* switch(weblog_pid) */
|
||||
restart_attempts++;
|
||||
} /* while */
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* Apache API calls required by libapacheafs.a
|
||||
*/
|
||||
|
||||
#ifndef _APACHE_API_H_INCLUDED_
|
||||
#define _APACHE_API_H_INCLUDED_
|
||||
|
||||
#ifdef APACHE_1_3
|
||||
|
||||
#ifdef APACHE_1_3_1
|
||||
#include "1.3.1/httpd.h"
|
||||
#include "1.3.1/http_conf_globals.h"
|
||||
#include "1.3.1/ap_compat.h"
|
||||
#elif defined(APACHE_1_3_6)
|
||||
#include "1.3.6/httpd.h"
|
||||
#include "1.3.6/http_conf_globals.h"
|
||||
#include "1.3.6/ap_compat.h"
|
||||
#else
|
||||
#error No Apache subversion defined for APACHE_1_3 (such as APACHE_1_3_6)
|
||||
#endif /* APACHE_1_3_1 */
|
||||
|
||||
#define OS_ESCAPE_PATH ap_os_escape_path
|
||||
#define TABLE_SET ap_table_set
|
||||
#define TABLE_GET ap_table_get
|
||||
#define PID_FNAME ap_pid_fname
|
||||
#define GETWORD ap_getword
|
||||
#define GETWORD_NULLS ap_getword_nulls
|
||||
#define GET_TIME ap_get_time
|
||||
#define UUDECODE ap_uudecode
|
||||
#define DOCUMENT_ROOT ap_document_root
|
||||
#define PSTRCAT ap_pstrcat
|
||||
#define LOG_REASON ap_log_reason
|
||||
#define FIND_LINKED_MODULE ap_find_linked_module
|
||||
#else
|
||||
#include "1.2/httpd.h"
|
||||
#include "1.2/http_conf_globals.h" /* for pid_fname */
|
||||
|
||||
#define OS_ESCAPE_PATH os_escape_path
|
||||
#define TABLE_SET table_set
|
||||
#define TABLE_GET table_get
|
||||
#define PID_FNAME pid_fname
|
||||
#define GETWORD getword
|
||||
#define GETWORD_NULLS getword_nulls
|
||||
#define GET_TIME get_time
|
||||
#define UUDECODE uudecode
|
||||
#define DOCUMENT_ROOT document_root
|
||||
#define PSTRCAT pstrcat
|
||||
#define LOG_REASON log_reason
|
||||
#define FIND_LINKED_MODULE find_linked_module
|
||||
#endif
|
||||
#endif /* _APACHE_API_H_INCLUDED_ */
|
@ -1,252 +0,0 @@
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Resource allocation routines...
|
||||
*
|
||||
* designed so that we don't have to keep track of EVERYTHING so that
|
||||
* it can be explicitly freed later (a fundamentally unsound strategy ---
|
||||
* particularly in the presence of die()).
|
||||
*
|
||||
* Instead, we maintain pools, and allocate items (both memory and I/O
|
||||
* handlers) from the pools --- currently there are two, one for per
|
||||
* transaction info, and one for config info. When a transaction is over,
|
||||
* we can delete everything in the per-transaction pool without fear, and
|
||||
* without thinking too hard about it either.
|
||||
*
|
||||
* rst
|
||||
*/
|
||||
|
||||
/* Arenas for configuration info and transaction info
|
||||
* --- actual layout of the pool structure is private to
|
||||
* alloc.c.
|
||||
*/
|
||||
|
||||
typedef struct pool pool;
|
||||
|
||||
extern pool *permanent_pool;
|
||||
void init_alloc(); /* Set up everything */
|
||||
pool *make_sub_pool(pool *); /* All pools are subpools of permanent_pool */
|
||||
void destroy_pool(pool *);
|
||||
|
||||
/* Clearing out EVERYTHING in an pool... destroys any sub-pools */
|
||||
|
||||
void clear_pool(struct pool *);
|
||||
|
||||
/* Preparing for exec() --- close files, etc., but *don't* flush I/O
|
||||
* buffers, *don't* wait for subprocesses, and *don't* free any memory.
|
||||
*/
|
||||
|
||||
void cleanup_for_exec();
|
||||
|
||||
/* routines to allocate memory from an pool... */
|
||||
|
||||
void *palloc(struct pool *, int nbytes);
|
||||
void *pcalloc(struct pool *, int nbytes);
|
||||
extern char *pstrdup(struct pool *, const char *s);
|
||||
extern char *pstrndup(struct pool *, const char *s, int n);
|
||||
char *pstrcat(struct pool *, ...); /* all '...' must be char* */
|
||||
|
||||
/* array and alist management... keeping lists of things.
|
||||
* Common enough to want common support code ...
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
pool *pool;
|
||||
int elt_size;
|
||||
int nelts;
|
||||
int nalloc;
|
||||
char *elts;
|
||||
} array_header;
|
||||
|
||||
array_header *make_array(pool * p, int nelts, int elt_size);
|
||||
void *push_array(array_header *);
|
||||
void array_cat(array_header * dst, const array_header * src);
|
||||
array_header *append_arrays(pool *, const array_header *,
|
||||
const array_header *);
|
||||
|
||||
/* copy_array copies the *entire* array. copy_array_hdr just copies
|
||||
* the header, and arranges for the elements to be copied if (and only
|
||||
* if) the code subsequently does a push or arraycat.
|
||||
*/
|
||||
|
||||
array_header *copy_array(pool * p, const array_header * src);
|
||||
array_header *copy_array_hdr(pool * p, const array_header * src);
|
||||
|
||||
|
||||
/* Tables. Implemented alist style, for now, though we try to keep
|
||||
* it so that imposing a hash table structure on top in the future
|
||||
* wouldn't be *too* hard...
|
||||
*
|
||||
* Note that key comparisons for these are case-insensitive, largely
|
||||
* because that's what's appropriate and convenient everywhere they're
|
||||
* currently being used...
|
||||
*/
|
||||
|
||||
typedef array_header table;
|
||||
|
||||
typedef struct {
|
||||
char *key; /* maybe NULL in future;
|
||||
* check when iterating thru table_elts
|
||||
*/
|
||||
char *val;
|
||||
} table_entry;
|
||||
|
||||
table *make_table(pool * p, int nelts);
|
||||
table *copy_table(pool * p, const table *);
|
||||
void clear_table(table *);
|
||||
char *table_get(const table *, const char *);
|
||||
void table_set(table *, const char *name, const char *val);
|
||||
void table_merge(table *, const char *name, const char *more_val);
|
||||
void table_unset(table *, const char *key);
|
||||
void table_add(table *, const char *name, const char *val);
|
||||
void table_do(int (*comp) (void *, const char *, const char *), void *rec,
|
||||
const table * t, ...);
|
||||
|
||||
table *overlay_tables(pool * p, const table * overlay, const table * base);
|
||||
|
||||
array_header *table_elts(table *);
|
||||
|
||||
#define is_empty_table(t) (((t) == NULL)||((t)->nelts == 0))
|
||||
|
||||
/* routines to remember allocation of other sorts of things...
|
||||
* generic interface first. Note that we want to have two separate
|
||||
* cleanup functions in the general case, one for exec() preparation,
|
||||
* to keep CGI scripts and the like from inheriting access to things
|
||||
* they shouldn't be able to touch, and one for actually cleaning up,
|
||||
* when the actual server process wants to get rid of the thing,
|
||||
* whatever it is.
|
||||
*
|
||||
* kill_cleanup disarms a cleanup, presumably because the resource in
|
||||
* question has been closed, freed, or whatever, and it's scarce
|
||||
* enough to want to reclaim (e.g., descriptors). It arranges for the
|
||||
* resource not to be cleaned up a second time (it might have been
|
||||
* reallocated). run_cleanup does the same, but runs it first.
|
||||
*
|
||||
* Cleanups are identified for purposes of finding & running them off by the
|
||||
* plain_cleanup and data, which should presumably be unique.
|
||||
*
|
||||
* NB any code which invokes register_cleanup or kill_cleanup directly
|
||||
* is a critical section which should be guarded by block_alarms() and
|
||||
* unblock_alarms() below...
|
||||
*/
|
||||
|
||||
void register_cleanup(pool * p, void *data, void (*plain_cleanup) (void *),
|
||||
void (*child_cleanup) (void *));
|
||||
|
||||
void kill_cleanup(pool * p, void *data, void (*plain_cleanup) (void *));
|
||||
void run_cleanup(pool * p, void *data, void (*cleanup) (void *));
|
||||
|
||||
/* The time between when a resource is actually allocated, and when it
|
||||
* its cleanup is registered is a critical section, during which the
|
||||
* resource could leak if we got interrupted or timed out. So, anything
|
||||
* which registers cleanups should bracket resource allocation and the
|
||||
* cleanup registry with these. (This is done internally by run_cleanup).
|
||||
*
|
||||
* NB they are actually implemented in http_main.c, since they are bound
|
||||
* up with timeout handling in general...
|
||||
*/
|
||||
|
||||
extern void block_alarms();
|
||||
extern void unblock_alarms();
|
||||
|
||||
/* Common cases which want utility support..
|
||||
* the note_cleanups_for_foo routines are for
|
||||
*/
|
||||
|
||||
FILE *pfopen(struct pool *, const char *name, const char *fmode);
|
||||
FILE *pfdopen(struct pool *, int fd, const char *fmode);
|
||||
int popenf(struct pool *, const char *name, int flg, int mode);
|
||||
|
||||
void note_cleanups_for_file(pool *, FILE *);
|
||||
void note_cleanups_for_fd(pool *, int);
|
||||
void kill_cleanups_for_fd(pool * p, int fd);
|
||||
|
||||
regex_t *pregcomp(pool * p, const char *pattern, int cflags);
|
||||
void pregfree(pool * p, regex_t * reg);
|
||||
|
||||
/* routines to note closes... file descriptors are constrained enough
|
||||
* on some systems that we want to support this.
|
||||
*/
|
||||
|
||||
int pfclose(struct pool *, FILE *);
|
||||
int pclosef(struct pool *, int fd);
|
||||
|
||||
/* ... even child processes (which we may want to wait for,
|
||||
* or to kill outright, on unexpected termination).
|
||||
*
|
||||
* spawn_child is a utility routine which handles an awful lot of
|
||||
* the rigamarole associated with spawning a child --- it arranges
|
||||
* for pipes to the child's stdin and stdout, if desired (if not,
|
||||
* set the associated args to NULL). It takes as args a function
|
||||
* to call in the child, and an argument to be passed to the function.
|
||||
*/
|
||||
|
||||
enum kill_conditions { kill_never, kill_always, kill_after_timeout,
|
||||
just_wait
|
||||
};
|
||||
|
||||
int spawn_child_err(pool *, void (*)(void *), void *, enum kill_conditions,
|
||||
FILE ** pipe_in, FILE ** pipe_out, FILE ** pipe_err);
|
||||
#define spawn_child(p,f,v,k,in,out) spawn_child_err(p,f,v,k,in,out,NULL)
|
||||
|
||||
/* magic numbers --- min free bytes to consider a free pool block useable,
|
||||
* and the min amount to allocate if we have to go to malloc() */
|
||||
|
||||
#define BLOCK_MINFREE 4096
|
||||
#define BLOCK_MINALLOC 8192
|
||||
|
||||
/* Finally, some accounting */
|
||||
|
||||
long bytes_in_pool(pool * p);
|
||||
long bytes_in_free_blocks();
|
@ -1,138 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1996,1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Reading is buffered */
|
||||
#define B_RD (1)
|
||||
/* Writing is buffered */
|
||||
#define B_WR (2)
|
||||
#define B_RDWR (3)
|
||||
/* At end of file, or closed stream; no further input allowed */
|
||||
#define B_EOF (4)
|
||||
/* No further output possible */
|
||||
#define B_EOUT (8)
|
||||
/* A read error has occurred */
|
||||
#define B_RDERR (16)
|
||||
/* A write error has occurred */
|
||||
#define B_WRERR (32)
|
||||
#ifdef B_ERROR /* in SVR4: sometimes defined in /usr/include/sys/buf.h */
|
||||
#undef B_ERROR /* avoid "warning: `B_ERROR' redefined" */
|
||||
#endif
|
||||
#define B_ERROR (48)
|
||||
/* Use chunked writing */
|
||||
#define B_CHUNK (64)
|
||||
/* bflush() if a read would block */
|
||||
#define B_SAFEREAD (128)
|
||||
|
||||
typedef struct buff_struct BUFF;
|
||||
|
||||
struct buff_struct {
|
||||
int flags; /* flags */
|
||||
unsigned char *inptr; /* pointer to next location to read */
|
||||
int incnt; /* number of bytes left to read from input buffer;
|
||||
* always 0 if had a read error */
|
||||
int outchunk; /* location of chunk header when chunking */
|
||||
int outcnt; /* number of byte put in output buffer */
|
||||
unsigned char *inbase;
|
||||
unsigned char *outbase;
|
||||
int bufsiz;
|
||||
void (*error) (BUFF * fb, int op, void *data);
|
||||
void *error_data;
|
||||
long int bytes_sent; /* number of bytes actually written */
|
||||
|
||||
pool *pool;
|
||||
|
||||
/* could also put pointers to the basic I/O routines here */
|
||||
int fd; /* the file descriptor */
|
||||
int fd_in; /* input file descriptor, if different */
|
||||
};
|
||||
|
||||
/* Options to bset/getopt */
|
||||
#define BO_BYTECT (1)
|
||||
|
||||
/* Stream creation and modification */
|
||||
extern BUFF *bcreate(pool * p, int flags);
|
||||
extern void bpushfd(BUFF * fb, int fd_in, int fd_out);
|
||||
extern int bsetopt(BUFF * fb, int optname, const void *optval);
|
||||
extern int bgetopt(BUFF * fb, int optname, void *optval);
|
||||
extern int bsetflag(BUFF * fb, int flag, int value);
|
||||
extern int bclose(BUFF * fb);
|
||||
|
||||
#define bgetflag(fb, flag) ((fb)->flags & (flag))
|
||||
|
||||
/* Error handling */
|
||||
extern void bonerror(BUFF * fb, void (*error) (BUFF *, int, void *),
|
||||
void *data);
|
||||
|
||||
/* I/O */
|
||||
extern int bread(BUFF * fb, void *buf, int nbyte);
|
||||
extern int bgets(char *s, int n, BUFF * fb);
|
||||
extern int blookc(char *buff, BUFF * fb);
|
||||
extern int bskiplf(BUFF * fb);
|
||||
extern int bwrite(BUFF * fb, const void *buf, int nbyte);
|
||||
extern int bflush(BUFF * fb);
|
||||
extern int bputs(const char *x, BUFF * fb);
|
||||
extern int bvputs(BUFF * fb, ...);
|
||||
extern int bprintf(BUFF * fb, const char *fmt, ...);
|
||||
extern int vbprintf(BUFF * fb, const char *fmt, va_list vlist);
|
||||
|
||||
/* Internal routines */
|
||||
extern int bflsbuf(int c, BUFF * fb);
|
||||
extern int bfilbuf(BUFF * fb);
|
||||
|
||||
#define bgetc(fb) ( ((fb)->incnt == 0) ? bfilbuf(fb) : \
|
||||
((fb)->incnt--, *((fb)->inptr++)) )
|
||||
|
||||
#define bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
|
||||
(fb)->outcnt == (fb)->bufsiz) ? bflsbuf(c, (fb)) : \
|
||||
((fb)->outbase[(fb)->outcnt++] = (c), 0))
|
@ -1,756 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* conf.h: system-dependant #defines and includes...
|
||||
* See PORTING for a listing of what they mean
|
||||
*/
|
||||
|
||||
#if !defined(QNX) && !defined(MPE)
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
/* Define one of these according to your system. */
|
||||
#if defined(MPE)
|
||||
#include <sys/times.h>
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define NO_SETSID
|
||||
#define NO_KILLPG
|
||||
#define NO_WRITEV
|
||||
#define NEED_INITGROUPS
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRDUP
|
||||
#define NEED_STRNCASECMP
|
||||
extern void GETPRIVMODE();
|
||||
extern void GETUSERMODE();
|
||||
extern char *inet_ntoa();
|
||||
#define NO_SLACK
|
||||
|
||||
#elif defined(SUNOS4)
|
||||
#define HAVE_GMTOFF
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
char *crypt(const char *pw, const char *salt);
|
||||
char *mktemp(char *template);
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_MMAP
|
||||
#include <sys/time.h>
|
||||
#define NEED_STRERROR
|
||||
typedef int rlim_t;
|
||||
#ifndef HAVE_MEMMOVE
|
||||
#define memmove(a,b,c) memcpy(a, b, c)
|
||||
#endif
|
||||
#define NO_LINGCLOSE
|
||||
#define USE_FLOCK_SERIALIZED_ACCEPT
|
||||
|
||||
#elif defined(SOLARIS2)
|
||||
#undef HAVE_GMTOFF
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_CRYPT_H
|
||||
int gethostname(char *name, int namelen);
|
||||
|
||||
#elif defined(IRIX)
|
||||
#undef HAVE_GMTOFF
|
||||
/* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
|
||||
* there's some weird conflict with non-BSD signals */
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#define HAVE_SHMGET
|
||||
#define HAVE_CRYPT_H
|
||||
#define NO_LONG_DOUBLE
|
||||
#define HAVE_BSTRING_H
|
||||
#define NO_LINGCLOSE
|
||||
|
||||
#elif defined(HIUX)
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#undef HAVE_GMTOFF
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#ifndef _HIUX_SOURCE
|
||||
#define _HIUX_SOURCE
|
||||
#endif
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_SHMGET
|
||||
#define SELECT_NEEDS_CAST
|
||||
|
||||
#elif defined(HPUX) || defined(HPUX10)
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#undef HAVE_GMTOFF
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#ifndef _HPUX_SOURCE
|
||||
#define _HPUX_SOURCE
|
||||
#endif
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_SHMGET
|
||||
#ifndef HPUX10
|
||||
#define SELECT_NEEDS_CAST
|
||||
typedef int rlim_t;
|
||||
#endif
|
||||
|
||||
#elif defined(AIX)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define HAVE_SYS_SELECT_H
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#ifndef __ps2__
|
||||
#define HAVE_MMAP
|
||||
#define DEFAULT_GROUP "nobody"
|
||||
#endif
|
||||
#define DEFAULT_USER "nobody"
|
||||
#ifdef NEED_RLIM_T
|
||||
typedef int rlim_t;
|
||||
#endif
|
||||
|
||||
#elif defined(ULTRIX)
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define ULTRIX_BRAIN_DEATH
|
||||
#define NEED_STRDUP
|
||||
/* If you have Ultrix 4.3, and are using cc, const is broken */
|
||||
#ifndef __ultrix__ /* Hack to check for pre-Ultrix 4.4 cc */
|
||||
#define const /* Not implemented */
|
||||
#endif
|
||||
#define JMP_BUF sigjmp_buf
|
||||
|
||||
#elif defined(OSF1)
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_CRYPT_H
|
||||
#define NO_LONG_DOUBLE
|
||||
|
||||
#elif defined(PARAGON)
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_CRYPT_H
|
||||
#define NO_LONG_DOUBLE
|
||||
typedef int rlim_t;
|
||||
|
||||
#elif defined(SEQUENT)
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#define NO_SETSID
|
||||
#define NEED_STRDUP
|
||||
#define tolower(c) (isupper(c) ? tolower(c) : c)
|
||||
|
||||
#elif defined(NEXT)
|
||||
typedef unsigned short mode_t;
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#define NO_SETSID
|
||||
#define NEED_STRDUP
|
||||
#define NO_LINGCLOSE
|
||||
#define NO_UNISTD_H
|
||||
#undef _POSIX_SOURCE
|
||||
#ifndef FD_CLOEXEC
|
||||
#define FD_CLOEXEC 1
|
||||
#endif
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR))
|
||||
#endif
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(m) (((m)&(S_IFMT)) == (S_IFREG))
|
||||
#endif
|
||||
#ifndef S_IXUSR
|
||||
#define S_IXUSR 00100
|
||||
#endif
|
||||
#ifndef S_IRGRP
|
||||
#define S_IRGRP 00040
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
#define S_IXGRP 00010
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
#define S_IROTH 00004
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
#define S_IXOTH 00001
|
||||
#endif
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR S_IREAD
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR S_IWRITE
|
||||
#endif
|
||||
#ifndef S_IWGRP
|
||||
#define S_IWGRP 000020
|
||||
#endif
|
||||
#ifndef S_IWOTH
|
||||
#define S_IWOTH 000002
|
||||
#ifndef rlim_t
|
||||
typedef int rlim_t;
|
||||
#endif
|
||||
typedef u_long n_long;
|
||||
#endif
|
||||
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
#define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
|
||||
typedef int pid_t;
|
||||
#define JMP_BUF jmp_buf
|
||||
#define USE_LONGJMP
|
||||
#define NO_USE_SIGACTION
|
||||
|
||||
#elif defined(LINUX)
|
||||
#if LINUX > 1
|
||||
#define HAVE_SHMGET
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
typedef int rlim_t;
|
||||
#endif
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#include <sys/time.h>
|
||||
|
||||
#elif defined(SCO)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define NEED_INITGROUPS
|
||||
#define NO_WRITEV
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define SIGURG SIGUSR1 /* but note, this signal will be sent to a process group if enabled (for OOB data). It is not currently enabled. */
|
||||
#include <sys/time.h>
|
||||
|
||||
#elif defined(SCO5)
|
||||
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define SIGURG SIGUSR1
|
||||
#define HAVE_SYS_SELECT_H
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#define SecureWare
|
||||
|
||||
/* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
|
||||
consts. Sigh. */
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
extern int strncasecmp(const char *, const char *, unsigned);
|
||||
|
||||
#elif defined(AUX)
|
||||
/* These are to let -Wall compile more cleanly */
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
extern int strncasecmp(const char *, const char *, unsigned);
|
||||
extern int set42sig(), getopt(), getpeername();
|
||||
extern int listen(), bind(), socket(), getsockname();
|
||||
extern int accept(), gethostname(), connect(), lstat();
|
||||
extern int select(), killpg(), shutdown();
|
||||
extern int initgroups(), setsockopt();
|
||||
extern char *shmat();
|
||||
extern int shmctl();
|
||||
extern int shmget();
|
||||
extern char *sbrk();
|
||||
extern char *crypt();
|
||||
#include <sys/time.h>
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define NEED_STRDUP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
/* fcntl() locking is expensive with NFS */
|
||||
#define USE_FLOCK_SERIALIZED_ACCEPT
|
||||
#define HAVE_SHMGET
|
||||
/*
|
||||
* NOTE: If when you run Apache under A/UX and you get a warning
|
||||
* that httpd couldn't move break, then the below value for
|
||||
* MOVEBREAK (64megs) is too large for your setup. Try reducing
|
||||
* to 0x2000000 which is still PLENTY of space. I doubt if
|
||||
* even on heavy systems sbrk() would be called at all...
|
||||
*/
|
||||
#define MOVEBREAK 0x4000000
|
||||
#define NO_LINGCLOSE
|
||||
#define NO_SLACK
|
||||
|
||||
#elif defined(SVR4)
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
/* A lot of SVR4 systems need this */
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
|
||||
#elif defined(UW)
|
||||
#define NO_LINGCLOSE
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_RESOURCE
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_SHMGET
|
||||
#define HAVE_CRYPT_H
|
||||
#define HAVE_SYS_SELECT_H
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#include <sys/time.h>
|
||||
#define _POSIX_SOURCE
|
||||
|
||||
#elif defined(DGUX)
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
/* A lot of SVR4 systems need this */
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define DEFAULT_USER "nobody"
|
||||
#define DEFAULT_GROUP "nogroup"
|
||||
|
||||
#elif defined(UTS21)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#define NO_SETSID
|
||||
#define NEED_WAITPID
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
#define strftime(buf,bufsize,fmt,tm) ascftime(buf,fmt,tm)
|
||||
#include <sys/types.h>
|
||||
|
||||
#elif defined(APOLLO)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__bsdi__)
|
||||
#if defined(__FreeBSD__)
|
||||
#include <osreldate.h>
|
||||
#endif
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_MMAP
|
||||
#define DEFAULT_USER "nobody"
|
||||
#define DEFAULT_GROUP "nogroup"
|
||||
#if defined(__bsdi__)
|
||||
typedef quad_t rlim_t;
|
||||
#endif
|
||||
#define USE_FLOCK_SERIALIZED_ACCEPT
|
||||
|
||||
#elif defined(QNX)
|
||||
#ifndef crypt
|
||||
char *crypt(const char *pw, const char *salt);
|
||||
#endif
|
||||
#ifndef initgroups
|
||||
int initgroups(char *, int);
|
||||
#endif
|
||||
#ifndef strncasecmp
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define NEED_INITGROUPS
|
||||
#define NEED_SELECT_H
|
||||
#define NEED_PROCESS_H
|
||||
#define HAVE_SYS_SELECT_H
|
||||
#include <unix.h>
|
||||
#define JMP_BUF sigjmp_buf
|
||||
|
||||
#elif defined(LYNXOS)
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define NEED_INITGROUPS
|
||||
#define JMP_BUF jmp_buf
|
||||
|
||||
#elif defined(UXPDS)
|
||||
#undef NEED_STRCASECMP
|
||||
#undef NEED_STRNCASECMP
|
||||
#undef NEED_STRDUP
|
||||
#undef HAVE_GMTOFF
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define HAVE_RESOURCE 1
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_CRYPT_H
|
||||
|
||||
#elif defined(__EMX__)
|
||||
/* Defines required for EMX OS/2 port. */
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define NO_KILLPG
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define NO_SETSID
|
||||
/* Add some drive name support */
|
||||
#define chdir _chdir2
|
||||
#include <sys/time.h>
|
||||
#define MAXSOCKETS 4096
|
||||
#define HAVE_MMAP
|
||||
|
||||
#elif defined(__MACHTEN__)
|
||||
typedef int rlim_t;
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#undef NO_KILLPG
|
||||
#define NO_SETSID
|
||||
#define HAVE_GMTOFF
|
||||
#ifndef __MACHTEN_PPC__
|
||||
#ifndef __MACHTEN_68K__
|
||||
#define __MACHTEN_68K__
|
||||
#endif
|
||||
#define USE_FLOCK_SERIALIZED_ACCEPT
|
||||
#define NO_USE_SIGACTION
|
||||
#define USE_LONGJMP
|
||||
#undef NEED_STRDUP
|
||||
#else
|
||||
#define HAVE_SHMGET
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#endif
|
||||
|
||||
/* Convex OS v11 */
|
||||
#elif defined(CONVEXOS11)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define HAVE_MMAP
|
||||
|
||||
#define NO_TIMEZONE
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#define JMP_BUF jmp_buf
|
||||
typedef int rlim_t;
|
||||
|
||||
#elif defined(ISC)
|
||||
#include <net/errno.h>
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define HAVE_SHMGET
|
||||
#define SIGURG SIGUSR1
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
|
||||
/* Unknown system - Edit these to match */
|
||||
#else
|
||||
#ifdef BSD
|
||||
#define HAVE_GMTOFF
|
||||
#else
|
||||
#undef HAVE_GMTOFF
|
||||
#endif
|
||||
/* NO_KILLPG is set on systems that don't have killpg */
|
||||
#undef NO_KILLPG
|
||||
/* NO_SETSID is set on systems that don't have setsid */
|
||||
#undef NO_SETSID
|
||||
/* NEED_STRDUP is set on stupid systems that don't have strdup. */
|
||||
#undef NEED_STRDUP
|
||||
#endif
|
||||
|
||||
/* Do we have sys/resource.h; assume that BSD does. */
|
||||
#ifndef HAVE_SYS_RESOURCE_H
|
||||
#ifdef BSD
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#endif
|
||||
#endif /* HAVE_SYS_RESOURCE_H */
|
||||
|
||||
/*
|
||||
* The particular directory style your system supports. If you have dirent.h
|
||||
* in /usr/include (POSIX) or /usr/include/sys (SYSV), #include
|
||||
* that file and define DIR_TYPE to be dirent. Otherwise, if you have
|
||||
* /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
|
||||
* file. If you have neither, I'm confused.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
/*
|
||||
* We use snprintf() to avoid overflows, but we include
|
||||
* our own version (ap_snprintf). Allow for people to use their
|
||||
* snprintf() if they want
|
||||
*/
|
||||
#ifdef HAVE_SNPRINTF
|
||||
#define ap_snprintf snprintf
|
||||
#define ap_vsnprintf vsnprintf
|
||||
#else
|
||||
int ap_snprintf(char *buf, size_t len, const char *format, ...);
|
||||
int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap);
|
||||
#endif
|
||||
|
||||
#if !defined(NEXT)
|
||||
#include <dirent.h>
|
||||
#define DIR_TYPE dirent
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
#define DIR_TYPE direct
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef MPE
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/ioctl.h>
|
||||
#ifndef MPE
|
||||
#include <arpa/inet.h> /* for inet_ntoa */
|
||||
#endif
|
||||
#include <time.h> /* for ctime */
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT)
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#ifdef NEED_PROCESS_H
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#ifdef SUNOS4
|
||||
int getrlimit(int, struct rlimit *);
|
||||
int setrlimit(int, struct rlimit *);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_MMAP
|
||||
#ifndef __EMX__
|
||||
/* This file is not needed for OS/2 */
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
|
||||
#define MAP_ANON MAP_ANONYMOUS
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(NO_MMAP)
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
|
||||
#ifndef LOGNAME_MAX
|
||||
#define LOGNAME_MAX 25
|
||||
#endif
|
||||
|
||||
#ifndef NEXT
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef ultrix
|
||||
#define ULTRIX_BRAIN_DEATH
|
||||
#endif
|
||||
|
||||
#ifndef S_ISLNK
|
||||
#ifndef __EMX__
|
||||
/* Don't define this for OS/2 */
|
||||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE ((unsigned long) -1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Replace signal function with sigaction equivalent
|
||||
*/
|
||||
#ifndef NO_USE_SIGACTION
|
||||
typedef void Sigfunc(int);
|
||||
|
||||
#if defined(SIG_IGN) && !defined(SIG_ERR)
|
||||
#define SIG_ERR ((Sigfunc *)-1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For some strange reason, QNX defines signal to signal. Eliminate it.
|
||||
*/
|
||||
#ifdef signal
|
||||
#undef signal
|
||||
#endif
|
||||
#define signal(s,f) ap_signal(s,f)
|
||||
Sigfunc *signal(int signo, Sigfunc * func);
|
||||
#endif
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#if defined(USE_LONGJMP)
|
||||
#define ap_longjmp(x, y) longjmp((x), (y))
|
||||
#define ap_setjmp(x) setjmp(x)
|
||||
#else
|
||||
#define ap_longjmp(x, y) siglongjmp((x), (y))
|
||||
#define ap_setjmp(x) sigsetjmp((x), 1)
|
||||
#endif
|
||||
|
||||
/* Finding offsets of elements within structures.
|
||||
* Taken from the X code... they've sweated portability of this stuff
|
||||
* so we don't have to. Sigh...
|
||||
*/
|
||||
|
||||
#if defined(CRAY) || defined(__arm)
|
||||
#if __STDC__
|
||||
#define XtOffset(p_type,field) _Offsetof(p_type,field)
|
||||
#else
|
||||
#ifdef CRAY2
|
||||
#define XtOffset(p_type,field) \
|
||||
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
|
||||
|
||||
#else /* !CRAY2 */
|
||||
|
||||
#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
|
||||
|
||||
#endif /* !CRAY2 */
|
||||
#endif /* __STDC__ */
|
||||
#else /* ! (CRAY || __arm) */
|
||||
|
||||
#define XtOffset(p_type,field) \
|
||||
((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
|
||||
#endif /* !CRAY */
|
||||
|
||||
#ifdef offsetof
|
||||
#define XtOffsetOf(s_type,field) offsetof(s_type,field)
|
||||
#else
|
||||
#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
|
||||
#endif
|
||||
|
||||
#ifdef SUNOS_LIB_PROTOTYPES
|
||||
/* Prototypes needed to get a clean compile with gcc -Wall.
|
||||
* Believe it or not, these do have to be declared, at least on SunOS,
|
||||
* because they aren't mentioned in the relevant system headers.
|
||||
* Sun Quality Software. Gotta love it.
|
||||
*/
|
||||
|
||||
int getopt(int, char **, char *);
|
||||
|
||||
int strcasecmp(char *, char *);
|
||||
int strncasecmp(char *, char *, int);
|
||||
int toupper(int);
|
||||
int tolower(int);
|
||||
|
||||
int printf(char *, ...);
|
||||
int fprintf(FILE *, char *, ...);
|
||||
int fputs(char *, FILE *);
|
||||
int fread(char *, int, int, FILE *);
|
||||
int fwrite(char *, int, int, FILE *);
|
||||
int fflush(FILE *);
|
||||
int fclose(FILE *);
|
||||
int ungetc(int, FILE *);
|
||||
int _filbuf(FILE *); /* !!! */
|
||||
int _flsbuf(unsigned char, FILE *); /* !!! */
|
||||
int sscanf(char *, char *, ...);
|
||||
void setbuf(FILE *, char *);
|
||||
void perror(char *);
|
||||
|
||||
time_t time(time_t *);
|
||||
int strftime(char *, int, char *, struct tm *);
|
||||
|
||||
int initgroups(char *, int);
|
||||
int wait3(int *, int, void *); /* Close enough for us... */
|
||||
int lstat(const char *, struct stat *);
|
||||
int stat(const char *, struct stat *);
|
||||
int flock(int, int);
|
||||
#ifndef NO_KILLPG
|
||||
int killpg(int, int);
|
||||
#endif
|
||||
int socket(int, int, int);
|
||||
int setsockopt(int, int, int, const char *, int);
|
||||
int listen(int, int);
|
||||
int bind(int, struct sockaddr *, int);
|
||||
int connect(int, struct sockaddr *, int);
|
||||
int accept(int, struct sockaddr *, int *);
|
||||
int shutdown(int, int);
|
||||
|
||||
int getsockname(int s, struct sockaddr *name, int *namelen);
|
||||
int getpeername(int s, struct sockaddr *name, int *namelen);
|
||||
int gethostname(char *name, int namelen);
|
||||
void syslog(int, char *, ...);
|
||||
char *mktemp(char *);
|
||||
|
||||
long vfprintf(FILE *, char *, va_list);
|
||||
|
||||
#endif
|
@ -1,85 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Process config --- what the process ITSELF is doing
|
||||
*/
|
||||
|
||||
extern int standalone;
|
||||
extern uid_t user_id;
|
||||
extern char *user_name;
|
||||
extern gid_t group_id;
|
||||
#ifdef MULTIPLE_GROUPS
|
||||
extern gid_t group_id_list[NGROUPS_MAX];
|
||||
#endif
|
||||
extern int max_requests_per_child;
|
||||
extern struct in_addr bind_address;
|
||||
extern listen_rec *listeners;
|
||||
extern int daemons_to_start;
|
||||
extern int daemons_min_free;
|
||||
extern int daemons_max_free;
|
||||
extern int daemons_limit;
|
||||
extern int suexec_enabled;
|
||||
|
||||
extern char *pid_fname;
|
||||
extern char *scoreboard_fname;
|
||||
extern char *lock_fname;
|
||||
extern char *server_argv0;
|
||||
|
||||
/* Trying to allocate these in the config pool gets us into some *nasty*
|
||||
* chicken-and-egg problems in http_main.c --- where do you stick them
|
||||
* when pconf gets cleared? Better to just allocate a little space
|
||||
* statically...
|
||||
*/
|
||||
|
||||
extern char server_root[MAX_STRING_LEN];
|
||||
extern char server_confname[MAX_STRING_LEN];
|
@ -1,765 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* httpd.h: header for simple (ha! not anymore) http daemon
|
||||
*/
|
||||
|
||||
/* Headers in which EVERYONE has an interest... */
|
||||
|
||||
#include "conf.h"
|
||||
#include "alloc.h"
|
||||
#include "buff.h"
|
||||
|
||||
/* ----------------------------- config dir ------------------------------ */
|
||||
|
||||
/* Define this to be the default server home dir. Anything later in this
|
||||
* file with a relative pathname will have this added.
|
||||
*/
|
||||
#ifndef HTTPD_ROOT
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define HTTPD_ROOT "/os2httpd"
|
||||
#else
|
||||
#define HTTPD_ROOT "/usr/local/etc/httpd"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DOCUMENT_LOCATION
|
||||
/* Root of server */
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define DOCUMENT_LOCATION "/os2httpd/docs"
|
||||
#else
|
||||
#define DOCUMENT_LOCATION "/usr/local/etc/httpd/htdocs"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Max. number of dynamically loaded modules */
|
||||
#define DYNAMIC_MODULE_LIMIT 64
|
||||
|
||||
/* Default administrator's address */
|
||||
#define DEFAULT_ADMIN "[no address given]"
|
||||
|
||||
/*
|
||||
* --------- You shouldn't have to edit anything below this line ----------
|
||||
*
|
||||
* Any modifications to any defaults not defined above should be done in the
|
||||
* respective config. file.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* -------------- Port number for server running standalone --------------- */
|
||||
|
||||
#define DEFAULT_PORT 80
|
||||
|
||||
/* --------- Default user name and group name running standalone ---------- */
|
||||
/* --- These may be specified as numbers by placing a # before a number --- */
|
||||
|
||||
#ifndef DEFAULT_USER
|
||||
#define DEFAULT_USER "#-1"
|
||||
#endif
|
||||
#ifndef DEFAULT_GROUP
|
||||
#define DEFAULT_GROUP "#-1"
|
||||
#endif
|
||||
|
||||
/* The name of the log files */
|
||||
#ifndef DEFAULT_XFERLOG
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define DEFAULT_XFERLOG "logs/access.log"
|
||||
#else
|
||||
#define DEFAULT_XFERLOG "logs/access_log"
|
||||
#endif
|
||||
#endif /* DEFAULT_XFERLOG */
|
||||
#ifndef DEFAULT_ERRORLOG
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define DEFAULT_ERRORLOG "logs/error.log"
|
||||
#else
|
||||
#define DEFAULT_ERRORLOG "logs/error_log"
|
||||
#endif
|
||||
#endif /* DEFAULT_ERRORLOG */
|
||||
#ifndef DEFAULT_PIDLOG
|
||||
#define DEFAULT_PIDLOG "logs/httpd.pid"
|
||||
#endif
|
||||
#ifndef DEFAULT_SCOREBOARD
|
||||
#define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
|
||||
#endif
|
||||
#ifndef DEFAULT_LOCKFILE
|
||||
#define DEFAULT_LOCKFILE "logs/accept.lock"
|
||||
#endif
|
||||
|
||||
/* Define this to be what your HTML directory content files are called */
|
||||
#define DEFAULT_INDEX "index.html"
|
||||
|
||||
/* Define this to 1 if you want fancy indexing, 0 otherwise */
|
||||
#define DEFAULT_INDEXING 0
|
||||
|
||||
/* Define this to be what type you'd like returned for files with unknown */
|
||||
/* suffixes */
|
||||
#define DEFAULT_TYPE "text/plain"
|
||||
|
||||
/* Define this to be what your per-directory security files are called */
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define DEFAULT_ACCESS_FNAME "htaccess"
|
||||
#else
|
||||
#define DEFAULT_ACCESS_FNAME ".htaccess"
|
||||
#endif
|
||||
|
||||
/* The name of the server config file */
|
||||
#ifndef SERVER_CONFIG_FILE
|
||||
#define SERVER_CONFIG_FILE "conf/httpd.conf"
|
||||
#endif
|
||||
|
||||
#ifndef RESOURCE_CONFIG_FILE
|
||||
/* The name of the document config file */
|
||||
#define RESOURCE_CONFIG_FILE "conf/srm.conf"
|
||||
#endif
|
||||
|
||||
#ifndef TYPES_CONFIG_FILE
|
||||
/* The name of the MIME types file */
|
||||
#define TYPES_CONFIG_FILE "conf/mime.types"
|
||||
#endif
|
||||
|
||||
#ifndef ACCESS_CONFIG_FILE
|
||||
/* The name of the access file */
|
||||
#define ACCESS_CONFIG_FILE "conf/access.conf"
|
||||
#endif
|
||||
|
||||
/* Whether we should enable rfc1413 identity checking */
|
||||
#define DEFAULT_RFC1413 0
|
||||
/* The default directory in user's home dir */
|
||||
#define DEFAULT_USER_DIR "public_html"
|
||||
|
||||
/* The default path for CGI scripts if none is currently set */
|
||||
#ifndef DEFAULT_PATH
|
||||
#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
|
||||
#endif
|
||||
|
||||
/* The path to the Bourne shell, for parsed docs */
|
||||
#ifndef SHELL_PATH
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define SHELL_PATH "CMD.EXE"
|
||||
#else
|
||||
#define SHELL_PATH "/bin/sh"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* The path to the suExec wrapper, can be overridden in Configuration */
|
||||
#ifndef SUEXEC_BIN
|
||||
#define SUEXEC_BIN "/usr/local/etc/httpd/sbin/suexec"
|
||||
#endif
|
||||
|
||||
/* The default string lengths */
|
||||
#define MAX_STRING_LEN HUGE_STRING_LEN
|
||||
#define HUGE_STRING_LEN 8192
|
||||
|
||||
/* The timeout for waiting for messages */
|
||||
#define DEFAULT_TIMEOUT 300
|
||||
|
||||
/* The timeout for waiting for keepalive timeout until next request */
|
||||
#define DEFAULT_KEEPALIVE_TIMEOUT 15
|
||||
|
||||
/* The number of requests to entertain per connection */
|
||||
#define DEFAULT_KEEPALIVE 100
|
||||
|
||||
/* The size of the server's internal read-write buffers */
|
||||
#define IOBUFSIZE 8192
|
||||
|
||||
/* Number of servers to spawn off by default --- also, if fewer than
|
||||
* this free when the caretaker checks, it will spawn more.
|
||||
*/
|
||||
#define DEFAULT_START_DAEMON 5
|
||||
|
||||
/* Maximum number of *free* server processes --- more than this, and
|
||||
* they will die off.
|
||||
*/
|
||||
|
||||
#define DEFAULT_MAX_FREE_DAEMON 10
|
||||
|
||||
/* Minimum --- fewer than this, and more will be created */
|
||||
|
||||
#define DEFAULT_MIN_FREE_DAEMON 5
|
||||
|
||||
/* Limit on the total --- clients will be locked out if more servers than
|
||||
* this are needed. It is intended solely to keep the server from crashing
|
||||
* when things get out of hand.
|
||||
*
|
||||
* We keep a hard maximum number of servers, for two reasons --- first off,
|
||||
* in case something goes seriously wrong, we want to stop the fork bomb
|
||||
* short of actually crashing the machine we're running on by filling some
|
||||
* kernel table. Secondly, it keeps the size of the scoreboard file small
|
||||
* enough that we can read the whole thing without worrying too much about
|
||||
* the overhead.
|
||||
*/
|
||||
#ifndef HARD_SERVER_LIMIT
|
||||
#define HARD_SERVER_LIMIT 256
|
||||
#endif
|
||||
|
||||
/* Number of requests to try to handle in a single process. If <= 0,
|
||||
* the children don't die off. That's the default here, since I'm still
|
||||
* interested in finding and stanching leaks.
|
||||
*/
|
||||
|
||||
#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
|
||||
|
||||
/* If you have altered Apache and wish to change the SERVER_VERSION
|
||||
* identifier below, please keep to the HTTP specification. This states that
|
||||
* the identification string should consist of product tokens with an optional
|
||||
* slash and version designator. Sub-products which form a significant part
|
||||
* of the application can be listed, separated by whitespace, by adding
|
||||
* their product tokens to EXTRA_CFLAGS in the Configuration file like so.
|
||||
*
|
||||
* EXTRA_CFLAGS="-DSERVER_SUBVERSION="MrWidget/0.1-alpha"
|
||||
*
|
||||
* The tokens are listed in order of their significance for identifying the
|
||||
* application.
|
||||
*
|
||||
* "Product tokens should be short and to the point -- use of them for
|
||||
* advertizing or other non-essential information is explicitly forbidden."
|
||||
*
|
||||
* Example: "Apache/1.1.0 MrWidget/0.1-alpha"
|
||||
*/
|
||||
|
||||
#define SERVER_BASEVERSION "Apache/1.2.6" /* SEE COMMENTS ABOVE */
|
||||
#ifdef SERVER_SUBVERSION
|
||||
#define SERVER_VERSION SERVER_BASEVERSION " " SERVER_SUBVERSION
|
||||
#else
|
||||
#define SERVER_VERSION SERVER_BASEVERSION
|
||||
#endif
|
||||
|
||||
/* Numeric release version identifier: major minor bugfix betaseq
|
||||
* Always increases along the same track as the source branch.
|
||||
*/
|
||||
#define APACHE_RELEASE 1020600
|
||||
|
||||
#define SERVER_PROTOCOL "HTTP/1.1"
|
||||
#define SERVER_SUPPORT "http://www.apache.org/"
|
||||
|
||||
#define DECLINED -1 /* Module declines to handle */
|
||||
#define OK 0 /* Module has handled this stage. */
|
||||
|
||||
|
||||
/* ----------------------- HTTP Status Codes ------------------------- */
|
||||
|
||||
#define RESPONSE_CODES 38
|
||||
|
||||
#define HTTP_CONTINUE 100
|
||||
#define HTTP_SWITCHING_PROTOCOLS 101
|
||||
#define HTTP_OK 200
|
||||
#define HTTP_CREATED 201
|
||||
#define HTTP_ACCEPTED 202
|
||||
#define HTTP_NON_AUTHORITATIVE 203
|
||||
#define HTTP_NO_CONTENT 204
|
||||
#define HTTP_RESET_CONTENT 205
|
||||
#define HTTP_PARTIAL_CONTENT 206
|
||||
#define HTTP_MULTIPLE_CHOICES 300
|
||||
#define HTTP_MOVED_PERMANENTLY 301
|
||||
#define HTTP_MOVED_TEMPORARILY 302
|
||||
#define HTTP_SEE_OTHER 303
|
||||
#define HTTP_NOT_MODIFIED 304
|
||||
#define HTTP_USE_PROXY 305
|
||||
#define HTTP_BAD_REQUEST 400
|
||||
#define HTTP_UNAUTHORIZED 401
|
||||
#define HTTP_PAYMENT_REQUIRED 402
|
||||
#define HTTP_FORBIDDEN 403
|
||||
#define HTTP_NOT_FOUND 404
|
||||
#define HTTP_METHOD_NOT_ALLOWED 405
|
||||
#define HTTP_NOT_ACCEPTABLE 406
|
||||
#define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
|
||||
#define HTTP_REQUEST_TIME_OUT 408
|
||||
#define HTTP_CONFLICT 409
|
||||
#define HTTP_GONE 410
|
||||
#define HTTP_LENGTH_REQUIRED 411
|
||||
#define HTTP_PRECONDITION_FAILED 412
|
||||
#define HTTP_REQUEST_ENTITY_TOO_LARGE 413
|
||||
#define HTTP_REQUEST_URI_TOO_LARGE 414
|
||||
#define HTTP_UNSUPPORTED_MEDIA_TYPE 415
|
||||
#define HTTP_INTERNAL_SERVER_ERROR 500
|
||||
#define HTTP_NOT_IMPLEMENTED 501
|
||||
#define HTTP_BAD_GATEWAY 502
|
||||
#define HTTP_SERVICE_UNAVAILABLE 503
|
||||
#define HTTP_GATEWAY_TIME_OUT 504
|
||||
#define HTTP_VERSION_NOT_SUPPORTED 505
|
||||
#define HTTP_VARIANT_ALSO_VARIES 506
|
||||
|
||||
#define DOCUMENT_FOLLOWS HTTP_OK
|
||||
#define PARTIAL_CONTENT HTTP_PARTIAL_CONTENT
|
||||
#define MULTIPLE_CHOICES HTTP_MULTIPLE_CHOICES
|
||||
#define MOVED HTTP_MOVED_PERMANENTLY
|
||||
#define REDIRECT HTTP_MOVED_TEMPORARILY
|
||||
#define USE_LOCAL_COPY HTTP_NOT_MODIFIED
|
||||
#define BAD_REQUEST HTTP_BAD_REQUEST
|
||||
#define AUTH_REQUIRED HTTP_UNAUTHORIZED
|
||||
#define FORBIDDEN HTTP_FORBIDDEN
|
||||
#define NOT_FOUND HTTP_NOT_FOUND
|
||||
#define METHOD_NOT_ALLOWED HTTP_METHOD_NOT_ALLOWED
|
||||
#define NOT_ACCEPTABLE HTTP_NOT_ACCEPTABLE
|
||||
#define LENGTH_REQUIRED HTTP_LENGTH_REQUIRED
|
||||
#define PRECONDITION_FAILED HTTP_PRECONDITION_FAILED
|
||||
#define SERVER_ERROR HTTP_INTERNAL_SERVER_ERROR
|
||||
#define NOT_IMPLEMENTED HTTP_NOT_IMPLEMENTED
|
||||
#define BAD_GATEWAY HTTP_BAD_GATEWAY
|
||||
#define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES
|
||||
|
||||
#define is_HTTP_INFO(x) (((x) >= 100)&&((x) < 200))
|
||||
#define is_HTTP_SUCCESS(x) (((x) >= 200)&&((x) < 300))
|
||||
#define is_HTTP_REDIRECT(x) (((x) >= 300)&&((x) < 400))
|
||||
#define is_HTTP_ERROR(x) (((x) >= 400)&&((x) < 600))
|
||||
#define is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
|
||||
#define is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
|
||||
|
||||
#define status_drops_connection(x) (((x) == HTTP_BAD_REQUEST) || \
|
||||
((x) == HTTP_REQUEST_TIME_OUT) || \
|
||||
((x) == HTTP_LENGTH_REQUIRED) || \
|
||||
((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
|
||||
((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
|
||||
((x) == HTTP_INTERNAL_SERVER_ERROR) || \
|
||||
((x) == HTTP_SERVICE_UNAVAILABLE))
|
||||
|
||||
|
||||
#define METHODS 8
|
||||
#define M_GET 0
|
||||
#define M_PUT 1
|
||||
#define M_POST 2
|
||||
#define M_DELETE 3
|
||||
#define M_CONNECT 4
|
||||
#define M_OPTIONS 5
|
||||
#define M_TRACE 6
|
||||
#define M_INVALID 7
|
||||
|
||||
#define CGI_MAGIC_TYPE "application/x-httpd-cgi"
|
||||
#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
|
||||
#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
|
||||
#define MAP_FILE_MAGIC_TYPE "application/x-type-map"
|
||||
#define ASIS_MAGIC_TYPE "httpd/send-as-is"
|
||||
#define DIR_MAGIC_TYPE "httpd/unix-directory"
|
||||
#define STATUS_MAGIC_TYPE "application/x-httpd-status"
|
||||
|
||||
/* Just in case your linefeed isn't the one the other end is expecting. */
|
||||
#define LF 10
|
||||
#define CR 13
|
||||
|
||||
/* Possible values for request_rec.read_body (set by handling module):
|
||||
* REQUEST_NO_BODY Send 413 error if message has any body
|
||||
* REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length
|
||||
* REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me.
|
||||
* REQUEST_CHUNKED_PASS Pass the chunks to me without removal.
|
||||
*/
|
||||
#define REQUEST_NO_BODY 0
|
||||
#define REQUEST_CHUNKED_ERROR 1
|
||||
#define REQUEST_CHUNKED_DECHUNK 2
|
||||
#define REQUEST_CHUNKED_PASS 3
|
||||
|
||||
/* Things which may vary per file-lookup WITHIN a request ---
|
||||
* e.g., state of MIME config. Basically, the name of an object, info
|
||||
* about the object, and any other info we may ahve which may need to
|
||||
* change as we go poking around looking for it (e.g., overridden by
|
||||
* .htaccess files).
|
||||
*
|
||||
* Note how the default state of almost all these things is properly
|
||||
* zero, so that allocating it with pcalloc does the right thing without
|
||||
* a whole lot of hairy initialization... so long as we are willing to
|
||||
* make the (fairly) portable assumption that the bit pattern of a NULL
|
||||
* pointer is, in fact, zero.
|
||||
*/
|
||||
|
||||
/* This represents the result of calling htaccess; these are cached for
|
||||
* each request.
|
||||
*/
|
||||
struct htaccess_result {
|
||||
char *dir; /* the directory to which this applies */
|
||||
int override; /* the overrides allowed for the .htaccess file */
|
||||
void *htaccess; /* the configuration directives */
|
||||
/* the next one, or NULL if no more; N.B. never change this */
|
||||
const struct htaccess_result *next;
|
||||
};
|
||||
|
||||
|
||||
typedef struct afs_conn_rec conn_rec;
|
||||
typedef struct server_rec server_rec;
|
||||
typedef struct request_rec request_rec;
|
||||
typedef struct listen_rec listen_rec;
|
||||
|
||||
struct request_rec {
|
||||
|
||||
pool *pool;
|
||||
conn_rec *connection;
|
||||
server_rec *server;
|
||||
|
||||
request_rec *next; /* If we wind up getting redirected,
|
||||
* pointer to the request we redirected to.
|
||||
*/
|
||||
request_rec *prev; /* If this is an internal redirect,
|
||||
* pointer to where we redirected *from*.
|
||||
*/
|
||||
|
||||
request_rec *main; /* If this is a sub_request (see request.h)
|
||||
* pointer back to the main request.
|
||||
*/
|
||||
|
||||
/* Info about the request itself... we begin with stuff that only
|
||||
* protocol.c should ever touch...
|
||||
*/
|
||||
|
||||
char *the_request; /* First line of request, so we can log it */
|
||||
int assbackwards; /* HTTP/0.9, "simple" request */
|
||||
int proxyreq; /* A proxy request */
|
||||
int header_only; /* HEAD request, as opposed to GET */
|
||||
char *protocol; /* Protocol, as given to us, or HTTP/0.9 */
|
||||
int proto_num; /* Number version of protocol; 1.1 = 1001 */
|
||||
char *hostname; /* Host, as set by full URI or Host: */
|
||||
int hostlen; /* Length of http://host:port in full URI */
|
||||
|
||||
time_t request_time; /* When the request started */
|
||||
|
||||
char *status_line; /* Status line, if set by script */
|
||||
int status; /* In any case */
|
||||
|
||||
/* Request method, two ways; also, protocol, etc.. Outside of protocol.c,
|
||||
* look, but don't touch.
|
||||
*/
|
||||
|
||||
char *method; /* GET, HEAD, POST, etc. */
|
||||
int method_number; /* M_GET, M_POST, etc. */
|
||||
int allowed; /* Allowed methods - for 405, OPTIONS, etc */
|
||||
|
||||
int sent_bodyct; /* byte count in stream is for body */
|
||||
long bytes_sent; /* body byte count, for easy access */
|
||||
|
||||
/* HTTP/1.1 connection-level features */
|
||||
|
||||
int chunked; /* sending chunked transfer-coding */
|
||||
int byterange; /* number of byte ranges */
|
||||
char *boundary; /* multipart/byteranges boundary */
|
||||
char *range; /* The Range: header */
|
||||
long clength; /* The "real" content length */
|
||||
|
||||
long remaining; /* bytes left to read */
|
||||
long read_length; /* bytes that have been read */
|
||||
int read_body; /* how the request body should be read */
|
||||
int read_chunked; /* reading chunked transfer-coding */
|
||||
|
||||
/* MIME header environments, in and out. Also, an array containing
|
||||
* environment variables to be passed to subprocesses, so people can
|
||||
* write modules to add to that environment.
|
||||
*
|
||||
* The difference between headers_out and err_headers_out is that the
|
||||
* latter are printed even on error, and persist across internal redirects
|
||||
* (so the headers printed for ErrorDocument handlers will have them).
|
||||
*
|
||||
* The 'notes' table is for notes from one module to another, with no
|
||||
* other set purpose in mind...
|
||||
*/
|
||||
|
||||
table *headers_in;
|
||||
table *headers_out;
|
||||
table *err_headers_out;
|
||||
table *subprocess_env;
|
||||
table *notes;
|
||||
|
||||
char *content_type; /* Break these out --- we dispatch on 'em */
|
||||
char *handler; /* What we *really* dispatch on */
|
||||
|
||||
char *content_encoding;
|
||||
char *content_language; /* for back-compat. only -- do not use */
|
||||
array_header *content_languages; /* array of (char*) */
|
||||
|
||||
int no_cache;
|
||||
int no_local_copy;
|
||||
|
||||
/* What object is being requested (either directly, or via include
|
||||
* or content-negotiation mapping).
|
||||
*/
|
||||
|
||||
char *uri; /* complete URI for a proxy req, or
|
||||
* URL path for a non-proxy req */
|
||||
char *filename;
|
||||
char *path_info;
|
||||
char *args; /* QUERY_ARGS, if any */
|
||||
struct stat finfo; /* ST_MODE set to zero if no such file */
|
||||
|
||||
/* Various other config info which may change with .htaccess files
|
||||
* These are config vectors, with one void* pointer for each module
|
||||
* (the thing pointed to being the module's business).
|
||||
*/
|
||||
|
||||
void *per_dir_config; /* Options set in config files, etc. */
|
||||
void *request_config; /* Notes on *this* request */
|
||||
|
||||
/*
|
||||
* a linked list of the configuration directives in the .htaccess files
|
||||
* accessed by this request.
|
||||
* N.B. always add to the head of the list, _never_ to the end.
|
||||
* that way, a sub request's list can (temporarily) point to a parent's list
|
||||
*/
|
||||
const struct htaccess_result *htaccess;
|
||||
};
|
||||
|
||||
|
||||
/* Things which are per connection
|
||||
*/
|
||||
|
||||
struct afs_conn_rec {
|
||||
|
||||
pool *pool;
|
||||
server_rec *server;
|
||||
server_rec *base_server; /* Physical vhost this conn come in on */
|
||||
|
||||
/* Information about the connection itself */
|
||||
|
||||
int child_num; /* The number of the child handling conn_rec */
|
||||
BUFF *client; /* Connetion to the guy */
|
||||
int aborted; /* Are we still talking? */
|
||||
|
||||
/* Who is the client? */
|
||||
|
||||
struct sockaddr_in local_addr; /* local address */
|
||||
struct sockaddr_in remote_addr; /* remote address */
|
||||
char *remote_ip; /* Client's IP address */
|
||||
char *remote_host; /* Client's DNS name, if known.
|
||||
* NULL if DNS hasn't been checked,
|
||||
* "" if it has and no address was found.
|
||||
* N.B. Only access this though
|
||||
* get_remote_host() */
|
||||
char *remote_logname; /* Only ever set if doing rfc1413 lookups.
|
||||
* N.B. Only access this through
|
||||
* get_remote_logname() */
|
||||
char *user; /* If an authentication check was made,
|
||||
* this gets set to the user name. We assume
|
||||
* that there's only one user per connection(!)
|
||||
*/
|
||||
char *auth_type; /* Ditto. */
|
||||
|
||||
int keepalive; /* Are we using HTTP Keep-Alive? */
|
||||
int keptalive; /* Did we use HTTP Keep-Alive? */
|
||||
int keepalives; /* How many times have we used it? */
|
||||
};
|
||||
|
||||
/* Per-vhost config... */
|
||||
|
||||
/* The address 255.255.255.255, when used as a virtualhost address,
|
||||
* will become the "default" server when the ip doesn't match other vhosts.
|
||||
*/
|
||||
#define DEFAULT_VHOST_ADDR 0xfffffffful
|
||||
|
||||
typedef struct server_addr_rec server_addr_rec;
|
||||
struct server_addr_rec {
|
||||
server_addr_rec *next;
|
||||
struct in_addr host_addr; /* The bound address, for this server */
|
||||
unsigned short host_port; /* The bound port, for this server */
|
||||
char *virthost; /* The name given in <VirtualHost> */
|
||||
};
|
||||
|
||||
|
||||
struct server_rec {
|
||||
|
||||
server_rec *next;
|
||||
|
||||
/* Full locations of server config info */
|
||||
|
||||
char *srm_confname;
|
||||
char *access_confname;
|
||||
|
||||
/* Contact information */
|
||||
|
||||
char *server_admin;
|
||||
char *server_hostname;
|
||||
unsigned short port; /* for redirects, etc. */
|
||||
|
||||
/* Log files --- note that transfer log is now in the modules... */
|
||||
|
||||
char *error_fname;
|
||||
FILE *error_log;
|
||||
|
||||
/* Module-specific configuration for server, and defaults... */
|
||||
|
||||
int is_virtual; /* true if this is the virtual server */
|
||||
void *module_config; /* Config vector containing pointers to
|
||||
* modules' per-server config structures.
|
||||
*/
|
||||
void *lookup_defaults; /* MIME type info, etc., before we start
|
||||
* checking per-directory info.
|
||||
*/
|
||||
/* Transaction handling */
|
||||
|
||||
server_addr_rec *addrs;
|
||||
int timeout; /* Timeout, in seconds, before we give up */
|
||||
int keep_alive_timeout; /* Seconds we'll wait for another request */
|
||||
int keep_alive_max; /* Maximum requests per connection */
|
||||
int keep_alive; /* Use persistent connections? */
|
||||
int send_buffer_size; /* size of TCP send buffer (in bytes) */
|
||||
|
||||
char *path; /* Pathname for ServerPath */
|
||||
int pathlen; /* Length of path */
|
||||
|
||||
char *names; /* Wildcarded names for ServerAlias servers */
|
||||
|
||||
uid_t server_uid; /* effective user id when calling exec wrapper */
|
||||
gid_t server_gid; /* effective group id when calling exec wrapper */
|
||||
};
|
||||
|
||||
/* These are more like real hosts than virtual hosts */
|
||||
struct listen_rec {
|
||||
listen_rec *next;
|
||||
struct sockaddr_in local_addr; /* local IP address and port */
|
||||
int fd;
|
||||
int used; /* Only used during restart */
|
||||
/* more stuff here, like which protocol is bound to the port */
|
||||
};
|
||||
|
||||
/* Prototypes for utilities... util.c.
|
||||
*/
|
||||
|
||||
/* Time */
|
||||
extern const char month_snames[12][4];
|
||||
|
||||
struct tm *get_gmtoff(int *tz);
|
||||
char *get_time();
|
||||
char *ht_time(pool * p, time_t t, const char *fmt, int gmt);
|
||||
char *gm_timestr_822(pool * p, time_t t);
|
||||
|
||||
/* String handling. The *_nc variants allow you to use non-const char **s as
|
||||
arguments (unfortunately C won't automatically convert a char ** to a const
|
||||
char **) */
|
||||
|
||||
char *getword(pool * p, const char **line, char stop);
|
||||
char *getword_nc(pool * p, char **line, char stop);
|
||||
char *getword_white(pool * p, const char **line);
|
||||
char *getword_white_nc(pool * p, char **line);
|
||||
char *getword_nulls(pool * p, const char **line, char stop);
|
||||
char *getword_nulls_nc(pool * p, char **line, char stop);
|
||||
char *getword_conf(pool * p, const char **line);
|
||||
char *getword_conf_nc(pool * p, char **line);
|
||||
|
||||
char *get_token(pool * p, char **accept_line, int accept_white);
|
||||
int find_token(pool * p, const char *line, const char *tok);
|
||||
int find_last_token(pool * p, const char *line, const char *tok);
|
||||
|
||||
int is_url(const char *u);
|
||||
extern int unescape_url(char *url);
|
||||
void no2slash(char *name);
|
||||
void getparents(char *name);
|
||||
char *escape_path_segment(pool * p, const char *s);
|
||||
char *os_escape_path(pool * p, const char *path, int partial);
|
||||
#define escape_uri(ppool,path) os_escape_path(ppool,path,1)
|
||||
extern char *escape_html(pool * p, const char *s);
|
||||
char *construct_server(pool * p, const char *hostname, unsigned port);
|
||||
char *construct_url(pool * p, const char *path, const server_rec * s);
|
||||
char *escape_shell_cmd(pool * p, const char *s);
|
||||
|
||||
int count_dirs(const char *path);
|
||||
char *make_dirstr(pool * a, const char *s, int n);
|
||||
char *make_full_path(pool * a, const char *dir, const char *f);
|
||||
|
||||
int is_matchexp(const char *str);
|
||||
int strcmp_match(const char *str, const char *exp);
|
||||
int strcasecmp_match(const char *str, const char *exp);
|
||||
char *uudecode(pool *, const char *);
|
||||
|
||||
char *pregsub(pool * p, const char *input, const char *source, size_t nmatch,
|
||||
regmatch_t pmatch[]);
|
||||
|
||||
void str_tolower(char *);
|
||||
int ind(const char *, char); /* Sigh... */
|
||||
int rind(const char *, char);
|
||||
|
||||
int cfg_getline(char *s, int n, FILE * f);
|
||||
|
||||
#ifdef NEED_STRERROR
|
||||
char *strerror(int err);
|
||||
#endif
|
||||
|
||||
/* Misc system hackery */
|
||||
|
||||
uid_t uname2id(const char *name);
|
||||
gid_t gname2id(const char *name);
|
||||
int is_directory(const char *name);
|
||||
int can_exec(const struct stat *);
|
||||
void chdir_file(const char *file);
|
||||
|
||||
char *get_local_host(pool *);
|
||||
unsigned long get_virthost_addr(const char *hostname, unsigned short *port);
|
||||
|
||||
extern time_t restart_time;
|
||||
|
||||
/*
|
||||
* Apache tries to keep all of its long term filehandles (such as log files,
|
||||
* and sockets) above this number. This is to workaround problems in many
|
||||
* third party libraries that are compiled with a small FD_SETSIZE. There
|
||||
* should be no reason to lower this, because it's only advisory. If a file
|
||||
* can't be allocated above this number then it will remain in the "slack"
|
||||
* area.
|
||||
*
|
||||
* Only the low slack line is used by default. If HIGH_SLACK_LINE is defined
|
||||
* then an attempt is also made to keep all non-FILE * files above the high
|
||||
* slack line. This is to work around a Solaris C library limitation, where it
|
||||
* uses an unsigned char to store the file descriptor.
|
||||
*/
|
||||
#ifndef LOW_SLACK_LINE
|
||||
#define LOW_SLACK_LINE 15
|
||||
#endif
|
||||
/* #define HIGH_SLACK_LINE 255 */
|
||||
|
||||
/*
|
||||
* The ap_slack() function takes a fd, and tries to move it above the indicated
|
||||
* line. It returns an fd which may or may not have moved above the line, and
|
||||
* never fails. If the high line was requested and it fails it will also try
|
||||
* the low line.
|
||||
*/
|
||||
int ap_slack(int fd, int line);
|
||||
#define AP_SLACK_LOW 1
|
||||
#define AP_SLACK_HIGH 2
|
@ -1,350 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1998 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_ALLOC_H
|
||||
#define APACHE_ALLOC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Resource allocation routines...
|
||||
*
|
||||
* designed so that we don't have to keep track of EVERYTHING so that
|
||||
* it can be explicitly freed later (a fundamentally unsound strategy ---
|
||||
* particularly in the presence of die()).
|
||||
*
|
||||
* Instead, we maintain pools, and allocate items (both memory and I/O
|
||||
* handlers) from the pools --- currently there are two, one for per
|
||||
* transaction info, and one for config info. When a transaction is over,
|
||||
* we can delete everything in the per-transaction pool without fear, and
|
||||
* without thinking too hard about it either.
|
||||
*
|
||||
* rst
|
||||
*/
|
||||
|
||||
/* Arenas for configuration info and transaction info
|
||||
* --- actual layout of the pool structure is private to
|
||||
* alloc.c.
|
||||
*/
|
||||
|
||||
/* Need declaration of DIR on Win32 */
|
||||
#ifdef WIN32
|
||||
#include "os/win32/readdir.h"
|
||||
#endif
|
||||
|
||||
typedef struct pool pool;
|
||||
typedef struct pool ap_pool;
|
||||
|
||||
pool *ap_init_alloc(void); /* Set up everything */
|
||||
API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of permanent_pool */
|
||||
API_EXPORT(void) ap_destroy_pool(pool *);
|
||||
|
||||
/* used to guarantee to the pool debugging code that the sub pool will not be
|
||||
* destroyed before the parent pool
|
||||
*/
|
||||
#ifndef POOL_DEBUG
|
||||
#ifdef ap_pool_join
|
||||
#undef ap_pool_join
|
||||
#endif
|
||||
#define ap_pool_join(a,b)
|
||||
#else
|
||||
API_EXPORT(void) ap_pool_join(pool * p, pool * sub);
|
||||
API_EXPORT(pool *) ap_find_pool(const void *ts);
|
||||
API_EXPORT(int) ap_pool_is_ancestor(pool * a, pool * b);
|
||||
#endif
|
||||
|
||||
/* Clearing out EVERYTHING in an pool... destroys any sub-pools */
|
||||
|
||||
API_EXPORT(void) ap_clear_pool(struct pool *);
|
||||
|
||||
/* Preparing for exec() --- close files, etc., but *don't* flush I/O
|
||||
* buffers, *don't* wait for subprocesses, and *don't* free any memory.
|
||||
*/
|
||||
|
||||
API_EXPORT(void) ap_cleanup_for_exec(void);
|
||||
|
||||
/* routines to allocate memory from an pool... */
|
||||
|
||||
API_EXPORT(void *) ap_palloc(struct pool *, int nbytes);
|
||||
API_EXPORT(void *) ap_pcalloc(struct pool *, int nbytes);
|
||||
API_EXPORT(char *) ap_pstrdup(struct pool *, const char *s);
|
||||
/* make a nul terminated copy of the n characters starting with s */
|
||||
API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, int n);
|
||||
API_EXPORT_NONSTD(char *) ap_pstrcat(struct pool *, ...); /* all '...' must be char* */
|
||||
API_EXPORT_NONSTD(char *) ap_psprintf(struct pool *, const char *fmt,
|
||||
...)
|
||||
__attribute__ ((format(printf, 2, 3)));
|
||||
API_EXPORT(char *) ap_pvsprintf(struct pool *, const char *fmt,
|
||||
va_list);
|
||||
|
||||
/* array and alist management... keeping lists of things.
|
||||
* Common enough to want common support code ...
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
ap_pool *pool;
|
||||
int elt_size;
|
||||
int nelts;
|
||||
int nalloc;
|
||||
char *elts;
|
||||
} array_header;
|
||||
|
||||
API_EXPORT(array_header *) ap_make_array(pool * p, int nelts,
|
||||
int elt_size);
|
||||
API_EXPORT(void *) ap_push_array(array_header *);
|
||||
API_EXPORT(void) ap_array_cat(array_header * dst,
|
||||
const array_header * src);
|
||||
API_EXPORT(array_header *) ap_append_arrays(pool *,
|
||||
const array_header *,
|
||||
const array_header *);
|
||||
|
||||
/* copy_array copies the *entire* array. copy_array_hdr just copies
|
||||
* the header, and arranges for the elements to be copied if (and only
|
||||
* if) the code subsequently does a push or arraycat.
|
||||
*/
|
||||
|
||||
API_EXPORT(array_header *) ap_copy_array(pool * p,
|
||||
const array_header * src);
|
||||
API_EXPORT(array_header *) ap_copy_array_hdr(pool * p,
|
||||
const array_header * src);
|
||||
|
||||
|
||||
/* Tables. Implemented alist style, for now, though we try to keep
|
||||
* it so that imposing a hash table structure on top in the future
|
||||
* wouldn't be *too* hard...
|
||||
*
|
||||
* Note that key comparisons for these are case-insensitive, largely
|
||||
* because that's what's appropriate and convenient everywhere they're
|
||||
* currently being used...
|
||||
*/
|
||||
|
||||
typedef struct table table;
|
||||
|
||||
typedef struct {
|
||||
char *key; /* maybe NULL in future;
|
||||
* check when iterating thru table_elts
|
||||
*/
|
||||
char *val;
|
||||
} table_entry;
|
||||
|
||||
API_EXPORT(table *) ap_make_table(pool * p, int nelts);
|
||||
API_EXPORT(table *) ap_copy_table(pool * p, const table *);
|
||||
API_EXPORT(void) ap_clear_table(table *);
|
||||
API_EXPORT(const char *) ap_table_get(const table *, const char *);
|
||||
API_EXPORT(void) ap_table_set(table *, const char *name,
|
||||
const char *val);
|
||||
API_EXPORT(void) ap_table_setn(table *, const char *name,
|
||||
const char *val);
|
||||
API_EXPORT(void) ap_table_merge(table *, const char *name,
|
||||
const char *more_val);
|
||||
API_EXPORT(void) ap_table_mergen(table *, const char *name,
|
||||
const char *more_val);
|
||||
API_EXPORT(void) ap_table_unset(table *, const char *key);
|
||||
API_EXPORT(void) ap_table_add(table *, const char *name,
|
||||
const char *val);
|
||||
API_EXPORT(void) ap_table_addn(table *, const char *name,
|
||||
const char *val);
|
||||
API_EXPORT(void)
|
||||
ap_table_do(int (*comp) (void *, const char *, const char *), void *rec,
|
||||
const table * t, ...);
|
||||
|
||||
API_EXPORT(table *) ap_overlay_tables(pool * p, const table * overlay,
|
||||
const table * base);
|
||||
|
||||
/* XXX: these know about the definition of struct table in alloc.c. That
|
||||
* definition is not here because it is supposed to be private, and by not
|
||||
* placing it here we are able to get compile-time diagnostics from modules
|
||||
* written which assume that a table is the same as an array_header. -djg
|
||||
*/
|
||||
#define ap_table_elts(t) ((array_header *)(t))
|
||||
#define ap_is_empty_table(t) (((t) == NULL)||(((array_header *)(t))->nelts == 0))
|
||||
|
||||
/* routines to remember allocation of other sorts of things...
|
||||
* generic interface first. Note that we want to have two separate
|
||||
* cleanup functions in the general case, one for exec() preparation,
|
||||
* to keep CGI scripts and the like from inheriting access to things
|
||||
* they shouldn't be able to touch, and one for actually cleaning up,
|
||||
* when the actual server process wants to get rid of the thing,
|
||||
* whatever it is.
|
||||
*
|
||||
* kill_cleanup disarms a cleanup, presumably because the resource in
|
||||
* question has been closed, freed, or whatever, and it's scarce
|
||||
* enough to want to reclaim (e.g., descriptors). It arranges for the
|
||||
* resource not to be cleaned up a second time (it might have been
|
||||
* reallocated). run_cleanup does the same, but runs it first.
|
||||
*
|
||||
* Cleanups are identified for purposes of finding & running them off by the
|
||||
* plain_cleanup and data, which should presumably be unique.
|
||||
*
|
||||
* NB any code which invokes register_cleanup or kill_cleanup directly
|
||||
* is a critical section which should be guarded by block_alarms() and
|
||||
* unblock_alarms() below...
|
||||
*/
|
||||
|
||||
API_EXPORT(void) ap_register_cleanup(pool * p, void *data,
|
||||
void (*plain_cleanup) (void *),
|
||||
void (*child_cleanup) (void *));
|
||||
|
||||
API_EXPORT(void) ap_kill_cleanup(pool * p, void *data,
|
||||
void (*plain_cleanup) (void *));
|
||||
API_EXPORT(void) ap_run_cleanup(pool * p, void *data,
|
||||
void (*cleanup) (void *));
|
||||
|
||||
/* A "do-nothing" cleanup, for register_cleanup; it's faster to do
|
||||
* things this way than to test for NULL. */
|
||||
API_EXPORT_NONSTD(void) ap_null_cleanup(void *data);
|
||||
|
||||
/* The time between when a resource is actually allocated, and when it
|
||||
* its cleanup is registered is a critical section, during which the
|
||||
* resource could leak if we got interrupted or timed out. So, anything
|
||||
* which registers cleanups should bracket resource allocation and the
|
||||
* cleanup registry with these. (This is done internally by run_cleanup).
|
||||
*
|
||||
* NB they are actually implemented in http_main.c, since they are bound
|
||||
* up with timeout handling in general...
|
||||
*/
|
||||
|
||||
API_EXPORT(void) ap_block_alarms(void);
|
||||
API_EXPORT(void) ap_unblock_alarms(void);
|
||||
|
||||
/* Common cases which want utility support..
|
||||
* the note_cleanups_for_foo routines are for
|
||||
*/
|
||||
|
||||
API_EXPORT(FILE *) ap_pfopen(struct pool *, const char *name,
|
||||
const char *fmode);
|
||||
API_EXPORT(FILE *) ap_pfdopen(struct pool *, int fd, const char *fmode);
|
||||
API_EXPORT(int) ap_popenf(struct pool *, const char *name, int flg,
|
||||
int mode);
|
||||
|
||||
API_EXPORT(void) ap_note_cleanups_for_file(pool *, FILE *);
|
||||
API_EXPORT(void) ap_note_cleanups_for_fd(pool *, int);
|
||||
#ifdef WIN32
|
||||
API_EXPORT(void) ap_note_cleanups_for_h(pool *, HANDLE);
|
||||
#endif
|
||||
API_EXPORT(void) ap_kill_cleanups_for_fd(pool * p, int fd);
|
||||
|
||||
API_EXPORT(void) ap_note_cleanups_for_socket(pool *, int);
|
||||
API_EXPORT(void) ap_kill_cleanups_for_socket(pool * p, int sock);
|
||||
API_EXPORT(int) ap_psocket(pool * p, int, int, int);
|
||||
API_EXPORT(int) ap_pclosesocket(pool * a, int sock);
|
||||
|
||||
API_EXPORT(regex_t *) ap_pregcomp(pool * p, const char *pattern,
|
||||
int cflags);
|
||||
API_EXPORT(void) ap_pregfree(pool * p, regex_t * reg);
|
||||
|
||||
/* routines to note closes... file descriptors are constrained enough
|
||||
* on some systems that we want to support this.
|
||||
*/
|
||||
|
||||
API_EXPORT(int) ap_pfclose(struct pool *, FILE *);
|
||||
API_EXPORT(int) ap_pclosef(struct pool *, int fd);
|
||||
#ifdef WIN32
|
||||
API_EXPORT(int) ap_pcloseh(struct pool *, HANDLE hDevice);
|
||||
#endif
|
||||
|
||||
/* routines to deal with directories */
|
||||
API_EXPORT(DIR *) ap_popendir(pool * p, const char *name);
|
||||
API_EXPORT(void) ap_pclosedir(pool * p, DIR * d);
|
||||
|
||||
/* ... even child processes (which we may want to wait for,
|
||||
* or to kill outright, on unexpected termination).
|
||||
*
|
||||
* ap_spawn_child is a utility routine which handles an awful lot of
|
||||
* the rigamarole associated with spawning a child --- it arranges
|
||||
* for pipes to the child's stdin and stdout, if desired (if not,
|
||||
* set the associated args to NULL). It takes as args a function
|
||||
* to call in the child, and an argument to be passed to the function.
|
||||
*/
|
||||
|
||||
enum kill_conditions {
|
||||
kill_never, /* process is never sent any signals */
|
||||
kill_always, /* process is sent SIGKILL on pool cleanup */
|
||||
kill_after_timeout, /* SIGTERM, wait 3 seconds, SIGKILL */
|
||||
just_wait, /* wait forever for the process to complete */
|
||||
kill_only_once /* send SIGTERM and then wait */
|
||||
};
|
||||
|
||||
typedef struct child_info child_info;
|
||||
API_EXPORT(void) ap_note_subprocess(pool * a, int pid,
|
||||
enum kill_conditions how);
|
||||
API_EXPORT(int) ap_spawn_child(pool *, int (*)(void *, child_info *),
|
||||
void *, enum kill_conditions,
|
||||
FILE ** pipe_in, FILE ** pipe_out,
|
||||
FILE ** pipe_err);
|
||||
|
||||
/* magic numbers --- min free bytes to consider a free pool block useable,
|
||||
* and the min amount to allocate if we have to go to malloc() */
|
||||
|
||||
#ifndef BLOCK_MINFREE
|
||||
#define BLOCK_MINFREE 4096
|
||||
#endif
|
||||
#ifndef BLOCK_MINALLOC
|
||||
#define BLOCK_MINALLOC 8192
|
||||
#endif
|
||||
|
||||
/* Finally, some accounting */
|
||||
|
||||
API_EXPORT(long) ap_bytes_in_pool(pool * p);
|
||||
API_EXPORT(long) ap_bytes_in_free_blocks(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !APACHE_ALLOC_H */
|
@ -1,169 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
* The ap_vsnprintf/ap_snprintf functions are based on, and used with the
|
||||
* permission of, the SIO stdio-replacement strx_* functions by Panos
|
||||
* Tsirigotis <panos@alumni.cs.colorado.edu> for xinetd.
|
||||
*/
|
||||
|
||||
#ifndef APACHE_AP_H
|
||||
#define APACHE_AP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
API_EXPORT(char *) ap_cpystrn(char *, const char *, size_t);
|
||||
int ap_slack(int, int);
|
||||
API_EXPORT(int) ap_snprintf(char *, size_t, const char *, ...);
|
||||
API_EXPORT(int) ap_vsnprintf(char *, size_t, const char *, va_list ap);
|
||||
int ap_execle(const char *, const char *, ...);
|
||||
int ap_execve(const char *, const char *argv[], const char *envp[]);
|
||||
|
||||
/* small utility macros to make things easier to read */
|
||||
|
||||
#ifdef WIN32
|
||||
#define ap_killpg(x, y)
|
||||
#else
|
||||
#ifdef NO_KILLPG
|
||||
#define ap_killpg(x, y) (kill (-(x), (y)))
|
||||
#else
|
||||
#define ap_killpg(x, y) (killpg ((x), (y)))
|
||||
#endif
|
||||
#endif /* WIN32 */
|
||||
|
||||
/* ap_vformatter() is a generic printf-style formatting routine
|
||||
* with some extensions. The extensions are:
|
||||
*
|
||||
* %pA takes a struct in_addr *, and prints it as a.b.c.d
|
||||
* %pI takes a struct sockaddr_in * and prints it as a.b.c.d:port
|
||||
* %pp takes a void * and outputs it in hex
|
||||
*
|
||||
* The %p hacks are to force gcc's printf warning code to skip
|
||||
* over a pointer argument without complaining. This does
|
||||
* mean that the ANSI-style %p (output a void * in hex format) won't
|
||||
* work as expected at all, but that seems to be a fair trade-off
|
||||
* for the increased robustness of having printf-warnings work.
|
||||
*
|
||||
* Additionally, ap_vformatter allows for arbitrary output methods
|
||||
* using the ap_vformatter_buff and flush_func.
|
||||
*
|
||||
* The ap_vformatter_buff has two elements curpos and endpos.
|
||||
* curpos is where ap_vformatter will write the next byte of output.
|
||||
* It proceeds writing output to curpos, and updating curpos, until
|
||||
* either the end of output is reached, or curpos == endpos (i.e. the
|
||||
* buffer is full).
|
||||
*
|
||||
* If the end of output is reached, ap_vformatter returns the
|
||||
* number of bytes written.
|
||||
*
|
||||
* When the buffer is full, the flush_func is called. The flush_func
|
||||
* can return -1 to indicate that no further output should be attempted,
|
||||
* and ap_vformatter will return immediately with -1. Otherwise
|
||||
* the flush_func should flush the buffer in whatever manner is
|
||||
* appropriate, re-initialize curpos and endpos, and return 0.
|
||||
*
|
||||
* Note that flush_func is only invoked as a result of attempting to
|
||||
* write another byte at curpos when curpos >= endpos. So for
|
||||
* example, it's possible when the output exactly matches the buffer
|
||||
* space available that curpos == endpos will be true when
|
||||
* ap_vformatter returns.
|
||||
*
|
||||
* ap_vformatter does not call out to any other code, it is entirely
|
||||
* self-contained. This allows the callers to do things which are
|
||||
* otherwise "unsafe". For example, ap_psprintf uses the "scratch"
|
||||
* space at the unallocated end of a block, and doesn't actually
|
||||
* complete the allocation until ap_vformatter returns. ap_psprintf
|
||||
* would be completely broken if ap_vformatter were to call anything
|
||||
* that used a pool. Similarly http_bprintf() uses the "scratch"
|
||||
* space at the end of its output buffer, and doesn't actually note
|
||||
* that the space is in use until it either has to flush the buffer
|
||||
* or until ap_vformatter returns.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
char *curpos;
|
||||
char *endpos;
|
||||
} ap_vformatter_buff;
|
||||
|
||||
API_EXPORT(int) ap_vformatter(int (*flush_func) (ap_vformatter_buff *),
|
||||
ap_vformatter_buff *, const char *fmt,
|
||||
va_list ap);
|
||||
|
||||
/* These are snprintf implementations based on ap_vformatter().
|
||||
*
|
||||
* Note that various standards and implementations disagree on the return
|
||||
* value of snprintf, and side-effects due to %n in the formatting string.
|
||||
* ap_snprintf behaves as follows:
|
||||
*
|
||||
* Process the format string until the entire string is exhausted, or
|
||||
* the buffer fills. If the buffer fills then stop processing immediately
|
||||
* (so no further %n arguments are processed), and return the buffer
|
||||
* length. In all cases the buffer is NUL terminated.
|
||||
*
|
||||
* In no event does ap_snprintf return a negative number. It's not possible
|
||||
* to distinguish between an output which was truncated, and an output which
|
||||
* exactly filled the buffer.
|
||||
*/
|
||||
API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,
|
||||
...)
|
||||
__attribute__ ((format(printf, 3, 4)));
|
||||
API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format,
|
||||
va_list ap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !APACHE_AP_H */
|
@ -1,418 +0,0 @@
|
||||
/*
|
||||
** ap_compat.h -- Apache Backward Compatibility
|
||||
**
|
||||
** INCLUDE THIS HEADER FILE ONLY IF YOU REALLY NEED
|
||||
** BACKWARD COMPATIBILITY TO OLD APACHE RESOURCES.
|
||||
*/
|
||||
|
||||
#ifndef AP_COMPAT_H
|
||||
#define AP_COMPAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mapping of Apache 1.2 global symbols to the
|
||||
* namespace conflict free variants used in Apache 1.3
|
||||
*/
|
||||
|
||||
#define MD5Final ap_MD5Final
|
||||
#define MD5Init ap_MD5Init
|
||||
#define MD5Update ap_MD5Update
|
||||
#define acquire_mutex ap_acquire_mutex
|
||||
#define add_cgi_vars ap_add_cgi_vars
|
||||
#define add_common_vars ap_add_common_vars
|
||||
#define add_module ap_add_module
|
||||
#define add_named_module ap_add_named_module
|
||||
#define add_per_dir_conf ap_add_per_dir_conf
|
||||
#define add_per_url_conf ap_add_per_url_conf
|
||||
#define allow_options ap_allow_options
|
||||
#define allow_overrides ap_allow_overrides
|
||||
#define apapi_get_server_built ap_get_server_built
|
||||
#define apapi_get_server_version ap_get_server_version
|
||||
#define aplog_error ap_log_error
|
||||
#define append_arrays ap_append_arrays
|
||||
#define array_cat ap_array_cat
|
||||
#define auth_name ap_auth_name
|
||||
#define auth_type ap_auth_type
|
||||
#define basic_http_header ap_basic_http_header
|
||||
#define bclose ap_bclose
|
||||
#define bcreate ap_bcreate
|
||||
#define bfilbuf ap_bfilbuf
|
||||
#define bfileno ap_bfileno
|
||||
#define bflsbuf ap_bflsbuf
|
||||
#define bflush ap_bflush
|
||||
#define bgetc ap_bgetc
|
||||
#define bgetflag ap_bgetflag
|
||||
#define bgetopt ap_bgetopt
|
||||
#define bgets ap_bgets
|
||||
#define bhalfduplex ap_bhalfduplex
|
||||
#define bind_address ap_bind_address
|
||||
#define block_alarms ap_block_alarms
|
||||
#define blookc ap_blookc
|
||||
#define bnonblock ap_bnonblock
|
||||
#define bonerror ap_bonerror
|
||||
#define bprintf ap_bprintf
|
||||
#define bpushfd ap_bpushfd
|
||||
#define bputc ap_bputc
|
||||
#define bputs ap_bputs
|
||||
#define bread ap_bread
|
||||
#define bsetflag ap_bsetflag
|
||||
#define bsetopt ap_bsetopt
|
||||
#define bskiplf ap_bskiplf
|
||||
#define bvputs ap_bvputs
|
||||
#define bwrite ap_bwrite
|
||||
#define bytes_in_free_blocks ap_bytes_in_free_blocks
|
||||
#define bytes_in_pool ap_bytes_in_pool
|
||||
#define call_exec ap_call_exec
|
||||
#define can_exec ap_can_exec
|
||||
#define cfg_closefile ap_cfg_closefile
|
||||
#define cfg_getc ap_cfg_getc
|
||||
#define cfg_getline ap_cfg_getline
|
||||
#define chdir_file ap_chdir_file
|
||||
#define check_access ap_check_access
|
||||
#define check_alarm ap_check_alarm
|
||||
#define check_auth ap_check_auth
|
||||
#define check_cmd_context ap_check_cmd_context
|
||||
#define check_user_id ap_check_user_id
|
||||
#define checkmask ap_checkmask
|
||||
#define child_exit_modules ap_child_exit_modules
|
||||
#define child_init_modules ap_child_init_modules
|
||||
#define child_terminate ap_child_terminate
|
||||
#define cleanup_for_exec ap_cleanup_for_exec
|
||||
#define clear_module_list ap_clear_module_list
|
||||
#define clear_pool ap_clear_pool
|
||||
#define clear_table ap_clear_table
|
||||
#define close_piped_log ap_close_piped_log
|
||||
#define construct_server ap_construct_server
|
||||
#define construct_url ap_construct_url
|
||||
#define copy_array ap_copy_array
|
||||
#define copy_array_hdr ap_copy_array_hdr
|
||||
#define copy_table ap_copy_table
|
||||
#define core_reorder_directories ap_core_reorder_directories
|
||||
#define coredump_dir ap_coredump_dir
|
||||
#define count_dirs ap_count_dirs
|
||||
#define create_environment ap_create_environment
|
||||
#define create_mutex ap_create_mutex
|
||||
#define create_per_dir_config ap_create_per_dir_config
|
||||
#define create_request_config ap_create_request_config
|
||||
#define daemons_limit ap_daemons_limit
|
||||
#define daemons_max_free ap_daemons_max_free
|
||||
#define daemons_min_free ap_daemons_min_free
|
||||
#define daemons_to_start ap_daemons_to_start
|
||||
#define day_snames ap_day_snames
|
||||
#define default_port ap_default_port
|
||||
#define default_port_for_request ap_default_port_for_request
|
||||
#define default_type ap_default_type
|
||||
#define destroy_mutex ap_destroy_mutex
|
||||
#define destroy_pool ap_destroy_pool
|
||||
#define destroy_sub_req ap_destroy_sub_req
|
||||
#define die ap_die
|
||||
#define discard_request_body ap_discard_request_body
|
||||
#define document_root ap_document_root
|
||||
#define dummy_mutex ap_dummy_mutex
|
||||
#define each_byterange ap_each_byterange
|
||||
#define error_log2stderr ap_error_log2stderr
|
||||
#define escape_html ap_escape_html
|
||||
#define escape_path_segment ap_escape_path_segment
|
||||
#define escape_shell_cmd ap_escape_shell_cmd
|
||||
#define excess_requests_per_child ap_excess_requests_per_child
|
||||
#define exists_scoreboard_image ap_exists_scoreboard_image
|
||||
#define finalize_request_protocol ap_finalize_request_protocol
|
||||
#define finalize_sub_req_protocol ap_finalize_sub_req_protocol
|
||||
#define find_command ap_find_command
|
||||
#define find_command_in_modules ap_find_command_in_modules
|
||||
#define find_last_token ap_find_last_token
|
||||
#define find_linked_module ap_find_linked_module
|
||||
#define find_module_name ap_find_module_name
|
||||
#define find_path_info ap_find_path_info
|
||||
#define find_pool ap_find_pool
|
||||
#define find_token ap_find_token
|
||||
#define find_types ap_find_types
|
||||
#define fini_vhost_config ap_fini_vhost_config
|
||||
#define fnmatch ap_fnmatch
|
||||
#define force_library_loading ap_force_library_loading
|
||||
#define get_basic_auth_pw ap_get_basic_auth_pw
|
||||
#define get_client_block ap_get_client_block
|
||||
#define get_gmtoff ap_get_gmtoff
|
||||
#define get_local_host ap_get_local_host
|
||||
#define get_module_config ap_get_module_config
|
||||
#define get_remote_host ap_get_remote_host
|
||||
#define get_remote_logname ap_get_remote_logname
|
||||
#define get_server_name ap_get_server_name
|
||||
#define get_server_port ap_get_server_port
|
||||
#define get_time ap_get_time
|
||||
#define get_token ap_get_token
|
||||
#define get_virthost_addr ap_get_virthost_addr
|
||||
#define getparents ap_getparents
|
||||
#define getword ap_getword
|
||||
#define getword_conf ap_getword_conf
|
||||
#define getword_conf_nc ap_getword_conf_nc
|
||||
#define getword_nc ap_getword_nc
|
||||
#define getword_nulls ap_getword_nulls
|
||||
#define getword_nulls_nc ap_getword_nulls_nc
|
||||
#define getword_white ap_getword_white
|
||||
#define getword_white_nc ap_getword_white_nc
|
||||
#define gm_timestr_822 ap_gm_timestr_822
|
||||
#define gname2id ap_gname2id
|
||||
#define group_id ap_group_id
|
||||
#define handle_command ap_handle_command
|
||||
#define hard_timeout ap_hard_timeout
|
||||
#define ht_time ap_ht_time
|
||||
#define http_method ap_http_method
|
||||
#define ind ap_ind
|
||||
#define index_of_response ap_index_of_response
|
||||
#define init_alloc ap_init_alloc
|
||||
#define init_modules ap_init_modules
|
||||
#define init_vhost_config ap_init_vhost_config
|
||||
#define init_virtual_host ap_init_virtual_host
|
||||
#define internal_redirect ap_internal_redirect
|
||||
#define internal_redirect_handler ap_internal_redirect_handler
|
||||
#define invoke_handler ap_invoke_handler
|
||||
#define is_default_port ap_is_default_port
|
||||
#define is_directory ap_is_directory
|
||||
#define is_empty_table ap_is_empty_table
|
||||
#define is_fnmatch ap_is_fnmatch
|
||||
#define is_initial_req ap_is_initial_req
|
||||
#define is_matchexp ap_is_matchexp
|
||||
#define is_table_empty ap_is_table_empty
|
||||
#define is_url ap_is_url
|
||||
#define keepalive_timeout ap_keepalive_timeout
|
||||
#define kill_cleanup ap_kill_cleanup
|
||||
#define kill_cleanups_for_fd ap_kill_cleanups_for_fd
|
||||
#define kill_cleanups_for_socket ap_kill_cleanups_for_socket
|
||||
#define kill_timeout ap_kill_timeout
|
||||
#define limit_section ap_limit_section
|
||||
#define listenbacklog ap_listenbacklog
|
||||
#define listeners ap_listeners
|
||||
#define lock_fname ap_lock_fname
|
||||
#define log_assert ap_log_assert
|
||||
#define log_error ap_log_error_old
|
||||
#define log_pid ap_log_pid
|
||||
#define log_printf ap_log_printf
|
||||
#define log_reason ap_log_reason
|
||||
#define log_transaction ap_log_transaction
|
||||
#define log_unixerr ap_log_unixerr
|
||||
#define make_array ap_make_array
|
||||
#define make_dirstr ap_make_dirstr
|
||||
#define make_dirstr_parent ap_make_dirstr_parent
|
||||
#define make_dirstr_prefix ap_make_dirstr_prefix
|
||||
#define make_full_path ap_make_full_path
|
||||
#define make_sub_pool ap_make_sub_pool
|
||||
#define make_table ap_make_table
|
||||
#define matches_request_vhost ap_matches_request_vhost
|
||||
#define max_requests_per_child ap_max_requests_per_child
|
||||
#define md5 ap_md5
|
||||
#define meets_conditions ap_meets_conditions
|
||||
#define merge_per_dir_configs ap_merge_per_dir_configs
|
||||
#define month_snames ap_month_snames
|
||||
#define no2slash ap_no2slash
|
||||
#define note_auth_failure ap_note_auth_failure
|
||||
#define note_basic_auth_failure ap_note_basic_auth_failure
|
||||
#define note_cleanups_for_fd ap_note_cleanups_for_fd
|
||||
#define note_cleanups_for_file ap_note_cleanups_for_file
|
||||
#define note_cleanups_for_socket ap_note_cleanups_for_socket
|
||||
#define note_digest_auth_failure ap_note_digest_auth_failure
|
||||
#define note_subprocess ap_note_subprocess
|
||||
#define null_cleanup ap_null_cleanup
|
||||
#define open_logs ap_open_logs
|
||||
#define open_mutex ap_open_mutex
|
||||
#define open_piped_log ap_open_piped_log
|
||||
#define os_canonical_filename ap_os_canonical_filename
|
||||
#define os_dl_load ap_os_dso_load
|
||||
#define os_dl_unload ap_os_dso_unload
|
||||
#define os_dl_sym ap_os_dso_sym
|
||||
#define os_dl_error ap_os_dso_error
|
||||
#define os_escape_path ap_os_escape_path
|
||||
#define os_is_path_absolute ap_os_is_path_absolute
|
||||
#define overlay_tables ap_overlay_tables
|
||||
#define palloc ap_palloc
|
||||
#define parseHTTPdate ap_parseHTTPdate
|
||||
#define parse_hostinfo_components ap_parse_hostinfo_components
|
||||
#define parse_htaccess ap_parse_htaccess
|
||||
#define parse_uri ap_parse_uri
|
||||
#define parse_uri_components ap_parse_uri_components
|
||||
#define parse_vhost_addrs ap_parse_vhost_addrs
|
||||
#define pcalloc ap_pcalloc
|
||||
#define pcfg_open_custom ap_pcfg_open_custom
|
||||
#define pcfg_openfile ap_pcfg_openfile
|
||||
#define pclosedir ap_pclosedir
|
||||
#define pclosef ap_pclosef
|
||||
#define pclosesocket ap_pclosesocket
|
||||
#define pduphostent ap_pduphostent
|
||||
#define pfclose ap_pfclose
|
||||
#define pfdopen ap_pfdopen
|
||||
#define pfopen ap_pfopen
|
||||
#define pgethostbyname ap_pgethostbyname
|
||||
#define pid_fname ap_pid_fname
|
||||
#define piped_log_read_fd ap_piped_log_read_fd
|
||||
#define piped_log_write_fd ap_piped_log_write_fd
|
||||
#define pool_is_ancestor ap_pool_is_ancestor
|
||||
#define pool_join ap_pool_join
|
||||
#define popendir ap_popendir
|
||||
#define popenf ap_popenf
|
||||
#define pregcomp ap_pregcomp
|
||||
#define pregfree ap_pregfree
|
||||
#define pregsub ap_pregsub
|
||||
#define process_request ap_process_request
|
||||
#define process_resource_config ap_process_resource_config
|
||||
#define proxy_add_header ap_proxy_add_header
|
||||
#define proxy_c2hex ap_proxy_c2hex
|
||||
#define proxy_cache_check ap_proxy_cache_check
|
||||
#define proxy_cache_error ap_proxy_cache_error
|
||||
#define proxy_cache_tidy ap_proxy_cache_tidy
|
||||
#define proxy_cache_update ap_proxy_cache_update
|
||||
#define proxy_canon_netloc ap_proxy_canon_netloc
|
||||
#define proxy_canonenc ap_proxy_canonenc
|
||||
#define proxy_connect_handler ap_proxy_connect_handler
|
||||
#define proxy_date_canon ap_proxy_date_canon
|
||||
#define proxy_del_header ap_proxy_del_header
|
||||
#define proxy_doconnect ap_proxy_doconnect
|
||||
#define proxy_ftp_canon ap_proxy_ftp_canon
|
||||
#define proxy_ftp_handler ap_proxy_ftp_handler
|
||||
#define proxy_garbage_coll ap_proxy_garbage_coll
|
||||
#define proxy_garbage_init ap_proxy_garbage_init
|
||||
#define proxy_get_header ap_proxy_get_header
|
||||
#define proxy_hash ap_proxy_hash
|
||||
#define proxy_hex2c ap_proxy_hex2c
|
||||
#define proxy_hex2sec ap_proxy_hex2sec
|
||||
#define proxy_host2addr ap_proxy_host2addr
|
||||
#define proxy_http_canon ap_proxy_http_canon
|
||||
#define proxy_http_handler ap_proxy_http_handler
|
||||
#define proxy_is_domainname ap_proxy_is_domainname
|
||||
#define proxy_is_hostname ap_proxy_is_hostname
|
||||
#define proxy_is_ipaddr ap_proxy_is_ipaddr
|
||||
#define proxy_is_word ap_proxy_is_word
|
||||
#define proxy_liststr ap_proxy_liststr
|
||||
#define proxy_read_headers ap_proxy_read_headers
|
||||
#define proxy_sec2hex ap_proxy_sec2hex
|
||||
#define proxy_send_fb ap_proxy_send_fb
|
||||
#define proxy_send_headers ap_proxy_send_headers
|
||||
#define proxyerror ap_proxyerror
|
||||
#define psignature ap_psignature
|
||||
#define psocket ap_psocket
|
||||
#define psprintf ap_psprintf
|
||||
#define pstrcat ap_pstrcat
|
||||
#define pstrdup ap_pstrdup
|
||||
#define pstrndup ap_pstrndup
|
||||
#define push_array ap_push_array
|
||||
#define pvsprintf ap_pvsprintf
|
||||
#define rationalize_mtime ap_rationalize_mtime
|
||||
#define read_config ap_read_config
|
||||
#define read_request ap_read_request
|
||||
#define register_cleanup ap_register_cleanup
|
||||
#define register_other_child ap_register_other_child
|
||||
#define release_mutex ap_release_mutex
|
||||
#define remove_module ap_remove_module
|
||||
#define requires ap_requires
|
||||
#define reset_timeout ap_reset_timeout
|
||||
#define response_code_string ap_response_code_string
|
||||
#define restart_time ap_restart_time
|
||||
#define rfc1413 ap_rfc1413
|
||||
#define rfc1413_timeout ap_rfc1413_timeout
|
||||
#define rflush ap_rflush
|
||||
#define rind ap_rind
|
||||
#define rprintf ap_rprintf
|
||||
#define rputc ap_rputc
|
||||
#define rputs ap_rputs
|
||||
#define run_cleanup ap_run_cleanup
|
||||
#define run_fixups ap_run_fixups
|
||||
#define run_post_read_request ap_run_post_read_request
|
||||
#define run_sub_req ap_run_sub_req
|
||||
#define rvputs ap_rvputs
|
||||
#define rwrite ap_rwrite
|
||||
#define satisfies ap_satisfies
|
||||
#define scan_script_header_err ap_scan_script_header_err
|
||||
#define scan_script_header_err_buff ap_scan_script_header_err_buff
|
||||
#define scoreboard_fname ap_scoreboard_fname
|
||||
#define scoreboard_image ap_scoreboard_image
|
||||
#define send_error_response ap_send_error_response
|
||||
#define send_fb ap_send_fb
|
||||
#define send_fb_length ap_send_fb_length
|
||||
#define send_fd ap_send_fd
|
||||
#define send_fd_length ap_send_fd_length
|
||||
#define send_header_field ap_send_header_field
|
||||
#define send_http_header ap_send_http_header
|
||||
#define send_http_options ap_send_http_options
|
||||
#define send_http_trace ap_send_http_trace
|
||||
#define send_mmap ap_send_mmap
|
||||
#define send_size ap_send_size
|
||||
#define server_argv0 ap_server_argv0
|
||||
#define server_confname ap_server_confname
|
||||
#define server_post_read_config ap_server_post_read_config
|
||||
#define server_pre_read_config ap_server_pre_read_config
|
||||
#define server_root ap_server_root
|
||||
#define server_root_relative ap_server_root_relative
|
||||
#define set_byterange ap_set_byterange
|
||||
#define set_callback_and_alarm ap_set_callback_and_alarm
|
||||
#define set_content_length ap_set_content_length
|
||||
#define set_etag ap_set_etag
|
||||
#define set_file_slot ap_set_file_slot
|
||||
#define set_flag_slot ap_set_flag_slot
|
||||
#define set_keepalive ap_set_keepalive
|
||||
#define set_last_modified ap_set_last_modified
|
||||
#define set_module_config ap_set_module_config
|
||||
#define set_name_virtual_host ap_set_name_virtual_host
|
||||
#define set_string_slot ap_set_string_slot
|
||||
#define set_string_slot_lower ap_set_string_slot_lower
|
||||
#define set_sub_req_protocol ap_set_sub_req_protocol
|
||||
#define setup_client_block ap_setup_client_block
|
||||
#define setup_prelinked_modules ap_setup_prelinked_modules
|
||||
#define should_client_block ap_should_client_block
|
||||
#define show_directives ap_show_directives
|
||||
#define show_modules ap_show_modules
|
||||
#define soft_timeout ap_soft_timeout
|
||||
#define some_auth_required ap_some_auth_required
|
||||
#define spawn_child_err ap_spawn_child
|
||||
#define spawn_child_err_buff ap_bspawn_child
|
||||
#define srm_command_loop ap_srm_command_loop
|
||||
#define standalone ap_standalone
|
||||
#define start_restart ap_start_restart
|
||||
#define start_shutdown ap_start_shutdown
|
||||
#define str_tolower ap_str_tolower
|
||||
#define strcasecmp_match ap_strcasecmp_match
|
||||
#define strcmp_match ap_strcmp_match
|
||||
#define sub_req_lookup_file ap_sub_req_lookup_file
|
||||
#define sub_req_lookup_uri ap_sub_req_lookup_uri
|
||||
#define suexec_enabled ap_suexec_enabled
|
||||
#define sync_scoreboard_image ap_sync_scoreboard_image
|
||||
#define table_add ap_table_add
|
||||
#define table_addn ap_table_addn
|
||||
#define table_do ap_table_do
|
||||
#define table_elts ap_table_elts
|
||||
#define table_get ap_table_get
|
||||
#define table_merge ap_table_merge
|
||||
#define table_mergen ap_table_mergen
|
||||
#define table_set ap_table_set
|
||||
#define table_setn ap_table_setn
|
||||
#define table_unset ap_table_unset
|
||||
#define threads_per_child ap_threads_per_child
|
||||
#define time_process_request ap_time_process_request
|
||||
#define tm2sec ap_tm2sec
|
||||
#define translate_name ap_translate_name
|
||||
#define uname2id ap_uname2id
|
||||
#define unblock_alarms ap_unblock_alarms
|
||||
#define unescape_url ap_unescape_url
|
||||
#define unparse_uri_components ap_unparse_uri_components
|
||||
#define unregister_other_child ap_unregister_other_child
|
||||
#define update_child_status ap_update_child_status
|
||||
#define update_mtime ap_update_mtime
|
||||
#define update_vhost_from_headers ap_update_vhost_from_headers
|
||||
#define update_vhost_given_ip ap_update_vhost_given_ip
|
||||
#define user_id ap_user_id
|
||||
#define user_name ap_user_name
|
||||
#define util_init ap_util_init
|
||||
#define util_uri_init ap_util_uri_init
|
||||
#define uudecode ap_uudecode
|
||||
#define vbprintf ap_vbprintf
|
||||
|
||||
/*
|
||||
* Macros for routines whose arguments have changed over time.
|
||||
*/
|
||||
#define spawn_child(p,f,v,k,in,out) ap_spawn_child(p,f,v,k,in,out,NULL)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !AP_COMPAT_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* ap_config_auto.h -- Automatically determined configuration stuff
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED - DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef AP_CONFIG_AUTO_H
|
||||
#define AP_CONFIG_AUTO_H
|
||||
|
||||
/* check: #include <dlfcn.h> */
|
||||
#ifndef HAVE_DLFCN_H
|
||||
#define HAVE_DLFCN_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <dl.h> */
|
||||
#ifdef HAVE_DL_H
|
||||
#undef HAVE_DL_H
|
||||
#endif
|
||||
|
||||
/* check: #include <bstring.h> */
|
||||
#ifdef HAVE_BSTRING_H
|
||||
#undef HAVE_BSTRING_H
|
||||
#endif
|
||||
|
||||
/* check: #include <crypt.h> */
|
||||
#ifndef HAVE_CRYPT_H
|
||||
#define HAVE_CRYPT_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <unistd.h> */
|
||||
#ifndef HAVE_UNISTD_H
|
||||
#define HAVE_UNISTD_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <sys/resource.h> */
|
||||
#ifndef HAVE_SYS_RESOURCE_H
|
||||
#define HAVE_SYS_RESOURCE_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <sys/select.h> */
|
||||
#ifndef HAVE_SYS_SELECT_H
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <sys/processor.h> */
|
||||
#ifndef HAVE_SYS_PROCESSOR_H
|
||||
#define HAVE_SYS_PROCESSOR_H 1
|
||||
#endif
|
||||
|
||||
/* build flag: -DSOLARIS2=251 */
|
||||
#ifndef SOLARIS2
|
||||
#define SOLARIS2 251
|
||||
#endif
|
||||
|
||||
#endif /* AP_CONFIG_AUTO_H */
|
@ -1,88 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AP_CTYPE_H
|
||||
#define AP_CTYPE_H
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* These macros allow correct support of 8-bit characters on systems which
|
||||
* support 8-bit characters. Pretty dumb how the cast is required, but
|
||||
* that's legacy libc for ya. These new macros do not support EOF like
|
||||
* the standard macros do. Tough.
|
||||
*/
|
||||
#define ap_isalnum(c) (isalnum(((unsigned char)(c))))
|
||||
#define ap_isalpha(c) (isalpha(((unsigned char)(c))))
|
||||
#define ap_iscntrl(c) (iscntrl(((unsigned char)(c))))
|
||||
#define ap_isdigit(c) (isdigit(((unsigned char)(c))))
|
||||
#define ap_isgraph(c) (isgraph(((unsigned char)(c))))
|
||||
#define ap_islower(c) (islower(((unsigned char)(c))))
|
||||
#define ap_isprint(c) (isprint(((unsigned char)(c))))
|
||||
#define ap_ispunct(c) (ispunct(((unsigned char)(c))))
|
||||
#define ap_isspace(c) (isspace(((unsigned char)(c))))
|
||||
#define ap_isupper(c) (isupper(((unsigned char)(c))))
|
||||
#define ap_tolower(c) (tolower(((unsigned char)(c))))
|
||||
#define ap_toupper(c) (toupper(((unsigned char)(c))))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !AP_CTYPE_H */
|
@ -1,237 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1996-1998 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_BUFF_H
|
||||
#define APACHE_BUFF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef B_SFIO
|
||||
#include "sfio.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Reading is buffered */
|
||||
#define B_RD (1)
|
||||
/* Writing is buffered */
|
||||
#define B_WR (2)
|
||||
#define B_RDWR (3)
|
||||
/* At end of file, or closed stream; no further input allowed */
|
||||
#define B_EOF (4)
|
||||
/* No further output possible */
|
||||
#define B_EOUT (8)
|
||||
/* A read error has occurred */
|
||||
#define B_RDERR (16)
|
||||
/* A write error has occurred */
|
||||
#define B_WRERR (32)
|
||||
#ifdef B_ERROR /* in SVR4: sometimes defined in /usr/include/sys/buf.h */
|
||||
#undef B_ERROR
|
||||
#endif
|
||||
#define B_ERROR (48)
|
||||
/* Use chunked writing */
|
||||
#define B_CHUNK (64)
|
||||
/* bflush() if a read would block */
|
||||
#define B_SAFEREAD (128)
|
||||
/* buffer is a socket */
|
||||
#define B_SOCKET (256)
|
||||
#ifdef CHARSET_EBCDIC
|
||||
#define B_ASCII2EBCDIC 0x40000000 /* Enable conversion for this buffer */
|
||||
#define B_EBCDIC2ASCII 0x80000000 /* Enable conversion for this buffer */
|
||||
#endif /*CHARSET_EBCDIC */
|
||||
|
||||
typedef struct buff_struct BUFF;
|
||||
|
||||
struct buff_struct {
|
||||
int flags; /* flags */
|
||||
unsigned char *inptr; /* pointer to next location to read */
|
||||
int incnt; /* number of bytes left to read from input buffer;
|
||||
* always 0 if had a read error */
|
||||
int outchunk; /* location of chunk header when chunking */
|
||||
int outcnt; /* number of byte put in output buffer */
|
||||
unsigned char *inbase;
|
||||
unsigned char *outbase;
|
||||
int bufsiz;
|
||||
void (*error) (BUFF * fb, int op, void *data);
|
||||
void *error_data;
|
||||
long int bytes_sent; /* number of bytes actually written */
|
||||
|
||||
ap_pool *pool;
|
||||
|
||||
/* could also put pointers to the basic I/O routines here */
|
||||
int fd; /* the file descriptor */
|
||||
int fd_in; /* input file descriptor, if different */
|
||||
#ifdef WIN32
|
||||
HANDLE hFH; /* Windows filehandle */
|
||||
#endif
|
||||
|
||||
/* transport handle, for RPC binding handle or some such */
|
||||
void *t_handle;
|
||||
|
||||
#ifdef B_SFIO
|
||||
Sfio_t *sf_in;
|
||||
Sfio_t *sf_out;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef B_SFIO
|
||||
typedef struct {
|
||||
Sfdisc_t disc;
|
||||
BUFF *buff;
|
||||
} apache_sfio;
|
||||
|
||||
extern Sfdisc_t *bsfio_new(pool * p, BUFF * b);
|
||||
#endif
|
||||
|
||||
/* Options to bset/getopt */
|
||||
#define BO_BYTECT (1)
|
||||
|
||||
/* Stream creation and modification */
|
||||
API_EXPORT(BUFF *) ap_bcreate(pool * p, int flags);
|
||||
API_EXPORT(void) ap_bpushfd(BUFF * fb, int fd_in, int fd_out);
|
||||
#ifdef WIN32
|
||||
API_EXPORT(void) ap_bpushh(BUFF * fb, HANDLE hFH);
|
||||
#endif
|
||||
API_EXPORT(int) ap_bsetopt(BUFF * fb, int optname, const void *optval);
|
||||
API_EXPORT(int) ap_bgetopt(BUFF * fb, int optname, void *optval);
|
||||
API_EXPORT(int) ap_bsetflag(BUFF * fb, int flag, int value);
|
||||
API_EXPORT(int) ap_bclose(BUFF * fb);
|
||||
|
||||
#define ap_bgetflag(fb, flag) ((fb)->flags & (flag))
|
||||
|
||||
/* Error handling */
|
||||
API_EXPORT(void) ap_bonerror(BUFF * fb,
|
||||
void (*error) (BUFF *, int, void *),
|
||||
void *data);
|
||||
|
||||
/* I/O */
|
||||
API_EXPORT(int) ap_bread(BUFF * fb, void *buf, int nbyte);
|
||||
API_EXPORT(int) ap_bgets(char *s, int n, BUFF * fb);
|
||||
API_EXPORT(int) ap_blookc(char *buff, BUFF * fb);
|
||||
API_EXPORT(int) ap_bskiplf(BUFF * fb);
|
||||
API_EXPORT(int) ap_bwrite(BUFF * fb, const void *buf, int nbyte);
|
||||
API_EXPORT(int) ap_bflush(BUFF * fb);
|
||||
API_EXPORT(int) ap_bputs(const char *x, BUFF * fb);
|
||||
API_EXPORT(int) ap_bvputs(BUFF * fb, ...);
|
||||
API_EXPORT_NONSTD(int) ap_bprintf(BUFF * fb, const char *fmt, ...)
|
||||
__attribute__ ((format(printf, 2, 3)));
|
||||
API_EXPORT(int) ap_vbprintf(BUFF * fb, const char *fmt, va_list vlist);
|
||||
|
||||
/* Internal routines */
|
||||
API_EXPORT(int) ap_bflsbuf(int c, BUFF * fb);
|
||||
API_EXPORT(int) ap_bfilbuf(BUFF * fb);
|
||||
|
||||
#ifndef CHARSET_EBCDIC
|
||||
|
||||
#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \
|
||||
((fb)->incnt--, *((fb)->inptr++)) )
|
||||
|
||||
#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
|
||||
(fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \
|
||||
((fb)->outbase[(fb)->outcnt++] = (c), 0))
|
||||
|
||||
#else /*CHARSET_EBCDIC */
|
||||
|
||||
#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \
|
||||
((fb)->incnt--, (fb->flags & B_ASCII2EBCDIC)\
|
||||
?os_toebcdic[(unsigned char)*((fb)->inptr++)]:*((fb)->inptr++)) )
|
||||
|
||||
#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
|
||||
(fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \
|
||||
((fb)->outbase[(fb)->outcnt++] = (fb->flags & B_EBCDIC2ASCII)\
|
||||
?os_toascii[(unsigned char)c]:(c), 0))
|
||||
|
||||
#endif /*CHARSET_EBCDIC */
|
||||
struct child_info {
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* These handles are used by ap_call_exec to call
|
||||
* create process with pipe handles.
|
||||
*/
|
||||
HANDLE hPipeInputRead;
|
||||
HANDLE hPipeOutputWrite;
|
||||
HANDLE hPipeErrorWrite;
|
||||
#else
|
||||
/*
|
||||
* We need to put a dummy member in here to avoid compilation
|
||||
* errors under certain Unix compilers, like SGI's and HPUX's,
|
||||
* which fail to compile a zero-sized struct. Of course
|
||||
* it would be much nicer if there was actually a use for this
|
||||
* structure under Unix. Aah the joys of x-platform code.
|
||||
*/
|
||||
int dummy;
|
||||
#endif
|
||||
};
|
||||
API_EXPORT(int) ap_bspawn_child(pool *, int (*)(void *, child_info *),
|
||||
void *, enum kill_conditions,
|
||||
BUFF ** pipe_in, BUFF ** pipe_out,
|
||||
BUFF ** pipe_err);
|
||||
|
||||
/* enable non-blocking operations */
|
||||
API_EXPORT(int) ap_bnonblock(BUFF * fb, int direction);
|
||||
/* and get an fd to select() on */
|
||||
API_EXPORT(int) ap_bfileno(BUFF * fb, int direction);
|
||||
|
||||
/* bflush() if a read now would block, but don't actually read anything */
|
||||
API_EXPORT(void) ap_bhalfduplex(BUFF * fb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !APACHE_BUFF_H */
|
@ -1,118 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1998 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_HTTP_CONF_GLOBALS_H
|
||||
#define APACHE_HTTP_CONF_GLOBALS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Process config --- what the process ITSELF is doing
|
||||
*/
|
||||
|
||||
extern int ap_standalone;
|
||||
extern uid_t ap_user_id;
|
||||
extern char *ap_user_name;
|
||||
extern gid_t ap_group_id;
|
||||
#ifdef MULTIPLE_GROUPS
|
||||
extern gid_t group_id_list[NGROUPS_MAX];
|
||||
#endif
|
||||
extern int ap_max_requests_per_child;
|
||||
extern int ap_threads_per_child;
|
||||
extern int ap_excess_requests_per_child;
|
||||
extern struct in_addr ap_bind_address;
|
||||
extern listen_rec *ap_listeners;
|
||||
extern int ap_daemons_to_start;
|
||||
extern int ap_daemons_min_free;
|
||||
extern int ap_daemons_max_free;
|
||||
extern int ap_daemons_limit;
|
||||
extern MODULE_VAR_EXPORT int ap_suexec_enabled;
|
||||
extern int ap_listenbacklog;
|
||||
extern int ap_dump_settings;
|
||||
|
||||
extern char *ap_pid_fname;
|
||||
extern char *ap_scoreboard_fname;
|
||||
extern char *ap_lock_fname;
|
||||
extern MODULE_VAR_EXPORT char *ap_server_argv0;
|
||||
|
||||
extern enum server_token_type ap_server_tokens;
|
||||
|
||||
/* Trying to allocate these in the config pool gets us into some *nasty*
|
||||
* chicken-and-egg problems in http_main.c --- where do you stick them
|
||||
* when pconf gets cleared? Better to just allocate a little space
|
||||
* statically...
|
||||
*/
|
||||
|
||||
extern API_VAR_EXPORT char ap_server_root[MAX_STRING_LEN];
|
||||
extern char ap_server_confname[MAX_STRING_LEN];
|
||||
|
||||
/* for -C, -c and -D switches */
|
||||
extern array_header *ap_server_pre_read_config;
|
||||
extern array_header *ap_server_post_read_config;
|
||||
extern array_header *ap_server_config_defines;
|
||||
|
||||
/* We want this to have the least chance of being corrupted if there
|
||||
* is some memory corruption, so we allocate it statically.
|
||||
*/
|
||||
extern char ap_coredump_dir[MAX_STRING_LEN];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !APACHE_HTTP_CONF_GLOBALS_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,127 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_OS_H
|
||||
#define APACHE_OS_H
|
||||
|
||||
#include "ap_config.h"
|
||||
|
||||
#define PLATFORM "Unix"
|
||||
|
||||
/*
|
||||
* This file in included in all Apache source code. It contains definitions
|
||||
* of facilities available on _this_ operating system (HAVE_* macros),
|
||||
* and prototypes of OS specific functions defined in os.c or os-inline.c
|
||||
*/
|
||||
|
||||
#if !defined(INLINE) && defined(USE_GNU_INLINE)
|
||||
/* Compiler supports inline, so include the inlineable functions as
|
||||
* part of the header
|
||||
*/
|
||||
#define INLINE extern ap_inline
|
||||
#include "os-inline.c"
|
||||
|
||||
#else
|
||||
|
||||
/* Compiler does not support inline, so prototype the inlineable functions
|
||||
* as normal
|
||||
*/
|
||||
extern int ap_os_is_path_absolute(const char *f);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Abstraction layer for loading
|
||||
* Apache modules under run-time via
|
||||
* dynamic shared object (DSO) mechanism
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DL_H
|
||||
#include <dl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#else
|
||||
void *dlopen(const char *, int);
|
||||
int dlclose(void *);
|
||||
void *dlsym(void *, const char *);
|
||||
const char *dlerror(void);
|
||||
#endif
|
||||
|
||||
/* probably on an older system that doesn't support RTLD_NOW or RTLD_LAZY.
|
||||
* The below define is a lie since we are really doing RTLD_LAZY since the
|
||||
* system doesn't support RTLD_NOW.
|
||||
*/
|
||||
#ifndef RTLD_NOW
|
||||
#define RTLD_NOW 1
|
||||
#endif
|
||||
|
||||
#ifndef RTLD_GLOBAL
|
||||
#define RTLD_GLOBAL 0
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#define DLSYM_NEEDS_UNDERSCORE
|
||||
#endif
|
||||
|
||||
#define ap_os_dso_handle_t void *
|
||||
void *ap_os_dso_load(const char *);
|
||||
void ap_os_dso_unload(void *);
|
||||
void *ap_os_dso_sym(void *, const char *);
|
||||
const char *ap_os_dso_error(void);
|
||||
|
||||
#endif /* !APACHE_OS_H */
|
@ -1,135 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* util_uri.h: External Interface of util_uri.c
|
||||
*/
|
||||
|
||||
#ifndef UTIL_URI_H
|
||||
#define UTIL_URI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
unsigned short default_port;
|
||||
} schemes_t;
|
||||
|
||||
#define DEFAULT_FTP_DATA_PORT 20
|
||||
#define DEFAULT_FTP_PORT 21
|
||||
#define DEFAULT_GOPHER_PORT 70
|
||||
#define DEFAULT_NNTP_PORT 119
|
||||
#define DEFAULT_WAIS_PORT 210
|
||||
#define DEFAULT_SNEWS_PORT 563
|
||||
#define DEFAULT_PROSPERO_PORT 1525 /* WARNING: conflict w/Oracle */
|
||||
|
||||
/* Flags passed to unparse_uri_components(): */
|
||||
#define UNP_OMITSITEPART (1U<<0) /* suppress "scheme://user@site:port" */
|
||||
#define UNP_OMITUSER (1U<<1) /* Just omit user */
|
||||
#define UNP_OMITPASSWORD (1U<<2) /* Just omit password */
|
||||
#define UNP_OMITUSERINFO (UNP_OMITUSER|UNP_OMITPASSWORD) /* omit "user:password@" part */
|
||||
#define UNP_REVEALPASSWORD (1U<<3) /* Show plain text password (default: show XXXXXXXX) */
|
||||
#define UNP_OMITPATHINFO (1U<<4) /* Show "scheme://user@site:port" only */
|
||||
#define UNP_OMITQUERY (1U<<5) /* Omit the "?queryarg" from the path */
|
||||
|
||||
typedef struct {
|
||||
char *scheme; /* scheme ("http"/"ftp"/...) */
|
||||
char *hostinfo; /* combined [user[:password]@]host[:port] */
|
||||
char *user; /* user name, as in http://user:passwd@host:port/ */
|
||||
char *password; /* password, as in http://user:passwd@host:port/ */
|
||||
char *hostname; /* hostname from URI (or from Host: header) */
|
||||
char *port_str; /* port string (integer representation is in "port") */
|
||||
char *path; /* the request path (or "/" if only scheme://host was given) */
|
||||
char *query; /* Everything after a '?' in the path, if present */
|
||||
char *fragment; /* Trailing "#fragment" string, if present */
|
||||
|
||||
struct hostent *hostent;
|
||||
|
||||
unsigned short port; /* The port number, numeric, valid only if port_str != NULL */
|
||||
|
||||
unsigned is_initialized:1;
|
||||
|
||||
unsigned dns_looked_up:1;
|
||||
unsigned dns_resolved:1;
|
||||
|
||||
} uri_components;
|
||||
|
||||
/* util_uri.c */
|
||||
API_EXPORT(unsigned short) ap_default_port_for_scheme(const char
|
||||
*scheme_str);
|
||||
API_EXPORT(unsigned short) ap_default_port_for_request(const request_rec
|
||||
* r);
|
||||
API_EXPORT(struct hostent *) ap_pduphostent(pool * p,
|
||||
const struct hostent *hp);
|
||||
API_EXPORT(struct hostent *) ap_pgethostbyname(pool * p,
|
||||
const char *hostname);
|
||||
API_EXPORT(char *) ap_unparse_uri_components(pool * p,
|
||||
const uri_components *
|
||||
uptr, unsigned flags);
|
||||
API_EXPORT(int) ap_parse_uri_components(pool * p, const char *uri,
|
||||
uri_components * uptr);
|
||||
API_EXPORT(int) ap_parse_hostinfo_components(pool * p,
|
||||
const char *hostinfo,
|
||||
uri_components * uptr);
|
||||
/* called by the core in main() */
|
||||
extern void ap_util_uri_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*UTIL_URI_H */
|
@ -1,391 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1999 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_ALLOC_H
|
||||
#define APACHE_ALLOC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Resource allocation routines...
|
||||
*
|
||||
* designed so that we don't have to keep track of EVERYTHING so that
|
||||
* it can be explicitly freed later (a fundamentally unsound strategy ---
|
||||
* particularly in the presence of die()).
|
||||
*
|
||||
* Instead, we maintain pools, and allocate items (both memory and I/O
|
||||
* handlers) from the pools --- currently there are two, one for per
|
||||
* transaction info, and one for config info. When a transaction is over,
|
||||
* we can delete everything in the per-transaction pool without fear, and
|
||||
* without thinking too hard about it either.
|
||||
*
|
||||
* rst
|
||||
*/
|
||||
|
||||
/* Arenas for configuration info and transaction info
|
||||
* --- actual layout of the pool structure is private to
|
||||
* alloc.c.
|
||||
*/
|
||||
|
||||
/* Need declaration of DIR on Win32 */
|
||||
#ifdef WIN32
|
||||
#include "os/win32/readdir.h"
|
||||
#endif
|
||||
|
||||
typedef struct pool pool;
|
||||
typedef struct pool ap_pool;
|
||||
|
||||
pool *ap_init_alloc(void); /* Set up everything */
|
||||
API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of permanent_pool */
|
||||
API_EXPORT(void) ap_destroy_pool(pool *);
|
||||
|
||||
/* used to guarantee to the pool debugging code that the sub pool will not be
|
||||
* destroyed before the parent pool
|
||||
*/
|
||||
#ifndef POOL_DEBUG
|
||||
#ifdef ap_pool_join
|
||||
#undef ap_pool_join
|
||||
#endif
|
||||
#define ap_pool_join(a,b)
|
||||
#else
|
||||
API_EXPORT(void) ap_pool_join(pool * p, pool * sub);
|
||||
API_EXPORT(pool *) ap_find_pool(const void *ts);
|
||||
API_EXPORT(int) ap_pool_is_ancestor(pool * a, pool * b);
|
||||
#endif
|
||||
|
||||
/* Clearing out EVERYTHING in an pool... destroys any sub-pools */
|
||||
|
||||
API_EXPORT(void) ap_clear_pool(struct pool *);
|
||||
|
||||
/* Preparing for exec() --- close files, etc., but *don't* flush I/O
|
||||
* buffers, *don't* wait for subprocesses, and *don't* free any memory.
|
||||
*/
|
||||
|
||||
API_EXPORT(void) ap_cleanup_for_exec(void);
|
||||
|
||||
/* routines to allocate memory from an pool... */
|
||||
|
||||
API_EXPORT(void *) ap_palloc(struct pool *, int nbytes);
|
||||
API_EXPORT(void *) ap_pcalloc(struct pool *, int nbytes);
|
||||
API_EXPORT(char *) ap_pstrdup(struct pool *, const char *s);
|
||||
/* make a nul terminated copy of the n characters starting with s */
|
||||
API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, int n);
|
||||
API_EXPORT_NONSTD(char *) ap_pstrcat(struct pool *, ...); /* all '...' must be char* */
|
||||
API_EXPORT_NONSTD(char *) ap_psprintf(struct pool *, const char *fmt,
|
||||
...)
|
||||
__attribute__ ((format(printf, 2, 3)));
|
||||
API_EXPORT(char *) ap_pvsprintf(struct pool *, const char *fmt,
|
||||
va_list);
|
||||
|
||||
/* array and alist management... keeping lists of things.
|
||||
* Common enough to want common support code ...
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
ap_pool *pool;
|
||||
int elt_size;
|
||||
int nelts;
|
||||
int nalloc;
|
||||
char *elts;
|
||||
} array_header;
|
||||
|
||||
API_EXPORT(array_header *) ap_make_array(pool * p, int nelts,
|
||||
int elt_size);
|
||||
API_EXPORT(void *) ap_push_array(array_header *);
|
||||
API_EXPORT(void) ap_array_cat(array_header * dst,
|
||||
const array_header * src);
|
||||
API_EXPORT(array_header *) ap_append_arrays(pool *,
|
||||
const array_header *,
|
||||
const array_header *);
|
||||
|
||||
/* ap_array_pstrcat generates a new string from the pool containing
|
||||
* the concatenated sequence of substrings referenced as elements within
|
||||
* the array. The string will be empty if all substrings are empty or null,
|
||||
* or if there are no elements in the array.
|
||||
* If sep is non-NUL, it will be inserted between elements as a separator.
|
||||
*/
|
||||
API_EXPORT(char *) ap_array_pstrcat(pool * p, const array_header * arr,
|
||||
const char sep);
|
||||
|
||||
/* copy_array copies the *entire* array. copy_array_hdr just copies
|
||||
* the header, and arranges for the elements to be copied if (and only
|
||||
* if) the code subsequently does a push or arraycat.
|
||||
*/
|
||||
|
||||
API_EXPORT(array_header *) ap_copy_array(pool * p,
|
||||
const array_header * src);
|
||||
API_EXPORT(array_header *) ap_copy_array_hdr(pool * p,
|
||||
const array_header * src);
|
||||
|
||||
|
||||
/* Tables. Implemented alist style, for now, though we try to keep
|
||||
* it so that imposing a hash table structure on top in the future
|
||||
* wouldn't be *too* hard...
|
||||
*
|
||||
* Note that key comparisons for these are case-insensitive, largely
|
||||
* because that's what's appropriate and convenient everywhere they're
|
||||
* currently being used...
|
||||
*/
|
||||
|
||||
typedef struct table table;
|
||||
|
||||
typedef struct {
|
||||
char *key; /* maybe NULL in future;
|
||||
* check when iterating thru table_elts
|
||||
*/
|
||||
char *val;
|
||||
} table_entry;
|
||||
|
||||
API_EXPORT(table *) ap_make_table(pool * p, int nelts);
|
||||
API_EXPORT(table *) ap_copy_table(pool * p, const table *);
|
||||
API_EXPORT(void) ap_clear_table(table *);
|
||||
API_EXPORT(const char *) ap_table_get(const table *, const char *);
|
||||
API_EXPORT(void) ap_table_set(table *, const char *name,
|
||||
const char *val);
|
||||
API_EXPORT(void) ap_table_setn(table *, const char *name,
|
||||
const char *val);
|
||||
API_EXPORT(void) ap_table_merge(table *, const char *name,
|
||||
const char *more_val);
|
||||
API_EXPORT(void) ap_table_mergen(table *, const char *name,
|
||||
const char *more_val);
|
||||
API_EXPORT(void) ap_table_unset(table *, const char *key);
|
||||
API_EXPORT(void) ap_table_add(table *, const char *name,
|
||||
const char *val);
|
||||
API_EXPORT(void) ap_table_addn(table *, const char *name,
|
||||
const char *val);
|
||||
API_EXPORT(void)
|
||||
ap_table_do(int (*comp) (void *, const char *, const char *), void *rec,
|
||||
const table * t, ...);
|
||||
|
||||
API_EXPORT(table *) ap_overlay_tables(pool * p, const table * overlay,
|
||||
const table * base);
|
||||
|
||||
/* Conceptually, ap_overlap_tables does this:
|
||||
|
||||
array_header *barr = ap_table_elts(b);
|
||||
table_entry *belt = (table_entry *)barr->elts;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < barr->nelts; ++i) {
|
||||
if (flags & AP_OVERLAP_TABLES_MERGE) {
|
||||
ap_table_mergen(a, belt[i].key, belt[i].val);
|
||||
}
|
||||
else {
|
||||
ap_table_setn(a, belt[i].key, belt[i].val);
|
||||
}
|
||||
}
|
||||
|
||||
Except that it is more efficient (less space and cpu-time) especially
|
||||
when b has many elements.
|
||||
|
||||
Notice the assumptions on the keys and values in b -- they must be
|
||||
in an ancestor of a's pool. In practice b and a are usually from
|
||||
the same pool.
|
||||
*/
|
||||
#define AP_OVERLAP_TABLES_SET (0)
|
||||
#define AP_OVERLAP_TABLES_MERGE (1)
|
||||
API_EXPORT(void) ap_overlap_tables(table * a, const table * b,
|
||||
unsigned flags);
|
||||
|
||||
/* XXX: these know about the definition of struct table in alloc.c. That
|
||||
* definition is not here because it is supposed to be private, and by not
|
||||
* placing it here we are able to get compile-time diagnostics from modules
|
||||
* written which assume that a table is the same as an array_header. -djg
|
||||
*/
|
||||
#define ap_table_elts(t) ((array_header *)(t))
|
||||
#define ap_is_empty_table(t) (((t) == NULL)||(((array_header *)(t))->nelts == 0))
|
||||
|
||||
/* routines to remember allocation of other sorts of things...
|
||||
* generic interface first. Note that we want to have two separate
|
||||
* cleanup functions in the general case, one for exec() preparation,
|
||||
* to keep CGI scripts and the like from inheriting access to things
|
||||
* they shouldn't be able to touch, and one for actually cleaning up,
|
||||
* when the actual server process wants to get rid of the thing,
|
||||
* whatever it is.
|
||||
*
|
||||
* kill_cleanup disarms a cleanup, presumably because the resource in
|
||||
* question has been closed, freed, or whatever, and it's scarce
|
||||
* enough to want to reclaim (e.g., descriptors). It arranges for the
|
||||
* resource not to be cleaned up a second time (it might have been
|
||||
* reallocated). run_cleanup does the same, but runs it first.
|
||||
*
|
||||
* Cleanups are identified for purposes of finding & running them off by the
|
||||
* plain_cleanup and data, which should presumably be unique.
|
||||
*
|
||||
* NB any code which invokes register_cleanup or kill_cleanup directly
|
||||
* is a critical section which should be guarded by block_alarms() and
|
||||
* unblock_alarms() below...
|
||||
*/
|
||||
|
||||
API_EXPORT(void) ap_register_cleanup(pool * p, void *data,
|
||||
void (*plain_cleanup) (void *),
|
||||
void (*child_cleanup) (void *));
|
||||
|
||||
API_EXPORT(void) ap_kill_cleanup(pool * p, void *data,
|
||||
void (*plain_cleanup) (void *));
|
||||
API_EXPORT(void) ap_run_cleanup(pool * p, void *data,
|
||||
void (*cleanup) (void *));
|
||||
|
||||
/* A "do-nothing" cleanup, for register_cleanup; it's faster to do
|
||||
* things this way than to test for NULL. */
|
||||
API_EXPORT_NONSTD(void) ap_null_cleanup(void *data);
|
||||
|
||||
/* The time between when a resource is actually allocated, and when it
|
||||
* its cleanup is registered is a critical section, during which the
|
||||
* resource could leak if we got interrupted or timed out. So, anything
|
||||
* which registers cleanups should bracket resource allocation and the
|
||||
* cleanup registry with these. (This is done internally by run_cleanup).
|
||||
*
|
||||
* NB they are actually implemented in http_main.c, since they are bound
|
||||
* up with timeout handling in general...
|
||||
*/
|
||||
|
||||
#ifdef TPF
|
||||
#define ap_block_alarms() (0)
|
||||
#define ap_unblock_alarms() (0)
|
||||
#else
|
||||
API_EXPORT(void) ap_block_alarms(void);
|
||||
API_EXPORT(void) ap_unblock_alarms(void);
|
||||
#endif /* TPF */
|
||||
|
||||
/* Common cases which want utility support..
|
||||
* the note_cleanups_for_foo routines are for
|
||||
*/
|
||||
|
||||
API_EXPORT(FILE *) ap_pfopen(struct pool *, const char *name,
|
||||
const char *fmode);
|
||||
API_EXPORT(FILE *) ap_pfdopen(struct pool *, int fd, const char *fmode);
|
||||
API_EXPORT(int) ap_popenf(struct pool *, const char *name, int flg,
|
||||
int mode);
|
||||
|
||||
API_EXPORT(void) ap_note_cleanups_for_file(pool *, FILE *);
|
||||
API_EXPORT(void) ap_note_cleanups_for_fd(pool *, int);
|
||||
#ifdef WIN32
|
||||
API_EXPORT(void) ap_note_cleanups_for_h(pool *, HANDLE);
|
||||
#endif
|
||||
API_EXPORT(void) ap_kill_cleanups_for_fd(pool * p, int fd);
|
||||
|
||||
API_EXPORT(void) ap_note_cleanups_for_socket(pool *, int);
|
||||
API_EXPORT(void) ap_kill_cleanups_for_socket(pool * p, int sock);
|
||||
API_EXPORT(int) ap_psocket(pool * p, int, int, int);
|
||||
API_EXPORT(int) ap_pclosesocket(pool * a, int sock);
|
||||
|
||||
API_EXPORT(regex_t *) ap_pregcomp(pool * p, const char *pattern,
|
||||
int cflags);
|
||||
API_EXPORT(void) ap_pregfree(pool * p, regex_t * reg);
|
||||
|
||||
/* routines to note closes... file descriptors are constrained enough
|
||||
* on some systems that we want to support this.
|
||||
*/
|
||||
|
||||
API_EXPORT(int) ap_pfclose(struct pool *, FILE *);
|
||||
API_EXPORT(int) ap_pclosef(struct pool *, int fd);
|
||||
#ifdef WIN32
|
||||
API_EXPORT(int) ap_pcloseh(struct pool *, HANDLE hDevice);
|
||||
#endif
|
||||
|
||||
/* routines to deal with directories */
|
||||
API_EXPORT(DIR *) ap_popendir(pool * p, const char *name);
|
||||
API_EXPORT(void) ap_pclosedir(pool * p, DIR * d);
|
||||
|
||||
/* ... even child processes (which we may want to wait for,
|
||||
* or to kill outright, on unexpected termination).
|
||||
*
|
||||
* ap_spawn_child is a utility routine which handles an awful lot of
|
||||
* the rigamarole associated with spawning a child --- it arranges
|
||||
* for pipes to the child's stdin and stdout, if desired (if not,
|
||||
* set the associated args to NULL). It takes as args a function
|
||||
* to call in the child, and an argument to be passed to the function.
|
||||
*/
|
||||
|
||||
enum kill_conditions {
|
||||
kill_never, /* process is never sent any signals */
|
||||
kill_always, /* process is sent SIGKILL on pool cleanup */
|
||||
kill_after_timeout, /* SIGTERM, wait 3 seconds, SIGKILL */
|
||||
just_wait, /* wait forever for the process to complete */
|
||||
kill_only_once /* send SIGTERM and then wait */
|
||||
};
|
||||
|
||||
typedef struct child_info child_info;
|
||||
API_EXPORT(void) ap_note_subprocess(pool * a, pid_t pid,
|
||||
enum kill_conditions how);
|
||||
API_EXPORT(int) ap_spawn_child(pool *, int (*)(void *, child_info *),
|
||||
void *, enum kill_conditions,
|
||||
FILE ** pipe_in, FILE ** pipe_out,
|
||||
FILE ** pipe_err);
|
||||
|
||||
/* magic numbers --- min free bytes to consider a free pool block useable,
|
||||
* and the min amount to allocate if we have to go to malloc() */
|
||||
|
||||
#ifndef BLOCK_MINFREE
|
||||
#define BLOCK_MINFREE 4096
|
||||
#endif
|
||||
#ifndef BLOCK_MINALLOC
|
||||
#define BLOCK_MINALLOC 8192
|
||||
#endif
|
||||
|
||||
/* Finally, some accounting */
|
||||
|
||||
API_EXPORT(long) ap_bytes_in_pool(pool * p);
|
||||
API_EXPORT(long) ap_bytes_in_free_blocks(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !APACHE_ALLOC_H */
|
@ -1,167 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-1999 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
* The ap_vsnprintf/ap_snprintf functions are based on, and used with the
|
||||
* permission of, the SIO stdio-replacement strx_* functions by Panos
|
||||
* Tsirigotis <panos@alumni.cs.colorado.edu> for xinetd.
|
||||
*/
|
||||
|
||||
#ifndef APACHE_AP_H
|
||||
#define APACHE_AP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
API_EXPORT(char *) ap_cpystrn(char *, const char *, size_t);
|
||||
int ap_slack(int, int);
|
||||
int ap_execle(const char *, const char *, ...);
|
||||
int ap_execve(const char *, const char *argv[], const char *envp[]);
|
||||
|
||||
/* small utility macros to make things easier to read */
|
||||
|
||||
#ifdef WIN32
|
||||
#define ap_killpg(x, y)
|
||||
#else
|
||||
#ifdef NO_KILLPG
|
||||
#define ap_killpg(x, y) (kill (-(x), (y)))
|
||||
#else
|
||||
#define ap_killpg(x, y) (killpg ((x), (y)))
|
||||
#endif
|
||||
#endif /* WIN32 */
|
||||
|
||||
/* ap_vformatter() is a generic printf-style formatting routine
|
||||
* with some extensions. The extensions are:
|
||||
*
|
||||
* %pA takes a struct in_addr *, and prints it as a.b.c.d
|
||||
* %pI takes a struct sockaddr_in * and prints it as a.b.c.d:port
|
||||
* %pp takes a void * and outputs it in hex
|
||||
*
|
||||
* The %p hacks are to force gcc's printf warning code to skip
|
||||
* over a pointer argument without complaining. This does
|
||||
* mean that the ANSI-style %p (output a void * in hex format) won't
|
||||
* work as expected at all, but that seems to be a fair trade-off
|
||||
* for the increased robustness of having printf-warnings work.
|
||||
*
|
||||
* Additionally, ap_vformatter allows for arbitrary output methods
|
||||
* using the ap_vformatter_buff and flush_func.
|
||||
*
|
||||
* The ap_vformatter_buff has two elements curpos and endpos.
|
||||
* curpos is where ap_vformatter will write the next byte of output.
|
||||
* It proceeds writing output to curpos, and updating curpos, until
|
||||
* either the end of output is reached, or curpos == endpos (i.e. the
|
||||
* buffer is full).
|
||||
*
|
||||
* If the end of output is reached, ap_vformatter returns the
|
||||
* number of bytes written.
|
||||
*
|
||||
* When the buffer is full, the flush_func is called. The flush_func
|
||||
* can return -1 to indicate that no further output should be attempted,
|
||||
* and ap_vformatter will return immediately with -1. Otherwise
|
||||
* the flush_func should flush the buffer in whatever manner is
|
||||
* appropriate, re-initialize curpos and endpos, and return 0.
|
||||
*
|
||||
* Note that flush_func is only invoked as a result of attempting to
|
||||
* write another byte at curpos when curpos >= endpos. So for
|
||||
* example, it's possible when the output exactly matches the buffer
|
||||
* space available that curpos == endpos will be true when
|
||||
* ap_vformatter returns.
|
||||
*
|
||||
* ap_vformatter does not call out to any other code, it is entirely
|
||||
* self-contained. This allows the callers to do things which are
|
||||
* otherwise "unsafe". For example, ap_psprintf uses the "scratch"
|
||||
* space at the unallocated end of a block, and doesn't actually
|
||||
* complete the allocation until ap_vformatter returns. ap_psprintf
|
||||
* would be completely broken if ap_vformatter were to call anything
|
||||
* that used a pool. Similarly http_bprintf() uses the "scratch"
|
||||
* space at the end of its output buffer, and doesn't actually note
|
||||
* that the space is in use until it either has to flush the buffer
|
||||
* or until ap_vformatter returns.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
char *curpos;
|
||||
char *endpos;
|
||||
} ap_vformatter_buff;
|
||||
|
||||
API_EXPORT(int) ap_vformatter(int (*flush_func) (ap_vformatter_buff *),
|
||||
ap_vformatter_buff *, const char *fmt,
|
||||
va_list ap);
|
||||
|
||||
/* These are snprintf implementations based on ap_vformatter().
|
||||
*
|
||||
* Note that various standards and implementations disagree on the return
|
||||
* value of snprintf, and side-effects due to %n in the formatting string.
|
||||
* ap_snprintf behaves as follows:
|
||||
*
|
||||
* Process the format string until the entire string is exhausted, or
|
||||
* the buffer fills. If the buffer fills then stop processing immediately
|
||||
* (so no further %n arguments are processed), and return the buffer
|
||||
* length. In all cases the buffer is NUL terminated.
|
||||
*
|
||||
* In no event does ap_snprintf return a negative number. It's not possible
|
||||
* to distinguish between an output which was truncated, and an output which
|
||||
* exactly filled the buffer.
|
||||
*/
|
||||
API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,
|
||||
...)
|
||||
__attribute__ ((format(printf, 3, 4)));
|
||||
API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format,
|
||||
va_list ap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !APACHE_AP_H */
|
@ -1,423 +0,0 @@
|
||||
/*
|
||||
** ap_compat.h -- Apache Backward Compatibility
|
||||
**
|
||||
** INCLUDE THIS HEADER FILE ONLY IF YOU REALLY NEED
|
||||
** BACKWARD COMPATIBILITY TO OLD APACHE RESOURCES.
|
||||
*/
|
||||
|
||||
#ifndef AP_COMPAT_H
|
||||
#define AP_COMPAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mapping of Apache 1.2 global symbols to the
|
||||
* namespace conflict free variants used in Apache 1.3
|
||||
*/
|
||||
|
||||
#define MD5Final ap_MD5Final
|
||||
#define MD5Init ap_MD5Init
|
||||
#define MD5Update ap_MD5Update
|
||||
#define acquire_mutex ap_acquire_mutex
|
||||
#define add_cgi_vars ap_add_cgi_vars
|
||||
#define add_common_vars ap_add_common_vars
|
||||
#define add_module ap_add_module
|
||||
#define add_named_module ap_add_named_module
|
||||
#define add_per_dir_conf ap_add_per_dir_conf
|
||||
#define add_per_url_conf ap_add_per_url_conf
|
||||
#define allow_options ap_allow_options
|
||||
#define allow_overrides ap_allow_overrides
|
||||
#define apapi_get_server_built ap_get_server_built
|
||||
#define apapi_get_server_version ap_get_server_version
|
||||
#define aplog_error ap_log_error
|
||||
#define append_arrays ap_append_arrays
|
||||
#define array_cat ap_array_cat
|
||||
#define auth_name ap_auth_name
|
||||
#define auth_type ap_auth_type
|
||||
#define basic_http_header ap_basic_http_header
|
||||
#define bclose ap_bclose
|
||||
#define bcreate ap_bcreate
|
||||
#define bfilbuf ap_bfilbuf
|
||||
#define bfileno ap_bfileno
|
||||
#define bflsbuf ap_bflsbuf
|
||||
#define bflush ap_bflush
|
||||
#define bgetc ap_bgetc
|
||||
#define bgetflag ap_bgetflag
|
||||
#define bgetopt ap_bgetopt
|
||||
#define bgets ap_bgets
|
||||
#define bhalfduplex ap_bhalfduplex
|
||||
#define bind_address ap_bind_address
|
||||
#define block_alarms ap_block_alarms
|
||||
#define blookc ap_blookc
|
||||
#define bnonblock ap_bnonblock
|
||||
#define bonerror ap_bonerror
|
||||
#define bprintf ap_bprintf
|
||||
#define bpushfd ap_bpushfd
|
||||
#define bputc ap_bputc
|
||||
#define bputs ap_bputs
|
||||
#define bread ap_bread
|
||||
#define bsetflag ap_bsetflag
|
||||
#define bsetopt ap_bsetopt
|
||||
#define bskiplf ap_bskiplf
|
||||
#define bvputs ap_bvputs
|
||||
#define bwrite ap_bwrite
|
||||
#define bytes_in_free_blocks ap_bytes_in_free_blocks
|
||||
#define bytes_in_pool ap_bytes_in_pool
|
||||
#define call_exec ap_call_exec
|
||||
#define can_exec ap_can_exec
|
||||
#define cfg_closefile ap_cfg_closefile
|
||||
#define cfg_getc ap_cfg_getc
|
||||
#define cfg_getline ap_cfg_getline
|
||||
#define chdir_file ap_chdir_file
|
||||
#define check_access ap_check_access
|
||||
#define check_alarm ap_check_alarm
|
||||
#define check_auth ap_check_auth
|
||||
#define check_cmd_context ap_check_cmd_context
|
||||
#define check_user_id ap_check_user_id
|
||||
#define checkmask ap_checkmask
|
||||
#define child_exit_modules ap_child_exit_modules
|
||||
#define child_init_modules ap_child_init_modules
|
||||
#define child_terminate ap_child_terminate
|
||||
#define cleanup_for_exec ap_cleanup_for_exec
|
||||
#define clear_module_list ap_clear_module_list
|
||||
#define clear_pool ap_clear_pool
|
||||
#define clear_table ap_clear_table
|
||||
#define close_piped_log ap_close_piped_log
|
||||
#define construct_server ap_construct_server
|
||||
#define construct_url ap_construct_url
|
||||
#define copy_array ap_copy_array
|
||||
#define copy_array_hdr ap_copy_array_hdr
|
||||
#define copy_table ap_copy_table
|
||||
#define core_reorder_directories ap_core_reorder_directories
|
||||
#define coredump_dir ap_coredump_dir
|
||||
#define count_dirs ap_count_dirs
|
||||
#define create_environment ap_create_environment
|
||||
#define create_mutex ap_create_mutex
|
||||
#define create_per_dir_config ap_create_per_dir_config
|
||||
#define create_request_config ap_create_request_config
|
||||
#define daemons_limit ap_daemons_limit
|
||||
#define daemons_max_free ap_daemons_max_free
|
||||
#define daemons_min_free ap_daemons_min_free
|
||||
#define daemons_to_start ap_daemons_to_start
|
||||
#define day_snames ap_day_snames
|
||||
#define default_port ap_default_port
|
||||
#define default_port_for_request ap_default_port_for_request
|
||||
#define default_port_for_scheme ap_default_port_for_scheme
|
||||
#define default_type ap_default_type
|
||||
#define destroy_mutex ap_destroy_mutex
|
||||
#define destroy_pool ap_destroy_pool
|
||||
#define destroy_sub_req ap_destroy_sub_req
|
||||
#define die ap_die
|
||||
#define discard_request_body ap_discard_request_body
|
||||
#define document_root ap_document_root
|
||||
#define dummy_mutex ap_dummy_mutex
|
||||
#define each_byterange ap_each_byterange
|
||||
#define error_log2stderr ap_error_log2stderr
|
||||
#define escape_html ap_escape_html
|
||||
#define escape_path_segment ap_escape_path_segment
|
||||
#define escape_shell_cmd ap_escape_shell_cmd
|
||||
#define escape_uri ap_escape_uri
|
||||
#define excess_requests_per_child ap_excess_requests_per_child
|
||||
#define exists_scoreboard_image ap_exists_scoreboard_image
|
||||
#define finalize_request_protocol ap_finalize_request_protocol
|
||||
#define finalize_sub_req_protocol ap_finalize_sub_req_protocol
|
||||
#define find_command ap_find_command
|
||||
#define find_command_in_modules ap_find_command_in_modules
|
||||
#define find_last_token ap_find_last_token
|
||||
#define find_linked_module ap_find_linked_module
|
||||
#define find_module_name ap_find_module_name
|
||||
#define find_path_info ap_find_path_info
|
||||
#define find_pool ap_find_pool
|
||||
#define find_token ap_find_token
|
||||
#define find_types ap_find_types
|
||||
#define fini_vhost_config ap_fini_vhost_config
|
||||
#define fnmatch ap_fnmatch
|
||||
#define force_library_loading ap_force_library_loading
|
||||
#define get_basic_auth_pw ap_get_basic_auth_pw
|
||||
#define get_client_block ap_get_client_block
|
||||
#define get_gmtoff ap_get_gmtoff
|
||||
#define get_local_host ap_get_local_host
|
||||
#define get_module_config ap_get_module_config
|
||||
#define get_remote_host ap_get_remote_host
|
||||
#define get_remote_logname ap_get_remote_logname
|
||||
#define get_server_name ap_get_server_name
|
||||
#define get_server_port ap_get_server_port
|
||||
#define get_time ap_get_time
|
||||
#define get_token ap_get_token
|
||||
#define get_virthost_addr ap_get_virthost_addr
|
||||
#define getparents ap_getparents
|
||||
#define getword ap_getword
|
||||
#define getword_conf ap_getword_conf
|
||||
#define getword_conf_nc ap_getword_conf_nc
|
||||
#define getword_nc ap_getword_nc
|
||||
#define getword_nulls ap_getword_nulls
|
||||
#define getword_nulls_nc ap_getword_nulls_nc
|
||||
#define getword_white ap_getword_white
|
||||
#define getword_white_nc ap_getword_white_nc
|
||||
#define gm_timestr_822 ap_gm_timestr_822
|
||||
#define gname2id ap_gname2id
|
||||
#define group_id ap_group_id
|
||||
#define handle_command ap_handle_command
|
||||
#define hard_timeout ap_hard_timeout
|
||||
#define header_parse ap_header_parse
|
||||
#define ht_time ap_ht_time
|
||||
#define http_method ap_http_method
|
||||
#define ind ap_ind
|
||||
#define index_of_response ap_index_of_response
|
||||
#define init_alloc ap_init_alloc
|
||||
#define init_modules ap_init_modules
|
||||
#define init_vhost_config ap_init_vhost_config
|
||||
#define init_virtual_host ap_init_virtual_host
|
||||
#define internal_redirect ap_internal_redirect
|
||||
#define internal_redirect_handler ap_internal_redirect_handler
|
||||
#define invoke_handler ap_invoke_handler
|
||||
#define is_default_port ap_is_default_port
|
||||
#define is_directory ap_is_directory
|
||||
#define is_empty_table ap_is_empty_table
|
||||
#define is_fnmatch ap_is_fnmatch
|
||||
#define is_initial_req ap_is_initial_req
|
||||
#define is_matchexp ap_is_matchexp
|
||||
#define is_table_empty ap_is_table_empty
|
||||
#define is_url ap_is_url
|
||||
#define keepalive_timeout ap_keepalive_timeout
|
||||
#define kill_cleanup ap_kill_cleanup
|
||||
#define kill_cleanups_for_fd ap_kill_cleanups_for_fd
|
||||
#define kill_cleanups_for_socket ap_kill_cleanups_for_socket
|
||||
#define kill_timeout ap_kill_timeout
|
||||
#define limit_section ap_limit_section
|
||||
#define listenbacklog ap_listenbacklog
|
||||
#define listeners ap_listeners
|
||||
#define lock_fname ap_lock_fname
|
||||
#define log_assert ap_log_assert
|
||||
#define log_error ap_log_error_old
|
||||
#define log_pid ap_log_pid
|
||||
#define log_printf ap_log_printf
|
||||
#define log_reason ap_log_reason
|
||||
#define log_transaction ap_log_transaction
|
||||
#define log_unixerr ap_log_unixerr
|
||||
#define make_array ap_make_array
|
||||
#define make_dirstr ap_make_dirstr
|
||||
#define make_dirstr_parent ap_make_dirstr_parent
|
||||
#define make_dirstr_prefix ap_make_dirstr_prefix
|
||||
#define make_full_path ap_make_full_path
|
||||
#define make_sub_pool ap_make_sub_pool
|
||||
#define make_table ap_make_table
|
||||
#define matches_request_vhost ap_matches_request_vhost
|
||||
#define max_requests_per_child ap_max_requests_per_child
|
||||
#define md5 ap_md5
|
||||
#define meets_conditions ap_meets_conditions
|
||||
#define merge_per_dir_configs ap_merge_per_dir_configs
|
||||
#define month_snames ap_month_snames
|
||||
#define no2slash ap_no2slash
|
||||
#define note_auth_failure ap_note_auth_failure
|
||||
#define note_basic_auth_failure ap_note_basic_auth_failure
|
||||
#define note_cleanups_for_fd ap_note_cleanups_for_fd
|
||||
#define note_cleanups_for_file ap_note_cleanups_for_file
|
||||
#define note_cleanups_for_socket ap_note_cleanups_for_socket
|
||||
#define note_digest_auth_failure ap_note_digest_auth_failure
|
||||
#define note_subprocess ap_note_subprocess
|
||||
#define null_cleanup ap_null_cleanup
|
||||
#define open_logs ap_open_logs
|
||||
#define open_mutex ap_open_mutex
|
||||
#define open_piped_log ap_open_piped_log
|
||||
#define os_canonical_filename ap_os_canonical_filename
|
||||
#define os_dl_load ap_os_dso_load
|
||||
#define os_dl_unload ap_os_dso_unload
|
||||
#define os_dl_sym ap_os_dso_sym
|
||||
#define os_dl_error ap_os_dso_error
|
||||
#define os_escape_path ap_os_escape_path
|
||||
#define os_is_path_absolute ap_os_is_path_absolute
|
||||
#define overlay_tables ap_overlay_tables
|
||||
#define palloc ap_palloc
|
||||
#define parseHTTPdate ap_parseHTTPdate
|
||||
#define parse_hostinfo_components ap_parse_hostinfo_components
|
||||
#define parse_htaccess ap_parse_htaccess
|
||||
#define parse_uri ap_parse_uri
|
||||
#define parse_uri_components ap_parse_uri_components
|
||||
#define parse_vhost_addrs ap_parse_vhost_addrs
|
||||
#define pcalloc ap_pcalloc
|
||||
#define pcfg_open_custom ap_pcfg_open_custom
|
||||
#define pcfg_openfile ap_pcfg_openfile
|
||||
#define pclosedir ap_pclosedir
|
||||
#define pclosef ap_pclosef
|
||||
#define pclosesocket ap_pclosesocket
|
||||
#define pduphostent ap_pduphostent
|
||||
#define pfclose ap_pfclose
|
||||
#define pfdopen ap_pfdopen
|
||||
#define pfopen ap_pfopen
|
||||
#define pgethostbyname ap_pgethostbyname
|
||||
#define pid_fname ap_pid_fname
|
||||
#define piped_log_read_fd ap_piped_log_read_fd
|
||||
#define piped_log_write_fd ap_piped_log_write_fd
|
||||
#define pool_is_ancestor ap_pool_is_ancestor
|
||||
#define pool_join ap_pool_join
|
||||
#define popendir ap_popendir
|
||||
#define popenf ap_popenf
|
||||
#define pregcomp ap_pregcomp
|
||||
#define pregfree ap_pregfree
|
||||
#define pregsub ap_pregsub
|
||||
#define process_request ap_process_request
|
||||
#define process_resource_config ap_process_resource_config
|
||||
#define proxy_add_header ap_proxy_add_header
|
||||
#define proxy_c2hex ap_proxy_c2hex
|
||||
#define proxy_cache_check ap_proxy_cache_check
|
||||
#define proxy_cache_error ap_proxy_cache_error
|
||||
#define proxy_cache_tidy ap_proxy_cache_tidy
|
||||
#define proxy_cache_update ap_proxy_cache_update
|
||||
#define proxy_canon_netloc ap_proxy_canon_netloc
|
||||
#define proxy_canonenc ap_proxy_canonenc
|
||||
#define proxy_connect_handler ap_proxy_connect_handler
|
||||
#define proxy_date_canon ap_proxy_date_canon
|
||||
#define proxy_del_header ap_proxy_del_header
|
||||
#define proxy_doconnect ap_proxy_doconnect
|
||||
#define proxy_ftp_canon ap_proxy_ftp_canon
|
||||
#define proxy_ftp_handler ap_proxy_ftp_handler
|
||||
#define proxy_garbage_coll ap_proxy_garbage_coll
|
||||
#define proxy_garbage_init ap_proxy_garbage_init
|
||||
#define proxy_get_header ap_proxy_get_header
|
||||
#define proxy_hash ap_proxy_hash
|
||||
#define proxy_hex2c ap_proxy_hex2c
|
||||
#define proxy_hex2sec ap_proxy_hex2sec
|
||||
#define proxy_host2addr ap_proxy_host2addr
|
||||
#define proxy_http_canon ap_proxy_http_canon
|
||||
#define proxy_http_handler ap_proxy_http_handler
|
||||
#define proxy_is_domainname ap_proxy_is_domainname
|
||||
#define proxy_is_hostname ap_proxy_is_hostname
|
||||
#define proxy_is_ipaddr ap_proxy_is_ipaddr
|
||||
#define proxy_is_word ap_proxy_is_word
|
||||
#define proxy_liststr ap_proxy_liststr
|
||||
#define proxy_read_headers ap_proxy_read_headers
|
||||
#define proxy_sec2hex ap_proxy_sec2hex
|
||||
#define proxy_send_fb ap_proxy_send_fb
|
||||
#define proxy_send_headers ap_proxy_send_headers
|
||||
#define proxyerror ap_proxyerror
|
||||
#define psignature ap_psignature
|
||||
#define psocket ap_psocket
|
||||
#define psprintf ap_psprintf
|
||||
#define pstrcat ap_pstrcat
|
||||
#define pstrdup ap_pstrdup
|
||||
#define pstrndup ap_pstrndup
|
||||
#define push_array ap_push_array
|
||||
#define pvsprintf ap_pvsprintf
|
||||
#define rationalize_mtime ap_rationalize_mtime
|
||||
#define read_config ap_read_config
|
||||
#define read_request ap_read_request
|
||||
#define register_cleanup ap_register_cleanup
|
||||
#define register_other_child ap_register_other_child
|
||||
#define release_mutex ap_release_mutex
|
||||
#define remove_module ap_remove_module
|
||||
#define requires ap_requires
|
||||
#define reset_timeout ap_reset_timeout
|
||||
#define response_code_string ap_response_code_string
|
||||
#define restart_time ap_restart_time
|
||||
#define rfc1413 ap_rfc1413
|
||||
#define rfc1413_timeout ap_rfc1413_timeout
|
||||
#define rflush ap_rflush
|
||||
#define rind ap_rind
|
||||
#define rprintf ap_rprintf
|
||||
#define rputc ap_rputc
|
||||
#define rputs ap_rputs
|
||||
#define run_cleanup ap_run_cleanup
|
||||
#define run_fixups ap_run_fixups
|
||||
#define run_post_read_request ap_run_post_read_request
|
||||
#define run_sub_req ap_run_sub_req
|
||||
#define rvputs ap_rvputs
|
||||
#define rwrite ap_rwrite
|
||||
#define satisfies ap_satisfies
|
||||
#define scan_script_header(a1,a2) ap_scan_script_header_err(a1,a2,NULL)
|
||||
#define scan_script_header_err ap_scan_script_header_err
|
||||
#define scan_script_header_err_buff ap_scan_script_header_err_buff
|
||||
#define scoreboard_fname ap_scoreboard_fname
|
||||
#define scoreboard_image ap_scoreboard_image
|
||||
#define send_error_response ap_send_error_response
|
||||
#define send_fb ap_send_fb
|
||||
#define send_fb_length ap_send_fb_length
|
||||
#define send_fd ap_send_fd
|
||||
#define send_fd_length ap_send_fd_length
|
||||
#define send_header_field ap_send_header_field
|
||||
#define send_http_header ap_send_http_header
|
||||
#define send_http_options ap_send_http_options
|
||||
#define send_http_trace ap_send_http_trace
|
||||
#define send_mmap ap_send_mmap
|
||||
#define send_size ap_send_size
|
||||
#define server_argv0 ap_server_argv0
|
||||
#define server_confname ap_server_confname
|
||||
#define server_post_read_config ap_server_post_read_config
|
||||
#define server_pre_read_config ap_server_pre_read_config
|
||||
#define server_root ap_server_root
|
||||
#define server_root_relative ap_server_root_relative
|
||||
#define set_byterange ap_set_byterange
|
||||
#define set_callback_and_alarm ap_set_callback_and_alarm
|
||||
#define set_content_length ap_set_content_length
|
||||
#define set_etag ap_set_etag
|
||||
#define set_file_slot ap_set_file_slot
|
||||
#define set_flag_slot ap_set_flag_slot
|
||||
#define set_keepalive ap_set_keepalive
|
||||
#define set_last_modified ap_set_last_modified
|
||||
#define set_module_config ap_set_module_config
|
||||
#define set_name_virtual_host ap_set_name_virtual_host
|
||||
#define set_string_slot ap_set_string_slot
|
||||
#define set_string_slot_lower ap_set_string_slot_lower
|
||||
#define set_sub_req_protocol ap_set_sub_req_protocol
|
||||
#define setup_client_block ap_setup_client_block
|
||||
#define setup_prelinked_modules ap_setup_prelinked_modules
|
||||
#define should_client_block ap_should_client_block
|
||||
#define show_directives ap_show_directives
|
||||
#define show_modules ap_show_modules
|
||||
#define soft_timeout ap_soft_timeout
|
||||
#define some_auth_required ap_some_auth_required
|
||||
#define spawn_child_err ap_spawn_child
|
||||
#define spawn_child_err_buff ap_bspawn_child
|
||||
#define srm_command_loop ap_srm_command_loop
|
||||
#define standalone ap_standalone
|
||||
#define start_restart ap_start_restart
|
||||
#define start_shutdown ap_start_shutdown
|
||||
#define status_drops_connection ap_status_drops_connection
|
||||
#define str_tolower ap_str_tolower
|
||||
#define strcasecmp_match ap_strcasecmp_match
|
||||
#define strcmp_match ap_strcmp_match
|
||||
#define sub_req_lookup_file ap_sub_req_lookup_file
|
||||
#define sub_req_lookup_uri ap_sub_req_lookup_uri
|
||||
#define suexec_enabled ap_suexec_enabled
|
||||
#define sync_scoreboard_image ap_sync_scoreboard_image
|
||||
#define table_add ap_table_add
|
||||
#define table_addn ap_table_addn
|
||||
#define table_do ap_table_do
|
||||
#define table_elts ap_table_elts
|
||||
#define table_get ap_table_get
|
||||
#define table_merge ap_table_merge
|
||||
#define table_mergen ap_table_mergen
|
||||
#define table_set ap_table_set
|
||||
#define table_setn ap_table_setn
|
||||
#define table_unset ap_table_unset
|
||||
#define threads_per_child ap_threads_per_child
|
||||
#define time_process_request ap_time_process_request
|
||||
#define tm2sec ap_tm2sec
|
||||
#define translate_name ap_translate_name
|
||||
#define uname2id ap_uname2id
|
||||
#define unblock_alarms ap_unblock_alarms
|
||||
#define unescape_url ap_unescape_url
|
||||
#define unparse_uri_components ap_unparse_uri_components
|
||||
#define unregister_other_child ap_unregister_other_child
|
||||
#define update_child_status ap_update_child_status
|
||||
#define update_mtime ap_update_mtime
|
||||
#define update_vhost_from_headers ap_update_vhost_from_headers
|
||||
#define update_vhost_given_ip ap_update_vhost_given_ip
|
||||
#define user_id ap_user_id
|
||||
#define user_name ap_user_name
|
||||
#define util_init ap_util_init
|
||||
#define util_uri_init ap_util_uri_init
|
||||
#define uudecode ap_uudecode
|
||||
#define vbprintf ap_vbprintf
|
||||
|
||||
/*
|
||||
* Macros for routines whose arguments have changed over time.
|
||||
*/
|
||||
#define spawn_child(p,f,v,k,in,out) ap_spawn_child(p,f,v,k,in,out,NULL)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !AP_COMPAT_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* ap_config_auto.h -- Automatically determined configuration stuff
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED - DO NOT EDIT!
|
||||
*/
|
||||
|
||||
#ifndef AP_CONFIG_AUTO_H
|
||||
#define AP_CONFIG_AUTO_H
|
||||
|
||||
/* check: #include <dlfcn.h> */
|
||||
#ifndef HAVE_DLFCN_H
|
||||
#define HAVE_DLFCN_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <dl.h> */
|
||||
#ifdef HAVE_DL_H
|
||||
#undef HAVE_DL_H
|
||||
#endif
|
||||
|
||||
/* check: #include <bstring.h> */
|
||||
#ifdef HAVE_BSTRING_H
|
||||
#undef HAVE_BSTRING_H
|
||||
#endif
|
||||
|
||||
/* check: #include <crypt.h> */
|
||||
#ifndef HAVE_CRYPT_H
|
||||
#define HAVE_CRYPT_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <unistd.h> */
|
||||
#ifndef HAVE_UNISTD_H
|
||||
#define HAVE_UNISTD_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <sys/resource.h> */
|
||||
#ifndef HAVE_SYS_RESOURCE_H
|
||||
#define HAVE_SYS_RESOURCE_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <sys/select.h> */
|
||||
#ifndef HAVE_SYS_SELECT_H
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
#endif
|
||||
|
||||
/* check: #include <sys/processor.h> */
|
||||
#ifndef HAVE_SYS_PROCESSOR_H
|
||||
#define HAVE_SYS_PROCESSOR_H 1
|
||||
#endif
|
||||
|
||||
/* build flag: -DSOLARIS2=260 */
|
||||
#ifndef SOLARIS2
|
||||
#define SOLARIS2 260
|
||||
#endif
|
||||
|
||||
#endif /* AP_CONFIG_AUTO_H */
|
@ -1,89 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-1999 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AP_CTYPE_H
|
||||
#define AP_CTYPE_H
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* These macros allow correct support of 8-bit characters on systems which
|
||||
* support 8-bit characters. Pretty dumb how the cast is required, but
|
||||
* that's legacy libc for ya. These new macros do not support EOF like
|
||||
* the standard macros do. Tough.
|
||||
*/
|
||||
#define ap_isalnum(c) (isalnum(((unsigned char)(c))))
|
||||
#define ap_isalpha(c) (isalpha(((unsigned char)(c))))
|
||||
#define ap_iscntrl(c) (iscntrl(((unsigned char)(c))))
|
||||
#define ap_isdigit(c) (isdigit(((unsigned char)(c))))
|
||||
#define ap_isgraph(c) (isgraph(((unsigned char)(c))))
|
||||
#define ap_islower(c) (islower(((unsigned char)(c))))
|
||||
#define ap_isprint(c) (isprint(((unsigned char)(c))))
|
||||
#define ap_ispunct(c) (ispunct(((unsigned char)(c))))
|
||||
#define ap_isspace(c) (isspace(((unsigned char)(c))))
|
||||
#define ap_isupper(c) (isupper(((unsigned char)(c))))
|
||||
#define ap_isxdigit(c) (isxdigit(((unsigned char)(c))))
|
||||
#define ap_tolower(c) (tolower(((unsigned char)(c))))
|
||||
#define ap_toupper(c) (toupper(((unsigned char)(c))))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !AP_CTYPE_H */
|
@ -1,244 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-1999 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_AP_MMN_H
|
||||
#define APACHE_AP_MMN_H
|
||||
|
||||
/*
|
||||
* MODULE_MAGIC_NUMBER_MAJOR
|
||||
* Major API changes that could cause compatibility problems for older modules
|
||||
* such as structure size changes. No binary compatibility is possible across
|
||||
* a change in the major version.
|
||||
*
|
||||
* MODULE_MAGIC_NUMBER_MINOR
|
||||
* Minor API changes that do not cause binary compatibility problems.
|
||||
* Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR.
|
||||
*
|
||||
* See the MODULE_MAGIC_AT_LEAST macro below for an example.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 19950525 - original value
|
||||
* 19960512 (1.1b2) - updated, 1.1, version.
|
||||
* 19960526 (1.1b3) - get_token(), table_unset(), pstrndup()
|
||||
* functions added
|
||||
* 19960725 (1.2-dev) - HTTP/1.1 compliance
|
||||
* (new version of read_client_block)
|
||||
* 19960806 (1.2-dev) - scan_script_header_err() added
|
||||
* 19961007 (1.2-dev) - replace read_client_block() with get_client_block()
|
||||
* 19961125 (1.2b1) - change setup_client_block() to Roy's version
|
||||
* 19961211 (1.2b3) - rwrite() added
|
||||
* 19970103 (1.2b5-dev) - header parse API
|
||||
* 19970427 (1.2b9-dev) - port references made unsigned
|
||||
* 19970526 (1.2) - correct vhost walk for multiple requests on a single
|
||||
* connect
|
||||
* 19970623 (1.3-dev) - NT changes
|
||||
* 19970628 (1.3-dev) - ap_slack (fd fixes) added
|
||||
* 19970717 (1.3-dev) - child_init API hook added
|
||||
* 19970719 (1.3-dev) - discard_request_body() added (to clear the decks
|
||||
* as needed)
|
||||
* 19970728 (1.3a2-dev) - child_exit API hook added
|
||||
* 19970818 (1.3a2-dev) - post read-request phase added
|
||||
* 19970825 (1.3a2-dev) - r->mtime cell added
|
||||
* 19970831 (1.3a2-dev) - error logging changed to use aplog_error()
|
||||
* 19970902 (1.3a2-dev) - MD5 routines and structures renamed to ap_*
|
||||
* 19970912 (1.3b1-dev) - set_last_modified split into set_last_modified,
|
||||
* set_etag and meets_conditions
|
||||
* register_other_child API
|
||||
* piped_log API
|
||||
* short_score split into parent and child pieces
|
||||
* os_is_absolute_path
|
||||
* 19971026 (1.3b3-dev) - custom config hooks in place
|
||||
* 19980126 (1.3b4-dev) - ap_cpystrn(), table_addn(), table_setn(),
|
||||
* table_mergen()
|
||||
* 19980201 (1.3b4-dev) - construct_url()
|
||||
* prototype server_rec * -> request_rec *
|
||||
* add get_server_name() and get_server_port()
|
||||
* 19980207 (1.3b4-dev) - add dynamic_load_handle to module structure as part
|
||||
* of the STANDARD_MODULE_STUFF header
|
||||
* 19980304 (1.3b6-dev) - abstraction of SERVER_BUILT and SERVER_VERSION
|
||||
* 19980305 (1.3b6-dev) - ap_config.h added for use by external modules
|
||||
* 19980312 (1.3b6-dev) - parse_uri_components() and its ilk
|
||||
* remove r->hostlen, add r->unparsed_uri
|
||||
* set_string_slot_lower()
|
||||
* clarification: non-RAW_ARGS cmd handlers do not
|
||||
* need to pstrdup() their arguments
|
||||
* clarification: request_rec members content_type,
|
||||
* handler, content_encoding, content_language,
|
||||
* content_languages MUST all be lowercase strings,
|
||||
* and MAY NOT be modified in place -- modifications
|
||||
* require pstrdup().
|
||||
* 19980317 (1.3b6-dev) - CORE_EXPORTs for win32 and <Perl>
|
||||
* API export basic_http_header, send_header_field,
|
||||
* set_keepalive, srm_command_loop, check_cmd_context,
|
||||
* tm2sec
|
||||
* spacetoplus(), plustospace(), client_to_stdout()
|
||||
* removed
|
||||
* 19980324 (1.3b6-dev) - API_EXPORT(index_of_response)
|
||||
* 19980413 (1.3b6-dev) - The BIG SYMBOL RENAMING: general ap_ prefix
|
||||
* (see src/include/compat.h for more details)
|
||||
* ap_vformatter() API, see src/include/ap.h
|
||||
* 19980507 (1.3b7-dev) - addition of ap_add_version_component() and
|
||||
* discontinuation of -DSERVER_SUBVERSION support
|
||||
* 19980519 (1.3b7-dev) - add child_info * to spawn function (as passed to
|
||||
* ap_spawn_child_err_buff) and to ap_call_exec to make
|
||||
* children work correctly on Win32.
|
||||
* 19980527 (1.3b8-dev) - renamed some more functions to ap_ prefix which were
|
||||
* missed at the big renaming (they are defines):
|
||||
* is_default_port, default_port and http_method.
|
||||
* A new communication method for modules was added:
|
||||
* they can create customized error messages under the
|
||||
* "error-notes" key in the request_rec->notes table.
|
||||
* This string will be printed in place of the canned
|
||||
* error responses, and will be propagated to
|
||||
* ErrorDocuments or cgi scripts in the
|
||||
* (REDIRECT_)ERROR_NOTES variable.
|
||||
* 19980627 (1.3.1-dev) - More renaming that we forgot/bypassed. In particular:
|
||||
* table_elts --> ap_table_elts
|
||||
* is_table_empty --> ap_is_table_empty
|
||||
* 19980708 (1.3.1-dev) - ap_isalnum(), ap_isalpha(), ... "8-bit safe" ctype
|
||||
* macros and apctype.h added
|
||||
* 19980713 (1.3.1-dev) - renaming of C header files:
|
||||
* 1. conf.h -> ap_config.h
|
||||
* 2. conf_auto.h -> ap_config_auto.h - now merged
|
||||
* 3. ap_config.h -> ap_config_auto.h - now merged
|
||||
* 4. compat.h -> ap_compat.h
|
||||
* 5. apctype.h -> ap_ctype.h
|
||||
* 19980806 (1.3.2-dev) - add ap_log_rerror()
|
||||
* - add ap_scan_script_header_err_core()
|
||||
* - add ap_uuencode()
|
||||
* - add ap_custom_response()
|
||||
* 19980811 (1.3.2-dev) - added limit_req_line, limit_req_fieldsize, and
|
||||
* limit_req_fields to server_rec.
|
||||
* added limit_req_body to core_dir_config and
|
||||
* ap_get_limit_req_body() to get its value.
|
||||
* 19980812 (1.3.2-dev) - split off MODULE_MAGIC_NUMBER
|
||||
* 19980812.2 - add ap_overlap_tables()
|
||||
* 19980816 (1.3.2-dev) - change proxy to use tables for headers, change
|
||||
* struct cache_req to typedef cache_req.
|
||||
* Delete ap_proxy_get_header(), ap_proxy_add_header(),
|
||||
* ap_proxy_del_header(). Change interface of
|
||||
* ap_proxy_send_fb() and ap_proxy_cache_error().
|
||||
* Add ap_proxy_send_hdr_line() and ap_proxy_bputs2().
|
||||
* 19980825 (1.3.2-dev) - renamed is_HTTP_xxx() macros to ap_is_HTTP_xxx()
|
||||
* 19980825.1 - mod_proxy only (minor change): modified interface of
|
||||
* ap_proxy_read_headers() and rdcache() to use a
|
||||
* request_rec* instead of pool*
|
||||
* (for implementing better error reporting).
|
||||
* 19980906 (1.3.2-dev) - added ap_md5_binary()
|
||||
* 19980917 (1.3.2-dev) - bs2000: changed os_set_authfile() to os_set_account()
|
||||
* 19981108 (1.3.4-dev) - added ap_method_number_of()
|
||||
* - changed value of M_INVALID and added WebDAV methods
|
||||
* 19981108.1 - ap_exists_config_define() is now public (minor bump)
|
||||
* 19981204 - scoreboard changes -- added generation, changed
|
||||
* exit_generation to running_generation. Somewhere
|
||||
* earlier vhostrec was added, but it's only safe to use
|
||||
* as of this rev. See scoreboard.h for documentation.
|
||||
* 19981211 - DSO changes -- added ap_single_module_configure()
|
||||
* -- added ap_single_module_init()
|
||||
* 19981229 - mod_negotiation overhaul -- added ap_make_etag()
|
||||
* and added vlist_validator to request_rec.
|
||||
* 19990101 - renamed macro escape_uri() to ap_escape_uri()
|
||||
* - added MODULE_MAGIC_COOKIE to identify module structs
|
||||
* 19990103 (1.3.4-dev) - added ap_array_pstrcat()
|
||||
* 19990105 (1.3.4-dev) - added ap_os_is_filename_valid()
|
||||
* 19990106 (1.3.4-dev) - Move MODULE_MAGIC_COOKIE to the end of the
|
||||
* STANDARD_MODULE_STUFF macro so the version
|
||||
* numbers and file name remain at invariant offsets
|
||||
* 19990108 (1.3.4-dev) - status_drops_connection -> ap_status_drops_connection
|
||||
* scan_script_header -> ap_scan_script_header_err
|
||||
* - reordered entries in request_rec that were waiting
|
||||
* for a non-binary-compatible release.
|
||||
* (1.3.5-dev)
|
||||
* 19990108.1 - add ap_MD5Encode() for MD5 password handling.
|
||||
* 19990108.2 - add ap_validate_password() and change ap_MD5Encode()
|
||||
* to use a stronger algorithm.
|
||||
* 19990108.4 - add ap_size_list_item(), ap_get_list_item(), and
|
||||
* ap_find_list_item()
|
||||
* 19990108.5 - added ap_sub_req_method_uri() and added const to the
|
||||
* definition of method in request_rec.
|
||||
* 19990108.6 - SIGPIPE is now ignored by the core server.
|
||||
* 19990108.7 - ap_isxdigit added
|
||||
* 19990320 - METHODS and M_INVALID symbol values modified
|
||||
*/
|
||||
|
||||
#define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
|
||||
|
||||
#ifndef MODULE_MAGIC_NUMBER_MAJOR
|
||||
#define MODULE_MAGIC_NUMBER_MAJOR 19990320
|
||||
#endif
|
||||
#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
|
||||
#define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR /* backward compat */
|
||||
|
||||
/* Useful for testing for features. */
|
||||
#define MODULE_MAGIC_AT_LEAST(major,minor) \
|
||||
((major) > MODULE_MAGIC_NUMBER_MAJOR \
|
||||
|| ((major) == MODULE_MAGIC_NUMBER_MAJOR \
|
||||
&& (minor) >= MODULE_MAGIC_NUMBER_MINOR))
|
||||
|
||||
/* For example, suppose you wish to use the ap_overlap_tables
|
||||
function. You can do this:
|
||||
|
||||
#if MODULE_MAGIC_AT_LEAST(19980812,2)
|
||||
... use ap_overlap_tables()
|
||||
#else
|
||||
... alternative code which doesn't use ap_overlap_tables()
|
||||
#endif
|
||||
|
||||
*/
|
||||
|
||||
#endif /* !APACHE_AP_MMN_H */
|
@ -1,237 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1996-1999 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_BUFF_H
|
||||
#define APACHE_BUFF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef B_SFIO
|
||||
#include "sfio.h"
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Reading is buffered */
|
||||
#define B_RD (1)
|
||||
/* Writing is buffered */
|
||||
#define B_WR (2)
|
||||
#define B_RDWR (3)
|
||||
/* At end of file, or closed stream; no further input allowed */
|
||||
#define B_EOF (4)
|
||||
/* No further output possible */
|
||||
#define B_EOUT (8)
|
||||
/* A read error has occurred */
|
||||
#define B_RDERR (16)
|
||||
/* A write error has occurred */
|
||||
#define B_WRERR (32)
|
||||
#ifdef B_ERROR /* in SVR4: sometimes defined in /usr/include/sys/buf.h */
|
||||
#undef B_ERROR
|
||||
#endif
|
||||
#define B_ERROR (48)
|
||||
/* Use chunked writing */
|
||||
#define B_CHUNK (64)
|
||||
/* bflush() if a read would block */
|
||||
#define B_SAFEREAD (128)
|
||||
/* buffer is a socket */
|
||||
#define B_SOCKET (256)
|
||||
#ifdef CHARSET_EBCDIC
|
||||
#define B_ASCII2EBCDIC 0x40000000 /* Enable conversion for this buffer */
|
||||
#define B_EBCDIC2ASCII 0x80000000 /* Enable conversion for this buffer */
|
||||
#endif /*CHARSET_EBCDIC */
|
||||
|
||||
typedef struct buff_struct BUFF;
|
||||
|
||||
struct buff_struct {
|
||||
int flags; /* flags */
|
||||
unsigned char *inptr; /* pointer to next location to read */
|
||||
int incnt; /* number of bytes left to read from input buffer;
|
||||
* always 0 if had a read error */
|
||||
int outchunk; /* location of chunk header when chunking */
|
||||
int outcnt; /* number of byte put in output buffer */
|
||||
unsigned char *inbase;
|
||||
unsigned char *outbase;
|
||||
int bufsiz;
|
||||
void (*error) (BUFF * fb, int op, void *data);
|
||||
void *error_data;
|
||||
long int bytes_sent; /* number of bytes actually written */
|
||||
|
||||
ap_pool *pool;
|
||||
|
||||
/* could also put pointers to the basic I/O routines here */
|
||||
int fd; /* the file descriptor */
|
||||
int fd_in; /* input file descriptor, if different */
|
||||
#ifdef WIN32
|
||||
HANDLE hFH; /* Windows filehandle */
|
||||
#endif
|
||||
|
||||
/* transport handle, for RPC binding handle or some such */
|
||||
void *t_handle;
|
||||
|
||||
#ifdef B_SFIO
|
||||
Sfio_t *sf_in;
|
||||
Sfio_t *sf_out;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef B_SFIO
|
||||
typedef struct {
|
||||
Sfdisc_t disc;
|
||||
BUFF *buff;
|
||||
} apache_sfio;
|
||||
|
||||
extern Sfdisc_t *bsfio_new(pool * p, BUFF * b);
|
||||
#endif
|
||||
|
||||
/* Options to bset/getopt */
|
||||
#define BO_BYTECT (1)
|
||||
|
||||
/* Stream creation and modification */
|
||||
API_EXPORT(BUFF *) ap_bcreate(pool * p, int flags);
|
||||
API_EXPORT(void) ap_bpushfd(BUFF * fb, int fd_in, int fd_out);
|
||||
#ifdef WIN32
|
||||
API_EXPORT(void) ap_bpushh(BUFF * fb, HANDLE hFH);
|
||||
#endif
|
||||
API_EXPORT(int) ap_bsetopt(BUFF * fb, int optname, const void *optval);
|
||||
API_EXPORT(int) ap_bgetopt(BUFF * fb, int optname, void *optval);
|
||||
API_EXPORT(int) ap_bsetflag(BUFF * fb, int flag, int value);
|
||||
API_EXPORT(int) ap_bclose(BUFF * fb);
|
||||
|
||||
#define ap_bgetflag(fb, flag) ((fb)->flags & (flag))
|
||||
|
||||
/* Error handling */
|
||||
API_EXPORT(void) ap_bonerror(BUFF * fb,
|
||||
void (*error) (BUFF *, int, void *),
|
||||
void *data);
|
||||
|
||||
/* I/O */
|
||||
API_EXPORT(int) ap_bread(BUFF * fb, void *buf, int nbyte);
|
||||
API_EXPORT(int) ap_bgets(char *s, int n, BUFF * fb);
|
||||
API_EXPORT(int) ap_blookc(char *buff, BUFF * fb);
|
||||
API_EXPORT(int) ap_bskiplf(BUFF * fb);
|
||||
API_EXPORT(int) ap_bwrite(BUFF * fb, const void *buf, int nbyte);
|
||||
API_EXPORT(int) ap_bflush(BUFF * fb);
|
||||
API_EXPORT(int) ap_bputs(const char *x, BUFF * fb);
|
||||
API_EXPORT(int) ap_bvputs(BUFF * fb, ...);
|
||||
API_EXPORT_NONSTD(int) ap_bprintf(BUFF * fb, const char *fmt, ...)
|
||||
__attribute__ ((format(printf, 2, 3)));
|
||||
API_EXPORT(int) ap_vbprintf(BUFF * fb, const char *fmt, va_list vlist);
|
||||
|
||||
/* Internal routines */
|
||||
API_EXPORT(int) ap_bflsbuf(int c, BUFF * fb);
|
||||
API_EXPORT(int) ap_bfilbuf(BUFF * fb);
|
||||
|
||||
#ifndef CHARSET_EBCDIC
|
||||
|
||||
#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \
|
||||
((fb)->incnt--, *((fb)->inptr++)) )
|
||||
|
||||
#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
|
||||
(fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \
|
||||
((fb)->outbase[(fb)->outcnt++] = (c), 0))
|
||||
|
||||
#else /*CHARSET_EBCDIC */
|
||||
|
||||
#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \
|
||||
((fb)->incnt--, (fb->flags & B_ASCII2EBCDIC)\
|
||||
?os_toebcdic[(unsigned char)*((fb)->inptr++)]:*((fb)->inptr++)) )
|
||||
|
||||
#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
|
||||
(fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \
|
||||
((fb)->outbase[(fb)->outcnt++] = (fb->flags & B_EBCDIC2ASCII)\
|
||||
?os_toascii[(unsigned char)c]:(c), 0))
|
||||
|
||||
#endif /*CHARSET_EBCDIC */
|
||||
struct child_info {
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* These handles are used by ap_call_exec to call
|
||||
* create process with pipe handles.
|
||||
*/
|
||||
HANDLE hPipeInputRead;
|
||||
HANDLE hPipeOutputWrite;
|
||||
HANDLE hPipeErrorWrite;
|
||||
#else
|
||||
/*
|
||||
* We need to put a dummy member in here to avoid compilation
|
||||
* errors under certain Unix compilers, like SGI's and HPUX's,
|
||||
* which fail to compile a zero-sized struct. Of course
|
||||
* it would be much nicer if there was actually a use for this
|
||||
* structure under Unix. Aah the joys of x-platform code.
|
||||
*/
|
||||
int dummy;
|
||||
#endif
|
||||
};
|
||||
API_EXPORT(int) ap_bspawn_child(pool *, int (*)(void *, child_info *),
|
||||
void *, enum kill_conditions,
|
||||
BUFF ** pipe_in, BUFF ** pipe_out,
|
||||
BUFF ** pipe_err);
|
||||
|
||||
/* enable non-blocking operations */
|
||||
API_EXPORT(int) ap_bnonblock(BUFF * fb, int direction);
|
||||
/* and get an fd to select() on */
|
||||
API_EXPORT(int) ap_bfileno(BUFF * fb, int direction);
|
||||
|
||||
/* bflush() if a read now would block, but don't actually read anything */
|
||||
API_EXPORT(void) ap_bhalfduplex(BUFF * fb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !APACHE_BUFF_H */
|
@ -1,119 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1999 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_HTTP_CONF_GLOBALS_H
|
||||
#define APACHE_HTTP_CONF_GLOBALS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Process config --- what the process ITSELF is doing
|
||||
*/
|
||||
|
||||
extern int ap_standalone;
|
||||
extern uid_t ap_user_id;
|
||||
extern char *ap_user_name;
|
||||
extern gid_t ap_group_id;
|
||||
#ifdef MULTIPLE_GROUPS
|
||||
extern gid_t group_id_list[NGROUPS_MAX];
|
||||
#endif
|
||||
extern int ap_max_requests_per_child;
|
||||
extern int ap_threads_per_child;
|
||||
extern int ap_excess_requests_per_child;
|
||||
extern struct in_addr ap_bind_address;
|
||||
extern listen_rec *ap_listeners;
|
||||
extern int ap_daemons_to_start;
|
||||
extern int ap_daemons_min_free;
|
||||
extern int ap_daemons_max_free;
|
||||
extern int ap_daemons_limit;
|
||||
extern MODULE_VAR_EXPORT int ap_suexec_enabled;
|
||||
extern int ap_listenbacklog;
|
||||
extern int ap_dump_settings;
|
||||
extern API_VAR_EXPORT int ap_extended_status;
|
||||
|
||||
extern char *ap_pid_fname;
|
||||
extern char *ap_scoreboard_fname;
|
||||
extern char *ap_lock_fname;
|
||||
extern MODULE_VAR_EXPORT char *ap_server_argv0;
|
||||
|
||||
extern enum server_token_type ap_server_tokens;
|
||||
|
||||
/* Trying to allocate these in the config pool gets us into some *nasty*
|
||||
* chicken-and-egg problems in http_main.c --- where do you stick them
|
||||
* when pconf gets cleared? Better to just allocate a little space
|
||||
* statically...
|
||||
*/
|
||||
|
||||
extern API_VAR_EXPORT char ap_server_root[MAX_STRING_LEN];
|
||||
extern char ap_server_confname[MAX_STRING_LEN];
|
||||
|
||||
/* for -C, -c and -D switches */
|
||||
extern array_header *ap_server_pre_read_config;
|
||||
extern array_header *ap_server_post_read_config;
|
||||
extern array_header *ap_server_config_defines;
|
||||
|
||||
/* We want this to have the least chance of being corrupted if there
|
||||
* is some memory corruption, so we allocate it statically.
|
||||
*/
|
||||
extern char ap_coredump_dir[MAX_STRING_LEN];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !APACHE_HTTP_CONF_GLOBALS_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* This file contains functions which can be inlined if the compiler
|
||||
* has an "inline" modifier. Because of this, this file is both a
|
||||
* header file and a compilable module.
|
||||
*
|
||||
* Only inlineable functions should be defined in here. They must all
|
||||
* include the INLINE modifier.
|
||||
*
|
||||
* If the compiler supports inline, this file will be #included as a
|
||||
* header file from os.h to create all the inline function
|
||||
* definitions. INLINE will be defined to whatever is required on
|
||||
* function definitions to make them inline declarations.
|
||||
*
|
||||
* If the compiler does not support inline, this file will be compiled
|
||||
* as a normal C file into libos.a (along with os.c). In this case
|
||||
* INLINE will _not_ be set so we can use this to test if we are
|
||||
* compiling this source file.
|
||||
*/
|
||||
|
||||
#ifndef INLINE
|
||||
#define INLINE
|
||||
|
||||
/* Anything required only when compiling */
|
||||
#include "ap_config.h"
|
||||
|
||||
#endif
|
||||
|
||||
INLINE int
|
||||
ap_os_is_path_absolute(const char *file)
|
||||
{
|
||||
return file[0] == '/';
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-1999 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef APACHE_OS_H
|
||||
#define APACHE_OS_H
|
||||
|
||||
#include "ap_config.h"
|
||||
|
||||
#define PLATFORM "Unix"
|
||||
|
||||
/*
|
||||
* This file in included in all Apache source code. It contains definitions
|
||||
* of facilities available on _this_ operating system (HAVE_* macros),
|
||||
* and prototypes of OS specific functions defined in os.c or os-inline.c
|
||||
*/
|
||||
|
||||
#if !defined(INLINE) && defined(USE_GNU_INLINE)
|
||||
/* Compiler supports inline, so include the inlineable functions as
|
||||
* part of the header
|
||||
*/
|
||||
#define INLINE extern ap_inline
|
||||
|
||||
INLINE int ap_os_is_path_absolute(const char *file);
|
||||
|
||||
#include "os-inline.c"
|
||||
|
||||
#else
|
||||
|
||||
/* Compiler does not support inline, so prototype the inlineable functions
|
||||
* as normal
|
||||
*/
|
||||
extern int ap_os_is_path_absolute(const char *file);
|
||||
#endif
|
||||
|
||||
/* Other ap_os_ routines not used by this platform */
|
||||
|
||||
#define ap_os_is_filename_valid(f) (1)
|
||||
|
||||
/*
|
||||
* Abstraction layer for loading
|
||||
* Apache modules under run-time via
|
||||
* dynamic shared object (DSO) mechanism
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DL_H
|
||||
#include <dl.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Do not use native AIX DSO support
|
||||
*/
|
||||
#ifdef AIX
|
||||
#undef HAVE_DLFCN_H
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#else
|
||||
void *dlopen(const char *, int);
|
||||
int dlclose(void *);
|
||||
void *dlsym(void *, const char *);
|
||||
const char *dlerror(void);
|
||||
#endif
|
||||
|
||||
/* probably on an older system that doesn't support RTLD_NOW or RTLD_LAZY.
|
||||
* The below define is a lie since we are really doing RTLD_LAZY since the
|
||||
* system doesn't support RTLD_NOW.
|
||||
*/
|
||||
#ifndef RTLD_NOW
|
||||
#define RTLD_NOW 1
|
||||
#endif
|
||||
|
||||
#ifndef RTLD_GLOBAL
|
||||
#define RTLD_GLOBAL 0
|
||||
#endif
|
||||
|
||||
#if (defined(__FreeBSD__) ||\
|
||||
defined(__OpenBSD__) ||\
|
||||
defined(__NetBSD__) ) && !defined(__ELF__)
|
||||
#define DLSYM_NEEDS_UNDERSCORE
|
||||
#endif
|
||||
|
||||
#define ap_os_dso_handle_t void *
|
||||
void ap_os_dso_init(void);
|
||||
void *ap_os_dso_load(const char *);
|
||||
void ap_os_dso_unload(void *);
|
||||
void *ap_os_dso_sym(void *, const char *);
|
||||
const char *ap_os_dso_error(void);
|
||||
|
||||
#endif /* !APACHE_OS_H */
|
@ -1,135 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-1999 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache"
|
||||
* nor may "Apache" appear in their names without prior written
|
||||
* permission of the Apache Group.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* util_uri.h: External Interface of util_uri.c
|
||||
*/
|
||||
|
||||
#ifndef UTIL_URI_H
|
||||
#define UTIL_URI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
unsigned short default_port;
|
||||
} schemes_t;
|
||||
|
||||
#define DEFAULT_FTP_DATA_PORT 20
|
||||
#define DEFAULT_FTP_PORT 21
|
||||
#define DEFAULT_GOPHER_PORT 70
|
||||
#define DEFAULT_NNTP_PORT 119
|
||||
#define DEFAULT_WAIS_PORT 210
|
||||
#define DEFAULT_SNEWS_PORT 563
|
||||
#define DEFAULT_PROSPERO_PORT 1525 /* WARNING: conflict w/Oracle */
|
||||
|
||||
/* Flags passed to unparse_uri_components(): */
|
||||
#define UNP_OMITSITEPART (1U<<0) /* suppress "scheme://user@site:port" */
|
||||
#define UNP_OMITUSER (1U<<1) /* Just omit user */
|
||||
#define UNP_OMITPASSWORD (1U<<2) /* Just omit password */
|
||||
#define UNP_OMITUSERINFO (UNP_OMITUSER|UNP_OMITPASSWORD) /* omit "user:password@" part */
|
||||
#define UNP_REVEALPASSWORD (1U<<3) /* Show plain text password (default: show XXXXXXXX) */
|
||||
#define UNP_OMITPATHINFO (1U<<4) /* Show "scheme://user@site:port" only */
|
||||
#define UNP_OMITQUERY (1U<<5) /* Omit the "?queryarg" from the path */
|
||||
|
||||
typedef struct {
|
||||
char *scheme; /* scheme ("http"/"ftp"/...) */
|
||||
char *hostinfo; /* combined [user[:password]@]host[:port] */
|
||||
char *user; /* user name, as in http://user:passwd@host:port/ */
|
||||
char *password; /* password, as in http://user:passwd@host:port/ */
|
||||
char *hostname; /* hostname from URI (or from Host: header) */
|
||||
char *port_str; /* port string (integer representation is in "port") */
|
||||
char *path; /* the request path (or "/" if only scheme://host was given) */
|
||||
char *query; /* Everything after a '?' in the path, if present */
|
||||
char *fragment; /* Trailing "#fragment" string, if present */
|
||||
|
||||
struct hostent *hostent;
|
||||
|
||||
unsigned short port; /* The port number, numeric, valid only if port_str != NULL */
|
||||
|
||||
unsigned is_initialized:1;
|
||||
|
||||
unsigned dns_looked_up:1;
|
||||
unsigned dns_resolved:1;
|
||||
|
||||
} uri_components;
|
||||
|
||||
/* util_uri.c */
|
||||
API_EXPORT(unsigned short) ap_default_port_for_scheme(const char
|
||||
*scheme_str);
|
||||
API_EXPORT(unsigned short) ap_default_port_for_request(const request_rec
|
||||
* r);
|
||||
API_EXPORT(struct hostent *) ap_pduphostent(pool * p,
|
||||
const struct hostent *hp);
|
||||
API_EXPORT(struct hostent *) ap_pgethostbyname(pool * p,
|
||||
const char *hostname);
|
||||
API_EXPORT(char *) ap_unparse_uri_components(pool * p,
|
||||
const uri_components *
|
||||
uptr, unsigned flags);
|
||||
API_EXPORT(int) ap_parse_uri_components(pool * p, const char *uri,
|
||||
uri_components * uptr);
|
||||
API_EXPORT(int) ap_parse_hostinfo_components(pool * p,
|
||||
const char *hostinfo,
|
||||
uri_components * uptr);
|
||||
/* called by the core in main() */
|
||||
extern void ap_util_uri_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*UTIL_URI_H */
|
@ -1,252 +0,0 @@
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Resource allocation routines...
|
||||
*
|
||||
* designed so that we don't have to keep track of EVERYTHING so that
|
||||
* it can be explicitly freed later (a fundamentally unsound strategy ---
|
||||
* particularly in the presence of die()).
|
||||
*
|
||||
* Instead, we maintain pools, and allocate items (both memory and I/O
|
||||
* handlers) from the pools --- currently there are two, one for per
|
||||
* transaction info, and one for config info. When a transaction is over,
|
||||
* we can delete everything in the per-transaction pool without fear, and
|
||||
* without thinking too hard about it either.
|
||||
*
|
||||
* rst
|
||||
*/
|
||||
|
||||
/* Arenas for configuration info and transaction info
|
||||
* --- actual layout of the pool structure is private to
|
||||
* alloc.c.
|
||||
*/
|
||||
|
||||
typedef struct pool pool;
|
||||
|
||||
extern pool *permanent_pool;
|
||||
void init_alloc(); /* Set up everything */
|
||||
pool *make_sub_pool(pool *); /* All pools are subpools of permanent_pool */
|
||||
void destroy_pool(pool *);
|
||||
|
||||
/* Clearing out EVERYTHING in an pool... destroys any sub-pools */
|
||||
|
||||
void clear_pool(struct pool *);
|
||||
|
||||
/* Preparing for exec() --- close files, etc., but *don't* flush I/O
|
||||
* buffers, *don't* wait for subprocesses, and *don't* free any memory.
|
||||
*/
|
||||
|
||||
void cleanup_for_exec();
|
||||
|
||||
/* routines to allocate memory from an pool... */
|
||||
|
||||
void *palloc(struct pool *, int nbytes);
|
||||
void *pcalloc(struct pool *, int nbytes);
|
||||
extern char *pstrdup(struct pool *, const char *s);
|
||||
extern char *pstrndup(struct pool *, const char *s, int n);
|
||||
char *pstrcat(struct pool *, ...); /* all '...' must be char* */
|
||||
|
||||
/* array and alist management... keeping lists of things.
|
||||
* Common enough to want common support code ...
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
pool *pool;
|
||||
int elt_size;
|
||||
int nelts;
|
||||
int nalloc;
|
||||
char *elts;
|
||||
} array_header;
|
||||
|
||||
array_header *make_array(pool * p, int nelts, int elt_size);
|
||||
void *push_array(array_header *);
|
||||
void array_cat(array_header * dst, const array_header * src);
|
||||
array_header *append_arrays(pool *, const array_header *,
|
||||
const array_header *);
|
||||
|
||||
/* copy_array copies the *entire* array. copy_array_hdr just copies
|
||||
* the header, and arranges for the elements to be copied if (and only
|
||||
* if) the code subsequently does a push or arraycat.
|
||||
*/
|
||||
|
||||
array_header *copy_array(pool * p, const array_header * src);
|
||||
array_header *copy_array_hdr(pool * p, const array_header * src);
|
||||
|
||||
|
||||
/* Tables. Implemented alist style, for now, though we try to keep
|
||||
* it so that imposing a hash table structure on top in the future
|
||||
* wouldn't be *too* hard...
|
||||
*
|
||||
* Note that key comparisons for these are case-insensitive, largely
|
||||
* because that's what's appropriate and convenient everywhere they're
|
||||
* currently being used...
|
||||
*/
|
||||
|
||||
typedef array_header table;
|
||||
|
||||
typedef struct {
|
||||
char *key; /* maybe NULL in future;
|
||||
* check when iterating thru table_elts
|
||||
*/
|
||||
char *val;
|
||||
} table_entry;
|
||||
|
||||
table *make_table(pool * p, int nelts);
|
||||
table *copy_table(pool * p, const table *);
|
||||
void clear_table(table *);
|
||||
char *table_get(const table *, const char *);
|
||||
void table_set(table *, const char *name, const char *val);
|
||||
void table_merge(table *, const char *name, const char *more_val);
|
||||
void table_unset(table *, const char *key);
|
||||
void table_add(table *, const char *name, const char *val);
|
||||
void table_do(int (*comp) (void *, const char *, const char *), void *rec,
|
||||
const table * t, ...);
|
||||
|
||||
table *overlay_tables(pool * p, const table * overlay, const table * base);
|
||||
|
||||
array_header *table_elts(table *);
|
||||
|
||||
#define is_empty_table(t) (((t) == NULL)||((t)->nelts == 0))
|
||||
|
||||
/* routines to remember allocation of other sorts of things...
|
||||
* generic interface first. Note that we want to have two separate
|
||||
* cleanup functions in the general case, one for exec() preparation,
|
||||
* to keep CGI scripts and the like from inheriting access to things
|
||||
* they shouldn't be able to touch, and one for actually cleaning up,
|
||||
* when the actual server process wants to get rid of the thing,
|
||||
* whatever it is.
|
||||
*
|
||||
* kill_cleanup disarms a cleanup, presumably because the resource in
|
||||
* question has been closed, freed, or whatever, and it's scarce
|
||||
* enough to want to reclaim (e.g., descriptors). It arranges for the
|
||||
* resource not to be cleaned up a second time (it might have been
|
||||
* reallocated). run_cleanup does the same, but runs it first.
|
||||
*
|
||||
* Cleanups are identified for purposes of finding & running them off by the
|
||||
* plain_cleanup and data, which should presumably be unique.
|
||||
*
|
||||
* NB any code which invokes register_cleanup or kill_cleanup directly
|
||||
* is a critical section which should be guarded by block_alarms() and
|
||||
* unblock_alarms() below...
|
||||
*/
|
||||
|
||||
void register_cleanup(pool * p, void *data, void (*plain_cleanup) (void *),
|
||||
void (*child_cleanup) (void *));
|
||||
|
||||
void kill_cleanup(pool * p, void *data, void (*plain_cleanup) (void *));
|
||||
void run_cleanup(pool * p, void *data, void (*cleanup) (void *));
|
||||
|
||||
/* The time between when a resource is actually allocated, and when it
|
||||
* its cleanup is registered is a critical section, during which the
|
||||
* resource could leak if we got interrupted or timed out. So, anything
|
||||
* which registers cleanups should bracket resource allocation and the
|
||||
* cleanup registry with these. (This is done internally by run_cleanup).
|
||||
*
|
||||
* NB they are actually implemented in http_main.c, since they are bound
|
||||
* up with timeout handling in general...
|
||||
*/
|
||||
|
||||
extern void block_alarms();
|
||||
extern void unblock_alarms();
|
||||
|
||||
/* Common cases which want utility support..
|
||||
* the note_cleanups_for_foo routines are for
|
||||
*/
|
||||
|
||||
FILE *pfopen(struct pool *, const char *name, const char *fmode);
|
||||
FILE *pfdopen(struct pool *, int fd, const char *fmode);
|
||||
int popenf(struct pool *, const char *name, int flg, int mode);
|
||||
|
||||
void note_cleanups_for_file(pool *, FILE *);
|
||||
void note_cleanups_for_fd(pool *, int);
|
||||
void kill_cleanups_for_fd(pool * p, int fd);
|
||||
|
||||
regex_t *pregcomp(pool * p, const char *pattern, int cflags);
|
||||
void pregfree(pool * p, regex_t * reg);
|
||||
|
||||
/* routines to note closes... file descriptors are constrained enough
|
||||
* on some systems that we want to support this.
|
||||
*/
|
||||
|
||||
int pfclose(struct pool *, FILE *);
|
||||
int pclosef(struct pool *, int fd);
|
||||
|
||||
/* ... even child processes (which we may want to wait for,
|
||||
* or to kill outright, on unexpected termination).
|
||||
*
|
||||
* spawn_child is a utility routine which handles an awful lot of
|
||||
* the rigamarole associated with spawning a child --- it arranges
|
||||
* for pipes to the child's stdin and stdout, if desired (if not,
|
||||
* set the associated args to NULL). It takes as args a function
|
||||
* to call in the child, and an argument to be passed to the function.
|
||||
*/
|
||||
|
||||
enum kill_conditions { kill_never, kill_always, kill_after_timeout,
|
||||
just_wait
|
||||
};
|
||||
|
||||
int spawn_child_err(pool *, void (*)(void *), void *, enum kill_conditions,
|
||||
FILE ** pipe_in, FILE ** pipe_out, FILE ** pipe_err);
|
||||
#define spawn_child(p,f,v,k,in,out) spawn_child_err(p,f,v,k,in,out,NULL)
|
||||
|
||||
/* magic numbers --- min free bytes to consider a free pool block useable,
|
||||
* and the min amount to allocate if we have to go to malloc() */
|
||||
|
||||
#define BLOCK_MINFREE 4096
|
||||
#define BLOCK_MINALLOC 8192
|
||||
|
||||
/* Finally, some accounting */
|
||||
|
||||
long bytes_in_pool(pool * p);
|
||||
long bytes_in_free_blocks();
|
@ -1,138 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1996,1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Reading is buffered */
|
||||
#define B_RD (1)
|
||||
/* Writing is buffered */
|
||||
#define B_WR (2)
|
||||
#define B_RDWR (3)
|
||||
/* At end of file, or closed stream; no further input allowed */
|
||||
#define B_EOF (4)
|
||||
/* No further output possible */
|
||||
#define B_EOUT (8)
|
||||
/* A read error has occurred */
|
||||
#define B_RDERR (16)
|
||||
/* A write error has occurred */
|
||||
#define B_WRERR (32)
|
||||
#ifdef B_ERROR /* in SVR4: sometimes defined in /usr/include/sys/buf.h */
|
||||
#undef B_ERROR /* avoid "warning: `B_ERROR' redefined" */
|
||||
#endif
|
||||
#define B_ERROR (48)
|
||||
/* Use chunked writing */
|
||||
#define B_CHUNK (64)
|
||||
/* bflush() if a read would block */
|
||||
#define B_SAFEREAD (128)
|
||||
|
||||
typedef struct buff_struct BUFF;
|
||||
|
||||
struct buff_struct {
|
||||
int flags; /* flags */
|
||||
unsigned char *inptr; /* pointer to next location to read */
|
||||
int incnt; /* number of bytes left to read from input buffer;
|
||||
* always 0 if had a read error */
|
||||
int outchunk; /* location of chunk header when chunking */
|
||||
int outcnt; /* number of byte put in output buffer */
|
||||
unsigned char *inbase;
|
||||
unsigned char *outbase;
|
||||
int bufsiz;
|
||||
void (*error) (BUFF * fb, int op, void *data);
|
||||
void *error_data;
|
||||
long int bytes_sent; /* number of bytes actually written */
|
||||
|
||||
pool *pool;
|
||||
|
||||
/* could also put pointers to the basic I/O routines here */
|
||||
int fd; /* the file descriptor */
|
||||
int fd_in; /* input file descriptor, if different */
|
||||
};
|
||||
|
||||
/* Options to bset/getopt */
|
||||
#define BO_BYTECT (1)
|
||||
|
||||
/* Stream creation and modification */
|
||||
extern BUFF *bcreate(pool * p, int flags);
|
||||
extern void bpushfd(BUFF * fb, int fd_in, int fd_out);
|
||||
extern int bsetopt(BUFF * fb, int optname, const void *optval);
|
||||
extern int bgetopt(BUFF * fb, int optname, void *optval);
|
||||
extern int bsetflag(BUFF * fb, int flag, int value);
|
||||
extern int bclose(BUFF * fb);
|
||||
|
||||
#define bgetflag(fb, flag) ((fb)->flags & (flag))
|
||||
|
||||
/* Error handling */
|
||||
extern void bonerror(BUFF * fb, void (*error) (BUFF *, int, void *),
|
||||
void *data);
|
||||
|
||||
/* I/O */
|
||||
extern int bread(BUFF * fb, void *buf, int nbyte);
|
||||
extern int bgets(char *s, int n, BUFF * fb);
|
||||
extern int blookc(char *buff, BUFF * fb);
|
||||
extern int bskiplf(BUFF * fb);
|
||||
extern int bwrite(BUFF * fb, const void *buf, int nbyte);
|
||||
extern int bflush(BUFF * fb);
|
||||
extern int bputs(const char *x, BUFF * fb);
|
||||
extern int bvputs(BUFF * fb, ...);
|
||||
extern int bprintf(BUFF * fb, const char *fmt, ...);
|
||||
extern int vbprintf(BUFF * fb, const char *fmt, va_list vlist);
|
||||
|
||||
/* Internal routines */
|
||||
extern int bflsbuf(int c, BUFF * fb);
|
||||
extern int bfilbuf(BUFF * fb);
|
||||
|
||||
#define bgetc(fb) ( ((fb)->incnt == 0) ? bfilbuf(fb) : \
|
||||
((fb)->incnt--, *((fb)->inptr++)) )
|
||||
|
||||
#define bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
|
||||
(fb)->outcnt == (fb)->bufsiz) ? bflsbuf(c, (fb)) : \
|
||||
((fb)->outbase[(fb)->outcnt++] = (c), 0))
|
@ -1,756 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* conf.h: system-dependant #defines and includes...
|
||||
* See PORTING for a listing of what they mean
|
||||
*/
|
||||
|
||||
#if !defined(QNX) && !defined(MPE)
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
/* Define one of these according to your system. */
|
||||
#if defined(MPE)
|
||||
#include <sys/times.h>
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define NO_SETSID
|
||||
#define NO_KILLPG
|
||||
#define NO_WRITEV
|
||||
#define NEED_INITGROUPS
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRDUP
|
||||
#define NEED_STRNCASECMP
|
||||
extern void GETPRIVMODE();
|
||||
extern void GETUSERMODE();
|
||||
extern char *inet_ntoa();
|
||||
#define NO_SLACK
|
||||
|
||||
#elif defined(SUNOS4)
|
||||
#define HAVE_GMTOFF
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
char *crypt(const char *pw, const char *salt);
|
||||
char *mktemp(char *template);
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_MMAP
|
||||
#include <sys/time.h>
|
||||
#define NEED_STRERROR
|
||||
typedef int rlim_t;
|
||||
#ifndef HAVE_MEMMOVE
|
||||
#define memmove(a,b,c) memcpy(a, b, c)
|
||||
#endif
|
||||
#define NO_LINGCLOSE
|
||||
#define USE_FLOCK_SERIALIZED_ACCEPT
|
||||
|
||||
#elif defined(SOLARIS2)
|
||||
#undef HAVE_GMTOFF
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_CRYPT_H
|
||||
int gethostname(char *name, int namelen);
|
||||
|
||||
#elif defined(IRIX)
|
||||
#undef HAVE_GMTOFF
|
||||
/* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
|
||||
* there's some weird conflict with non-BSD signals */
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#define HAVE_SHMGET
|
||||
#define HAVE_CRYPT_H
|
||||
#define NO_LONG_DOUBLE
|
||||
#define HAVE_BSTRING_H
|
||||
#define NO_LINGCLOSE
|
||||
|
||||
#elif defined(HIUX)
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#undef HAVE_GMTOFF
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#ifndef _HIUX_SOURCE
|
||||
#define _HIUX_SOURCE
|
||||
#endif
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_SHMGET
|
||||
#define SELECT_NEEDS_CAST
|
||||
|
||||
#elif defined(HPUX) || defined(HPUX10)
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#undef HAVE_GMTOFF
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#ifndef _HPUX_SOURCE
|
||||
#define _HPUX_SOURCE
|
||||
#endif
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_SHMGET
|
||||
#ifndef HPUX10
|
||||
#define SELECT_NEEDS_CAST
|
||||
typedef int rlim_t;
|
||||
#endif
|
||||
|
||||
#elif defined(AIX)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define HAVE_SYS_SELECT_H
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#ifndef __ps2__
|
||||
#define HAVE_MMAP
|
||||
#define DEFAULT_GROUP "nobody"
|
||||
#endif
|
||||
#define DEFAULT_USER "nobody"
|
||||
#ifdef NEED_RLIM_T
|
||||
typedef int rlim_t;
|
||||
#endif
|
||||
|
||||
#elif defined(ULTRIX)
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define ULTRIX_BRAIN_DEATH
|
||||
#define NEED_STRDUP
|
||||
/* If you have Ultrix 4.3, and are using cc, const is broken */
|
||||
#ifndef __ultrix__ /* Hack to check for pre-Ultrix 4.4 cc */
|
||||
#define const /* Not implemented */
|
||||
#endif
|
||||
#define JMP_BUF sigjmp_buf
|
||||
|
||||
#elif defined(OSF1)
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_CRYPT_H
|
||||
#define NO_LONG_DOUBLE
|
||||
|
||||
#elif defined(PARAGON)
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_CRYPT_H
|
||||
#define NO_LONG_DOUBLE
|
||||
typedef int rlim_t;
|
||||
|
||||
#elif defined(SEQUENT)
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#define NO_SETSID
|
||||
#define NEED_STRDUP
|
||||
#define tolower(c) (isupper(c) ? tolower(c) : c)
|
||||
|
||||
#elif defined(NEXT)
|
||||
typedef unsigned short mode_t;
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#define NO_SETSID
|
||||
#define NEED_STRDUP
|
||||
#define NO_LINGCLOSE
|
||||
#define NO_UNISTD_H
|
||||
#undef _POSIX_SOURCE
|
||||
#ifndef FD_CLOEXEC
|
||||
#define FD_CLOEXEC 1
|
||||
#endif
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(m) (((m)&(S_IFMT)) == (S_IFDIR))
|
||||
#endif
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(m) (((m)&(S_IFMT)) == (S_IFREG))
|
||||
#endif
|
||||
#ifndef S_IXUSR
|
||||
#define S_IXUSR 00100
|
||||
#endif
|
||||
#ifndef S_IRGRP
|
||||
#define S_IRGRP 00040
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
#define S_IXGRP 00010
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
#define S_IROTH 00004
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
#define S_IXOTH 00001
|
||||
#endif
|
||||
#ifndef S_IRUSR
|
||||
#define S_IRUSR S_IREAD
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
#define S_IWUSR S_IWRITE
|
||||
#endif
|
||||
#ifndef S_IWGRP
|
||||
#define S_IWGRP 000020
|
||||
#endif
|
||||
#ifndef S_IWOTH
|
||||
#define S_IWOTH 000002
|
||||
#ifndef rlim_t
|
||||
typedef int rlim_t;
|
||||
#endif
|
||||
typedef u_long n_long;
|
||||
#endif
|
||||
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
#define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
|
||||
typedef int pid_t;
|
||||
#define JMP_BUF jmp_buf
|
||||
#define USE_LONGJMP
|
||||
#define NO_USE_SIGACTION
|
||||
|
||||
#elif defined(LINUX)
|
||||
#if LINUX > 1
|
||||
#define HAVE_SHMGET
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
typedef int rlim_t;
|
||||
#endif
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#include <sys/time.h>
|
||||
|
||||
#elif defined(SCO)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define NEED_INITGROUPS
|
||||
#define NO_WRITEV
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define SIGURG SIGUSR1 /* but note, this signal will be sent to a process group if enabled (for OOB data). It is not currently enabled. */
|
||||
#include <sys/time.h>
|
||||
|
||||
#elif defined(SCO5)
|
||||
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define SIGURG SIGUSR1
|
||||
#define HAVE_SYS_SELECT_H
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#define SecureWare
|
||||
|
||||
/* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
|
||||
consts. Sigh. */
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
extern int strncasecmp(const char *, const char *, unsigned);
|
||||
|
||||
#elif defined(AUX)
|
||||
/* These are to let -Wall compile more cleanly */
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
extern int strncasecmp(const char *, const char *, unsigned);
|
||||
extern int set42sig(), getopt(), getpeername();
|
||||
extern int listen(), bind(), socket(), getsockname();
|
||||
extern int accept(), gethostname(), connect(), lstat();
|
||||
extern int select(), killpg(), shutdown();
|
||||
extern int initgroups(), setsockopt();
|
||||
extern char *shmat();
|
||||
extern int shmctl();
|
||||
extern int shmget();
|
||||
extern char *sbrk();
|
||||
extern char *crypt();
|
||||
#include <sys/time.h>
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define NEED_STRDUP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
/* fcntl() locking is expensive with NFS */
|
||||
#define USE_FLOCK_SERIALIZED_ACCEPT
|
||||
#define HAVE_SHMGET
|
||||
/*
|
||||
* NOTE: If when you run Apache under A/UX and you get a warning
|
||||
* that httpd couldn't move break, then the below value for
|
||||
* MOVEBREAK (64megs) is too large for your setup. Try reducing
|
||||
* to 0x2000000 which is still PLENTY of space. I doubt if
|
||||
* even on heavy systems sbrk() would be called at all...
|
||||
*/
|
||||
#define MOVEBREAK 0x4000000
|
||||
#define NO_LINGCLOSE
|
||||
#define NO_SLACK
|
||||
|
||||
#elif defined(SVR4)
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
/* A lot of SVR4 systems need this */
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
|
||||
#elif defined(UW)
|
||||
#define NO_LINGCLOSE
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_RESOURCE
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_SHMGET
|
||||
#define HAVE_CRYPT_H
|
||||
#define HAVE_SYS_SELECT_H
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#include <sys/time.h>
|
||||
#define _POSIX_SOURCE
|
||||
|
||||
#elif defined(DGUX)
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define JMP_BUF sigjmp_buf
|
||||
/* A lot of SVR4 systems need this */
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define DEFAULT_USER "nobody"
|
||||
#define DEFAULT_GROUP "nogroup"
|
||||
|
||||
#elif defined(UTS21)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#define NO_SETSID
|
||||
#define NEED_WAITPID
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
#define strftime(buf,bufsize,fmt,tm) ascftime(buf,fmt,tm)
|
||||
#include <sys/types.h>
|
||||
|
||||
#elif defined(APOLLO)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__bsdi__)
|
||||
#if defined(__FreeBSD__)
|
||||
#include <osreldate.h>
|
||||
#endif
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#define HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define HAVE_MMAP
|
||||
#define DEFAULT_USER "nobody"
|
||||
#define DEFAULT_GROUP "nogroup"
|
||||
#if defined(__bsdi__)
|
||||
typedef quad_t rlim_t;
|
||||
#endif
|
||||
#define USE_FLOCK_SERIALIZED_ACCEPT
|
||||
|
||||
#elif defined(QNX)
|
||||
#ifndef crypt
|
||||
char *crypt(const char *pw, const char *salt);
|
||||
#endif
|
||||
#ifndef initgroups
|
||||
int initgroups(char *, int);
|
||||
#endif
|
||||
#ifndef strncasecmp
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define NEED_INITGROUPS
|
||||
#define NEED_SELECT_H
|
||||
#define NEED_PROCESS_H
|
||||
#define HAVE_SYS_SELECT_H
|
||||
#include <unix.h>
|
||||
#define JMP_BUF sigjmp_buf
|
||||
|
||||
#elif defined(LYNXOS)
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define NEED_INITGROUPS
|
||||
#define JMP_BUF jmp_buf
|
||||
|
||||
#elif defined(UXPDS)
|
||||
#undef NEED_STRCASECMP
|
||||
#undef NEED_STRNCASECMP
|
||||
#undef NEED_STRDUP
|
||||
#undef HAVE_GMTOFF
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define HAVE_RESOURCE 1
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#define HAVE_MMAP
|
||||
#define HAVE_CRYPT_H
|
||||
|
||||
#elif defined(__EMX__)
|
||||
/* Defines required for EMX OS/2 port. */
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define NO_KILLPG
|
||||
#define NEED_STRCASECMP
|
||||
#define NEED_STRNCASECMP
|
||||
#define NO_SETSID
|
||||
/* Add some drive name support */
|
||||
#define chdir _chdir2
|
||||
#include <sys/time.h>
|
||||
#define MAXSOCKETS 4096
|
||||
#define HAVE_MMAP
|
||||
|
||||
#elif defined(__MACHTEN__)
|
||||
typedef int rlim_t;
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#undef NO_KILLPG
|
||||
#define NO_SETSID
|
||||
#define HAVE_GMTOFF
|
||||
#ifndef __MACHTEN_PPC__
|
||||
#ifndef __MACHTEN_68K__
|
||||
#define __MACHTEN_68K__
|
||||
#endif
|
||||
#define USE_FLOCK_SERIALIZED_ACCEPT
|
||||
#define NO_USE_SIGACTION
|
||||
#define USE_LONGJMP
|
||||
#undef NEED_STRDUP
|
||||
#else
|
||||
#define HAVE_SHMGET
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
#endif
|
||||
|
||||
/* Convex OS v11 */
|
||||
#elif defined(CONVEXOS11)
|
||||
#undef HAVE_GMTOFF
|
||||
#undef NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#undef NEED_STRDUP
|
||||
#define HAVE_MMAP
|
||||
|
||||
#define NO_TIMEZONE
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#define JMP_BUF jmp_buf
|
||||
typedef int rlim_t;
|
||||
|
||||
#elif defined(ISC)
|
||||
#include <net/errno.h>
|
||||
#define NO_KILLPG
|
||||
#undef NO_SETSID
|
||||
#define HAVE_SHMGET
|
||||
#define SIGURG SIGUSR1
|
||||
#define JMP_BUF sigjmp_buf
|
||||
#define USE_FCNTL_SERIALIZED_ACCEPT
|
||||
|
||||
/* Unknown system - Edit these to match */
|
||||
#else
|
||||
#ifdef BSD
|
||||
#define HAVE_GMTOFF
|
||||
#else
|
||||
#undef HAVE_GMTOFF
|
||||
#endif
|
||||
/* NO_KILLPG is set on systems that don't have killpg */
|
||||
#undef NO_KILLPG
|
||||
/* NO_SETSID is set on systems that don't have setsid */
|
||||
#undef NO_SETSID
|
||||
/* NEED_STRDUP is set on stupid systems that don't have strdup. */
|
||||
#undef NEED_STRDUP
|
||||
#endif
|
||||
|
||||
/* Do we have sys/resource.h; assume that BSD does. */
|
||||
#ifndef HAVE_SYS_RESOURCE_H
|
||||
#ifdef BSD
|
||||
#define HAVE_SYS_RESOURCE_H
|
||||
#endif
|
||||
#endif /* HAVE_SYS_RESOURCE_H */
|
||||
|
||||
/*
|
||||
* The particular directory style your system supports. If you have dirent.h
|
||||
* in /usr/include (POSIX) or /usr/include/sys (SYSV), #include
|
||||
* that file and define DIR_TYPE to be dirent. Otherwise, if you have
|
||||
* /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
|
||||
* file. If you have neither, I'm confused.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
/*
|
||||
* We use snprintf() to avoid overflows, but we include
|
||||
* our own version (ap_snprintf). Allow for people to use their
|
||||
* snprintf() if they want
|
||||
*/
|
||||
#ifdef HAVE_SNPRINTF
|
||||
#define ap_snprintf snprintf
|
||||
#define ap_vsnprintf vsnprintf
|
||||
#else
|
||||
int ap_snprintf(char *buf, size_t len, const char *format, ...);
|
||||
int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap);
|
||||
#endif
|
||||
|
||||
#if !defined(NEXT)
|
||||
#include <dirent.h>
|
||||
#define DIR_TYPE dirent
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
#define DIR_TYPE direct
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef MPE
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/ioctl.h>
|
||||
#ifndef MPE
|
||||
#include <arpa/inet.h> /* for inet_ntoa */
|
||||
#endif
|
||||
#include <time.h> /* for ctime */
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT)
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#ifdef NEED_PROCESS_H
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#ifdef SUNOS4
|
||||
int getrlimit(int, struct rlimit *);
|
||||
int setrlimit(int, struct rlimit *);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_MMAP
|
||||
#ifndef __EMX__
|
||||
/* This file is not needed for OS/2 */
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
|
||||
#define MAP_ANON MAP_ANONYMOUS
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(NO_MMAP)
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
|
||||
#ifndef LOGNAME_MAX
|
||||
#define LOGNAME_MAX 25
|
||||
#endif
|
||||
|
||||
#ifndef NEXT
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef ultrix
|
||||
#define ULTRIX_BRAIN_DEATH
|
||||
#endif
|
||||
|
||||
#ifndef S_ISLNK
|
||||
#ifndef __EMX__
|
||||
/* Don't define this for OS/2 */
|
||||
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE ((unsigned long) -1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Replace signal function with sigaction equivalent
|
||||
*/
|
||||
#ifndef NO_USE_SIGACTION
|
||||
typedef void Sigfunc(int);
|
||||
|
||||
#if defined(SIG_IGN) && !defined(SIG_ERR)
|
||||
#define SIG_ERR ((Sigfunc *)-1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For some strange reason, QNX defines signal to signal. Eliminate it.
|
||||
*/
|
||||
#ifdef signal
|
||||
#undef signal
|
||||
#endif
|
||||
#define signal(s,f) ap_signal(s,f)
|
||||
Sigfunc *signal(int signo, Sigfunc * func);
|
||||
#endif
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#if defined(USE_LONGJMP)
|
||||
#define ap_longjmp(x, y) longjmp((x), (y))
|
||||
#define ap_setjmp(x) setjmp(x)
|
||||
#else
|
||||
#define ap_longjmp(x, y) siglongjmp((x), (y))
|
||||
#define ap_setjmp(x) sigsetjmp((x), 1)
|
||||
#endif
|
||||
|
||||
/* Finding offsets of elements within structures.
|
||||
* Taken from the X code... they've sweated portability of this stuff
|
||||
* so we don't have to. Sigh...
|
||||
*/
|
||||
|
||||
#if defined(CRAY) || defined(__arm)
|
||||
#if __STDC__
|
||||
#define XtOffset(p_type,field) _Offsetof(p_type,field)
|
||||
#else
|
||||
#ifdef CRAY2
|
||||
#define XtOffset(p_type,field) \
|
||||
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
|
||||
|
||||
#else /* !CRAY2 */
|
||||
|
||||
#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
|
||||
|
||||
#endif /* !CRAY2 */
|
||||
#endif /* __STDC__ */
|
||||
#else /* ! (CRAY || __arm) */
|
||||
|
||||
#define XtOffset(p_type,field) \
|
||||
((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
|
||||
#endif /* !CRAY */
|
||||
|
||||
#ifdef offsetof
|
||||
#define XtOffsetOf(s_type,field) offsetof(s_type,field)
|
||||
#else
|
||||
#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
|
||||
#endif
|
||||
|
||||
#ifdef SUNOS_LIB_PROTOTYPES
|
||||
/* Prototypes needed to get a clean compile with gcc -Wall.
|
||||
* Believe it or not, these do have to be declared, at least on SunOS,
|
||||
* because they aren't mentioned in the relevant system headers.
|
||||
* Sun Quality Software. Gotta love it.
|
||||
*/
|
||||
|
||||
int getopt(int, char **, char *);
|
||||
|
||||
int strcasecmp(char *, char *);
|
||||
int strncasecmp(char *, char *, int);
|
||||
int toupper(int);
|
||||
int tolower(int);
|
||||
|
||||
int printf(char *, ...);
|
||||
int fprintf(FILE *, char *, ...);
|
||||
int fputs(char *, FILE *);
|
||||
int fread(char *, int, int, FILE *);
|
||||
int fwrite(char *, int, int, FILE *);
|
||||
int fflush(FILE *);
|
||||
int fclose(FILE *);
|
||||
int ungetc(int, FILE *);
|
||||
int _filbuf(FILE *); /* !!! */
|
||||
int _flsbuf(unsigned char, FILE *); /* !!! */
|
||||
int sscanf(char *, char *, ...);
|
||||
void setbuf(FILE *, char *);
|
||||
void perror(char *);
|
||||
|
||||
time_t time(time_t *);
|
||||
int strftime(char *, int, char *, struct tm *);
|
||||
|
||||
int initgroups(char *, int);
|
||||
int wait3(int *, int, void *); /* Close enough for us... */
|
||||
int lstat(const char *, struct stat *);
|
||||
int stat(const char *, struct stat *);
|
||||
int flock(int, int);
|
||||
#ifndef NO_KILLPG
|
||||
int killpg(int, int);
|
||||
#endif
|
||||
int socket(int, int, int);
|
||||
int setsockopt(int, int, int, const char *, int);
|
||||
int listen(int, int);
|
||||
int bind(int, struct sockaddr *, int);
|
||||
int connect(int, struct sockaddr *, int);
|
||||
int accept(int, struct sockaddr *, int *);
|
||||
int shutdown(int, int);
|
||||
|
||||
int getsockname(int s, struct sockaddr *name, int *namelen);
|
||||
int getpeername(int s, struct sockaddr *name, int *namelen);
|
||||
int gethostname(char *name, int namelen);
|
||||
void syslog(int, char *, ...);
|
||||
char *mktemp(char *);
|
||||
|
||||
long vfprintf(FILE *, char *, va_list);
|
||||
|
||||
#endif
|
@ -1,85 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Process config --- what the process ITSELF is doing
|
||||
*/
|
||||
|
||||
extern int standalone;
|
||||
extern uid_t user_id;
|
||||
extern char *user_name;
|
||||
extern gid_t group_id;
|
||||
#ifdef MULTIPLE_GROUPS
|
||||
extern gid_t group_id_list[NGROUPS_MAX];
|
||||
#endif
|
||||
extern int max_requests_per_child;
|
||||
extern struct in_addr bind_address;
|
||||
extern listen_rec *listeners;
|
||||
extern int daemons_to_start;
|
||||
extern int daemons_min_free;
|
||||
extern int daemons_max_free;
|
||||
extern int daemons_limit;
|
||||
extern int suexec_enabled;
|
||||
|
||||
extern char *pid_fname;
|
||||
extern char *scoreboard_fname;
|
||||
extern char *lock_fname;
|
||||
extern char *server_argv0;
|
||||
|
||||
/* Trying to allocate these in the config pool gets us into some *nasty*
|
||||
* chicken-and-egg problems in http_main.c --- where do you stick them
|
||||
* when pconf gets cleared? Better to just allocate a little space
|
||||
* statically...
|
||||
*/
|
||||
|
||||
extern char server_root[MAX_STRING_LEN];
|
||||
extern char server_confname[MAX_STRING_LEN];
|
@ -1,765 +0,0 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1995-1997 The Apache Group. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* 4. The names "Apache Server" and "Apache Group" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission.
|
||||
*
|
||||
* 5. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the Apache Group
|
||||
* for use in the Apache HTTP server project (http://www.apache.org/)."
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Group and was originally based
|
||||
* on public domain software written at the National Center for
|
||||
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
|
||||
* For more information on the Apache Group and the Apache HTTP server
|
||||
* project, please see <http://www.apache.org/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* httpd.h: header for simple (ha! not anymore) http daemon
|
||||
*/
|
||||
|
||||
/* Headers in which EVERYONE has an interest... */
|
||||
|
||||
#include "conf.h"
|
||||
#include "alloc.h"
|
||||
#include "buff.h"
|
||||
|
||||
/* ----------------------------- config dir ------------------------------ */
|
||||
|
||||
/* Define this to be the default server home dir. Anything later in this
|
||||
* file with a relative pathname will have this added.
|
||||
*/
|
||||
#ifndef HTTPD_ROOT
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define HTTPD_ROOT "/os2httpd"
|
||||
#else
|
||||
#define HTTPD_ROOT "/usr/local/etc/httpd"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DOCUMENT_LOCATION
|
||||
/* Root of server */
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define DOCUMENT_LOCATION "/os2httpd/docs"
|
||||
#else
|
||||
#define DOCUMENT_LOCATION "/usr/local/etc/httpd/htdocs"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Max. number of dynamically loaded modules */
|
||||
#define DYNAMIC_MODULE_LIMIT 64
|
||||
|
||||
/* Default administrator's address */
|
||||
#define DEFAULT_ADMIN "[no address given]"
|
||||
|
||||
/*
|
||||
* --------- You shouldn't have to edit anything below this line ----------
|
||||
*
|
||||
* Any modifications to any defaults not defined above should be done in the
|
||||
* respective config. file.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* -------------- Port number for server running standalone --------------- */
|
||||
|
||||
#define DEFAULT_PORT 80
|
||||
|
||||
/* --------- Default user name and group name running standalone ---------- */
|
||||
/* --- These may be specified as numbers by placing a # before a number --- */
|
||||
|
||||
#ifndef DEFAULT_USER
|
||||
#define DEFAULT_USER "#-1"
|
||||
#endif
|
||||
#ifndef DEFAULT_GROUP
|
||||
#define DEFAULT_GROUP "#-1"
|
||||
#endif
|
||||
|
||||
/* The name of the log files */
|
||||
#ifndef DEFAULT_XFERLOG
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define DEFAULT_XFERLOG "logs/access.log"
|
||||
#else
|
||||
#define DEFAULT_XFERLOG "logs/access_log"
|
||||
#endif
|
||||
#endif /* DEFAULT_XFERLOG */
|
||||
#ifndef DEFAULT_ERRORLOG
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define DEFAULT_ERRORLOG "logs/error.log"
|
||||
#else
|
||||
#define DEFAULT_ERRORLOG "logs/error_log"
|
||||
#endif
|
||||
#endif /* DEFAULT_ERRORLOG */
|
||||
#ifndef DEFAULT_PIDLOG
|
||||
#define DEFAULT_PIDLOG "logs/httpd.pid"
|
||||
#endif
|
||||
#ifndef DEFAULT_SCOREBOARD
|
||||
#define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
|
||||
#endif
|
||||
#ifndef DEFAULT_LOCKFILE
|
||||
#define DEFAULT_LOCKFILE "logs/accept.lock"
|
||||
#endif
|
||||
|
||||
/* Define this to be what your HTML directory content files are called */
|
||||
#define DEFAULT_INDEX "index.html"
|
||||
|
||||
/* Define this to 1 if you want fancy indexing, 0 otherwise */
|
||||
#define DEFAULT_INDEXING 0
|
||||
|
||||
/* Define this to be what type you'd like returned for files with unknown */
|
||||
/* suffixes */
|
||||
#define DEFAULT_TYPE "text/plain"
|
||||
|
||||
/* Define this to be what your per-directory security files are called */
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define DEFAULT_ACCESS_FNAME "htaccess"
|
||||
#else
|
||||
#define DEFAULT_ACCESS_FNAME ".htaccess"
|
||||
#endif
|
||||
|
||||
/* The name of the server config file */
|
||||
#ifndef SERVER_CONFIG_FILE
|
||||
#define SERVER_CONFIG_FILE "conf/httpd.conf"
|
||||
#endif
|
||||
|
||||
#ifndef RESOURCE_CONFIG_FILE
|
||||
/* The name of the document config file */
|
||||
#define RESOURCE_CONFIG_FILE "conf/srm.conf"
|
||||
#endif
|
||||
|
||||
#ifndef TYPES_CONFIG_FILE
|
||||
/* The name of the MIME types file */
|
||||
#define TYPES_CONFIG_FILE "conf/mime.types"
|
||||
#endif
|
||||
|
||||
#ifndef ACCESS_CONFIG_FILE
|
||||
/* The name of the access file */
|
||||
#define ACCESS_CONFIG_FILE "conf/access.conf"
|
||||
#endif
|
||||
|
||||
/* Whether we should enable rfc1413 identity checking */
|
||||
#define DEFAULT_RFC1413 0
|
||||
/* The default directory in user's home dir */
|
||||
#define DEFAULT_USER_DIR "public_html"
|
||||
|
||||
/* The default path for CGI scripts if none is currently set */
|
||||
#ifndef DEFAULT_PATH
|
||||
#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
|
||||
#endif
|
||||
|
||||
/* The path to the Bourne shell, for parsed docs */
|
||||
#ifndef SHELL_PATH
|
||||
#ifdef __EMX__
|
||||
/* Set default for OS/2 file system */
|
||||
#define SHELL_PATH "CMD.EXE"
|
||||
#else
|
||||
#define SHELL_PATH "/bin/sh"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* The path to the suExec wrapper, can be overridden in Configuration */
|
||||
#ifndef SUEXEC_BIN
|
||||
#define SUEXEC_BIN "/usr/local/etc/httpd/sbin/suexec"
|
||||
#endif
|
||||
|
||||
/* The default string lengths */
|
||||
#define MAX_STRING_LEN HUGE_STRING_LEN
|
||||
#define HUGE_STRING_LEN 8192
|
||||
|
||||
/* The timeout for waiting for messages */
|
||||
#define DEFAULT_TIMEOUT 300
|
||||
|
||||
/* The timeout for waiting for keepalive timeout until next request */
|
||||
#define DEFAULT_KEEPALIVE_TIMEOUT 15
|
||||
|
||||
/* The number of requests to entertain per connection */
|
||||
#define DEFAULT_KEEPALIVE 100
|
||||
|
||||
/* The size of the server's internal read-write buffers */
|
||||
#define IOBUFSIZE 8192
|
||||
|
||||
/* Number of servers to spawn off by default --- also, if fewer than
|
||||
* this free when the caretaker checks, it will spawn more.
|
||||
*/
|
||||
#define DEFAULT_START_DAEMON 5
|
||||
|
||||
/* Maximum number of *free* server processes --- more than this, and
|
||||
* they will die off.
|
||||
*/
|
||||
|
||||
#define DEFAULT_MAX_FREE_DAEMON 10
|
||||
|
||||
/* Minimum --- fewer than this, and more will be created */
|
||||
|
||||
#define DEFAULT_MIN_FREE_DAEMON 5
|
||||
|
||||
/* Limit on the total --- clients will be locked out if more servers than
|
||||
* this are needed. It is intended solely to keep the server from crashing
|
||||
* when things get out of hand.
|
||||
*
|
||||
* We keep a hard maximum number of servers, for two reasons --- first off,
|
||||
* in case something goes seriously wrong, we want to stop the fork bomb
|
||||
* short of actually crashing the machine we're running on by filling some
|
||||
* kernel table. Secondly, it keeps the size of the scoreboard file small
|
||||
* enough that we can read the whole thing without worrying too much about
|
||||
* the overhead.
|
||||
*/
|
||||
#ifndef HARD_SERVER_LIMIT
|
||||
#define HARD_SERVER_LIMIT 256
|
||||
#endif
|
||||
|
||||
/* Number of requests to try to handle in a single process. If <= 0,
|
||||
* the children don't die off. That's the default here, since I'm still
|
||||
* interested in finding and stanching leaks.
|
||||
*/
|
||||
|
||||
#define DEFAULT_MAX_REQUESTS_PER_CHILD 0
|
||||
|
||||
/* If you have altered Apache and wish to change the SERVER_VERSION
|
||||
* identifier below, please keep to the HTTP specification. This states that
|
||||
* the identification string should consist of product tokens with an optional
|
||||
* slash and version designator. Sub-products which form a significant part
|
||||
* of the application can be listed, separated by whitespace, by adding
|
||||
* their product tokens to EXTRA_CFLAGS in the Configuration file like so.
|
||||
*
|
||||
* EXTRA_CFLAGS="-DSERVER_SUBVERSION="MrWidget/0.1-alpha"
|
||||
*
|
||||
* The tokens are listed in order of their significance for identifying the
|
||||
* application.
|
||||
*
|
||||
* "Product tokens should be short and to the point -- use of them for
|
||||
* advertizing or other non-essential information is explicitly forbidden."
|
||||
*
|
||||
* Example: "Apache/1.1.0 MrWidget/0.1-alpha"
|
||||
*/
|
||||
|
||||
#define SERVER_BASEVERSION "Apache/1.2.6" /* SEE COMMENTS ABOVE */
|
||||
#ifdef SERVER_SUBVERSION
|
||||
#define SERVER_VERSION SERVER_BASEVERSION " " SERVER_SUBVERSION
|
||||
#else
|
||||
#define SERVER_VERSION SERVER_BASEVERSION
|
||||
#endif
|
||||
|
||||
/* Numeric release version identifier: major minor bugfix betaseq
|
||||
* Always increases along the same track as the source branch.
|
||||
*/
|
||||
#define APACHE_RELEASE 1020600
|
||||
|
||||
#define SERVER_PROTOCOL "HTTP/1.1"
|
||||
#define SERVER_SUPPORT "http://www.apache.org/"
|
||||
|
||||
#define DECLINED -1 /* Module declines to handle */
|
||||
#define OK 0 /* Module has handled this stage. */
|
||||
|
||||
|
||||
/* ----------------------- HTTP Status Codes ------------------------- */
|
||||
|
||||
#define RESPONSE_CODES 38
|
||||
|
||||
#define HTTP_CONTINUE 100
|
||||
#define HTTP_SWITCHING_PROTOCOLS 101
|
||||
#define HTTP_OK 200
|
||||
#define HTTP_CREATED 201
|
||||
#define HTTP_ACCEPTED 202
|
||||
#define HTTP_NON_AUTHORITATIVE 203
|
||||
#define HTTP_NO_CONTENT 204
|
||||
#define HTTP_RESET_CONTENT 205
|
||||
#define HTTP_PARTIAL_CONTENT 206
|
||||
#define HTTP_MULTIPLE_CHOICES 300
|
||||
#define HTTP_MOVED_PERMANENTLY 301
|
||||
#define HTTP_MOVED_TEMPORARILY 302
|
||||
#define HTTP_SEE_OTHER 303
|
||||
#define HTTP_NOT_MODIFIED 304
|
||||
#define HTTP_USE_PROXY 305
|
||||
#define HTTP_BAD_REQUEST 400
|
||||
#define HTTP_UNAUTHORIZED 401
|
||||
#define HTTP_PAYMENT_REQUIRED 402
|
||||
#define HTTP_FORBIDDEN 403
|
||||
#define HTTP_NOT_FOUND 404
|
||||
#define HTTP_METHOD_NOT_ALLOWED 405
|
||||
#define HTTP_NOT_ACCEPTABLE 406
|
||||
#define HTTP_PROXY_AUTHENTICATION_REQUIRED 407
|
||||
#define HTTP_REQUEST_TIME_OUT 408
|
||||
#define HTTP_CONFLICT 409
|
||||
#define HTTP_GONE 410
|
||||
#define HTTP_LENGTH_REQUIRED 411
|
||||
#define HTTP_PRECONDITION_FAILED 412
|
||||
#define HTTP_REQUEST_ENTITY_TOO_LARGE 413
|
||||
#define HTTP_REQUEST_URI_TOO_LARGE 414
|
||||
#define HTTP_UNSUPPORTED_MEDIA_TYPE 415
|
||||
#define HTTP_INTERNAL_SERVER_ERROR 500
|
||||
#define HTTP_NOT_IMPLEMENTED 501
|
||||
#define HTTP_BAD_GATEWAY 502
|
||||
#define HTTP_SERVICE_UNAVAILABLE 503
|
||||
#define HTTP_GATEWAY_TIME_OUT 504
|
||||
#define HTTP_VERSION_NOT_SUPPORTED 505
|
||||
#define HTTP_VARIANT_ALSO_VARIES 506
|
||||
|
||||
#define DOCUMENT_FOLLOWS HTTP_OK
|
||||
#define PARTIAL_CONTENT HTTP_PARTIAL_CONTENT
|
||||
#define MULTIPLE_CHOICES HTTP_MULTIPLE_CHOICES
|
||||
#define MOVED HTTP_MOVED_PERMANENTLY
|
||||
#define REDIRECT HTTP_MOVED_TEMPORARILY
|
||||
#define USE_LOCAL_COPY HTTP_NOT_MODIFIED
|
||||
#define BAD_REQUEST HTTP_BAD_REQUEST
|
||||
#define AUTH_REQUIRED HTTP_UNAUTHORIZED
|
||||
#define FORBIDDEN HTTP_FORBIDDEN
|
||||
#define NOT_FOUND HTTP_NOT_FOUND
|
||||
#define METHOD_NOT_ALLOWED HTTP_METHOD_NOT_ALLOWED
|
||||
#define NOT_ACCEPTABLE HTTP_NOT_ACCEPTABLE
|
||||
#define LENGTH_REQUIRED HTTP_LENGTH_REQUIRED
|
||||
#define PRECONDITION_FAILED HTTP_PRECONDITION_FAILED
|
||||
#define SERVER_ERROR HTTP_INTERNAL_SERVER_ERROR
|
||||
#define NOT_IMPLEMENTED HTTP_NOT_IMPLEMENTED
|
||||
#define BAD_GATEWAY HTTP_BAD_GATEWAY
|
||||
#define VARIANT_ALSO_VARIES HTTP_VARIANT_ALSO_VARIES
|
||||
|
||||
#define is_HTTP_INFO(x) (((x) >= 100)&&((x) < 200))
|
||||
#define is_HTTP_SUCCESS(x) (((x) >= 200)&&((x) < 300))
|
||||
#define is_HTTP_REDIRECT(x) (((x) >= 300)&&((x) < 400))
|
||||
#define is_HTTP_ERROR(x) (((x) >= 400)&&((x) < 600))
|
||||
#define is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500))
|
||||
#define is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600))
|
||||
|
||||
#define status_drops_connection(x) (((x) == HTTP_BAD_REQUEST) || \
|
||||
((x) == HTTP_REQUEST_TIME_OUT) || \
|
||||
((x) == HTTP_LENGTH_REQUIRED) || \
|
||||
((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \
|
||||
((x) == HTTP_REQUEST_URI_TOO_LARGE) || \
|
||||
((x) == HTTP_INTERNAL_SERVER_ERROR) || \
|
||||
((x) == HTTP_SERVICE_UNAVAILABLE))
|
||||
|
||||
|
||||
#define METHODS 8
|
||||
#define M_GET 0
|
||||
#define M_PUT 1
|
||||
#define M_POST 2
|
||||
#define M_DELETE 3
|
||||
#define M_CONNECT 4
|
||||
#define M_OPTIONS 5
|
||||
#define M_TRACE 6
|
||||
#define M_INVALID 7
|
||||
|
||||
#define CGI_MAGIC_TYPE "application/x-httpd-cgi"
|
||||
#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html"
|
||||
#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3"
|
||||
#define MAP_FILE_MAGIC_TYPE "application/x-type-map"
|
||||
#define ASIS_MAGIC_TYPE "httpd/send-as-is"
|
||||
#define DIR_MAGIC_TYPE "httpd/unix-directory"
|
||||
#define STATUS_MAGIC_TYPE "application/x-httpd-status"
|
||||
|
||||
/* Just in case your linefeed isn't the one the other end is expecting. */
|
||||
#define LF 10
|
||||
#define CR 13
|
||||
|
||||
/* Possible values for request_rec.read_body (set by handling module):
|
||||
* REQUEST_NO_BODY Send 413 error if message has any body
|
||||
* REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length
|
||||
* REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me.
|
||||
* REQUEST_CHUNKED_PASS Pass the chunks to me without removal.
|
||||
*/
|
||||
#define REQUEST_NO_BODY 0
|
||||
#define REQUEST_CHUNKED_ERROR 1
|
||||
#define REQUEST_CHUNKED_DECHUNK 2
|
||||
#define REQUEST_CHUNKED_PASS 3
|
||||
|
||||
/* Things which may vary per file-lookup WITHIN a request ---
|
||||
* e.g., state of MIME config. Basically, the name of an object, info
|
||||
* about the object, and any other info we may ahve which may need to
|
||||
* change as we go poking around looking for it (e.g., overridden by
|
||||
* .htaccess files).
|
||||
*
|
||||
* Note how the default state of almost all these things is properly
|
||||
* zero, so that allocating it with pcalloc does the right thing without
|
||||
* a whole lot of hairy initialization... so long as we are willing to
|
||||
* make the (fairly) portable assumption that the bit pattern of a NULL
|
||||
* pointer is, in fact, zero.
|
||||
*/
|
||||
|
||||
/* This represents the result of calling htaccess; these are cached for
|
||||
* each request.
|
||||
*/
|
||||
struct htaccess_result {
|
||||
char *dir; /* the directory to which this applies */
|
||||
int override; /* the overrides allowed for the .htaccess file */
|
||||
void *htaccess; /* the configuration directives */
|
||||
/* the next one, or NULL if no more; N.B. never change this */
|
||||
const struct htaccess_result *next;
|
||||
};
|
||||
|
||||
|
||||
typedef struct conn_rec conn_rec;
|
||||
typedef struct server_rec server_rec;
|
||||
typedef struct request_rec request_rec;
|
||||
typedef struct listen_rec listen_rec;
|
||||
|
||||
struct request_rec {
|
||||
|
||||
pool *pool;
|
||||
conn_rec *connection;
|
||||
server_rec *server;
|
||||
|
||||
request_rec *next; /* If we wind up getting redirected,
|
||||
* pointer to the request we redirected to.
|
||||
*/
|
||||
request_rec *prev; /* If this is an internal redirect,
|
||||
* pointer to where we redirected *from*.
|
||||
*/
|
||||
|
||||
request_rec *main; /* If this is a sub_request (see request.h)
|
||||
* pointer back to the main request.
|
||||
*/
|
||||
|
||||
/* Info about the request itself... we begin with stuff that only
|
||||
* protocol.c should ever touch...
|
||||
*/
|
||||
|
||||
char *the_request; /* First line of request, so we can log it */
|
||||
int assbackwards; /* HTTP/0.9, "simple" request */
|
||||
int proxyreq; /* A proxy request */
|
||||
int header_only; /* HEAD request, as opposed to GET */
|
||||
char *protocol; /* Protocol, as given to us, or HTTP/0.9 */
|
||||
int proto_num; /* Number version of protocol; 1.1 = 1001 */
|
||||
char *hostname; /* Host, as set by full URI or Host: */
|
||||
int hostlen; /* Length of http://host:port in full URI */
|
||||
|
||||
time_t request_time; /* When the request started */
|
||||
|
||||
char *status_line; /* Status line, if set by script */
|
||||
int status; /* In any case */
|
||||
|
||||
/* Request method, two ways; also, protocol, etc.. Outside of protocol.c,
|
||||
* look, but don't touch.
|
||||
*/
|
||||
|
||||
char *method; /* GET, HEAD, POST, etc. */
|
||||
int method_number; /* M_GET, M_POST, etc. */
|
||||
int allowed; /* Allowed methods - for 405, OPTIONS, etc */
|
||||
|
||||
int sent_bodyct; /* byte count in stream is for body */
|
||||
long bytes_sent; /* body byte count, for easy access */
|
||||
|
||||
/* HTTP/1.1 connection-level features */
|
||||
|
||||
int chunked; /* sending chunked transfer-coding */
|
||||
int byterange; /* number of byte ranges */
|
||||
char *boundary; /* multipart/byteranges boundary */
|
||||
char *range; /* The Range: header */
|
||||
long clength; /* The "real" content length */
|
||||
|
||||
long remaining; /* bytes left to read */
|
||||
long read_length; /* bytes that have been read */
|
||||
int read_body; /* how the request body should be read */
|
||||
int read_chunked; /* reading chunked transfer-coding */
|
||||
|
||||
/* MIME header environments, in and out. Also, an array containing
|
||||
* environment variables to be passed to subprocesses, so people can
|
||||
* write modules to add to that environment.
|
||||
*
|
||||
* The difference between headers_out and err_headers_out is that the
|
||||
* latter are printed even on error, and persist across internal redirects
|
||||
* (so the headers printed for ErrorDocument handlers will have them).
|
||||
*
|
||||
* The 'notes' table is for notes from one module to another, with no
|
||||
* other set purpose in mind...
|
||||
*/
|
||||
|
||||
table *headers_in;
|
||||
table *headers_out;
|
||||
table *err_headers_out;
|
||||
table *subprocess_env;
|
||||
table *notes;
|
||||
|
||||
char *content_type; /* Break these out --- we dispatch on 'em */
|
||||
char *handler; /* What we *really* dispatch on */
|
||||
|
||||
char *content_encoding;
|
||||
char *content_language; /* for back-compat. only -- do not use */
|
||||
array_header *content_languages; /* array of (char*) */
|
||||
|
||||
int no_cache;
|
||||
int no_local_copy;
|
||||
|
||||
/* What object is being requested (either directly, or via include
|
||||
* or content-negotiation mapping).
|
||||
*/
|
||||
|
||||
char *uri; /* complete URI for a proxy req, or
|
||||
* URL path for a non-proxy req */
|
||||
char *filename;
|
||||
char *path_info;
|
||||
char *args; /* QUERY_ARGS, if any */
|
||||
struct stat finfo; /* ST_MODE set to zero if no such file */
|
||||
|
||||
/* Various other config info which may change with .htaccess files
|
||||
* These are config vectors, with one void* pointer for each module
|
||||
* (the thing pointed to being the module's business).
|
||||
*/
|
||||
|
||||
void *per_dir_config; /* Options set in config files, etc. */
|
||||
void *request_config; /* Notes on *this* request */
|
||||
|
||||
/*
|
||||
* a linked list of the configuration directives in the .htaccess files
|
||||
* accessed by this request.
|
||||
* N.B. always add to the head of the list, _never_ to the end.
|
||||
* that way, a sub request's list can (temporarily) point to a parent's list
|
||||
*/
|
||||
const struct htaccess_result *htaccess;
|
||||
};
|
||||
|
||||
|
||||
/* Things which are per connection
|
||||
*/
|
||||
|
||||
struct conn_rec {
|
||||
|
||||
pool *pool;
|
||||
server_rec *server;
|
||||
server_rec *base_server; /* Physical vhost this conn come in on */
|
||||
|
||||
/* Information about the connection itself */
|
||||
|
||||
int child_num; /* The number of the child handling conn_rec */
|
||||
BUFF *client; /* Connetion to the guy */
|
||||
int aborted; /* Are we still talking? */
|
||||
|
||||
/* Who is the client? */
|
||||
|
||||
struct sockaddr_in local_addr; /* local address */
|
||||
struct sockaddr_in remote_addr; /* remote address */
|
||||
char *remote_ip; /* Client's IP address */
|
||||
char *remote_host; /* Client's DNS name, if known.
|
||||
* NULL if DNS hasn't been checked,
|
||||
* "" if it has and no address was found.
|
||||
* N.B. Only access this though
|
||||
* get_remote_host() */
|
||||
char *remote_logname; /* Only ever set if doing rfc1413 lookups.
|
||||
* N.B. Only access this through
|
||||
* get_remote_logname() */
|
||||
char *user; /* If an authentication check was made,
|
||||
* this gets set to the user name. We assume
|
||||
* that there's only one user per connection(!)
|
||||
*/
|
||||
char *auth_type; /* Ditto. */
|
||||
|
||||
int keepalive; /* Are we using HTTP Keep-Alive? */
|
||||
int keptalive; /* Did we use HTTP Keep-Alive? */
|
||||
int keepalives; /* How many times have we used it? */
|
||||
};
|
||||
|
||||
/* Per-vhost config... */
|
||||
|
||||
/* The address 255.255.255.255, when used as a virtualhost address,
|
||||
* will become the "default" server when the ip doesn't match other vhosts.
|
||||
*/
|
||||
#define DEFAULT_VHOST_ADDR 0xfffffffful
|
||||
|
||||
typedef struct server_addr_rec server_addr_rec;
|
||||
struct server_addr_rec {
|
||||
server_addr_rec *next;
|
||||
struct in_addr host_addr; /* The bound address, for this server */
|
||||
unsigned short host_port; /* The bound port, for this server */
|
||||
char *virthost; /* The name given in <VirtualHost> */
|
||||
};
|
||||
|
||||
|
||||
struct server_rec {
|
||||
|
||||
server_rec *next;
|
||||
|
||||
/* Full locations of server config info */
|
||||
|
||||
char *srm_confname;
|
||||
char *access_confname;
|
||||
|
||||
/* Contact information */
|
||||
|
||||
char *server_admin;
|
||||
char *server_hostname;
|
||||
unsigned short port; /* for redirects, etc. */
|
||||
|
||||
/* Log files --- note that transfer log is now in the modules... */
|
||||
|
||||
char *error_fname;
|
||||
FILE *error_log;
|
||||
|
||||
/* Module-specific configuration for server, and defaults... */
|
||||
|
||||
int is_virtual; /* true if this is the virtual server */
|
||||
void *module_config; /* Config vector containing pointers to
|
||||
* modules' per-server config structures.
|
||||
*/
|
||||
void *lookup_defaults; /* MIME type info, etc., before we start
|
||||
* checking per-directory info.
|
||||
*/
|
||||
/* Transaction handling */
|
||||
|
||||
server_addr_rec *addrs;
|
||||
int timeout; /* Timeout, in seconds, before we give up */
|
||||
int keep_alive_timeout; /* Seconds we'll wait for another request */
|
||||
int keep_alive_max; /* Maximum requests per connection */
|
||||
int keep_alive; /* Use persistent connections? */
|
||||
int send_buffer_size; /* size of TCP send buffer (in bytes) */
|
||||
|
||||
char *path; /* Pathname for ServerPath */
|
||||
int pathlen; /* Length of path */
|
||||
|
||||
char *names; /* Wildcarded names for ServerAlias servers */
|
||||
|
||||
uid_t server_uid; /* effective user id when calling exec wrapper */
|
||||
gid_t server_gid; /* effective group id when calling exec wrapper */
|
||||
};
|
||||
|
||||
/* These are more like real hosts than virtual hosts */
|
||||
struct listen_rec {
|
||||
listen_rec *next;
|
||||
struct sockaddr_in local_addr; /* local IP address and port */
|
||||
int fd;
|
||||
int used; /* Only used during restart */
|
||||
/* more stuff here, like which protocol is bound to the port */
|
||||
};
|
||||
|
||||
/* Prototypes for utilities... util.c.
|
||||
*/
|
||||
|
||||
/* Time */
|
||||
extern const char month_snames[12][4];
|
||||
|
||||
struct tm *get_gmtoff(int *tz);
|
||||
char *get_time();
|
||||
char *ht_time(pool * p, time_t t, const char *fmt, int gmt);
|
||||
char *gm_timestr_822(pool * p, time_t t);
|
||||
|
||||
/* String handling. The *_nc variants allow you to use non-const char **s as
|
||||
arguments (unfortunately C won't automatically convert a char ** to a const
|
||||
char **) */
|
||||
|
||||
char *getword(pool * p, const char **line, char stop);
|
||||
char *getword_nc(pool * p, char **line, char stop);
|
||||
char *getword_white(pool * p, const char **line);
|
||||
char *getword_white_nc(pool * p, char **line);
|
||||
char *getword_nulls(pool * p, const char **line, char stop);
|
||||
char *getword_nulls_nc(pool * p, char **line, char stop);
|
||||
char *getword_conf(pool * p, const char **line);
|
||||
char *getword_conf_nc(pool * p, char **line);
|
||||
|
||||
char *get_token(pool * p, char **accept_line, int accept_white);
|
||||
int find_token(pool * p, const char *line, const char *tok);
|
||||
int find_last_token(pool * p, const char *line, const char *tok);
|
||||
|
||||
int is_url(const char *u);
|
||||
extern int unescape_url(char *url);
|
||||
void no2slash(char *name);
|
||||
void getparents(char *name);
|
||||
char *escape_path_segment(pool * p, const char *s);
|
||||
char *os_escape_path(pool * p, const char *path, int partial);
|
||||
#define escape_uri(ppool,path) os_escape_path(ppool,path,1)
|
||||
extern char *escape_html(pool * p, const char *s);
|
||||
char *construct_server(pool * p, const char *hostname, unsigned port);
|
||||
char *construct_url(pool * p, const char *path, const server_rec * s);
|
||||
char *escape_shell_cmd(pool * p, const char *s);
|
||||
|
||||
int count_dirs(const char *path);
|
||||
char *make_dirstr(pool * a, const char *s, int n);
|
||||
char *make_full_path(pool * a, const char *dir, const char *f);
|
||||
|
||||
int is_matchexp(const char *str);
|
||||
int strcmp_match(const char *str, const char *exp);
|
||||
int strcasecmp_match(const char *str, const char *exp);
|
||||
char *uudecode(pool *, const char *);
|
||||
|
||||
char *pregsub(pool * p, const char *input, const char *source, size_t nmatch,
|
||||
regmatch_t pmatch[]);
|
||||
|
||||
void str_tolower(char *);
|
||||
int ind(const char *, char); /* Sigh... */
|
||||
int rind(const char *, char);
|
||||
|
||||
int cfg_getline(char *s, int n, FILE * f);
|
||||
|
||||
#ifdef NEED_STRERROR
|
||||
char *strerror(int err);
|
||||
#endif
|
||||
|
||||
/* Misc system hackery */
|
||||
|
||||
uid_t uname2id(const char *name);
|
||||
gid_t gname2id(const char *name);
|
||||
int is_directory(const char *name);
|
||||
int can_exec(const struct stat *);
|
||||
void chdir_file(const char *file);
|
||||
|
||||
char *get_local_host(pool *);
|
||||
unsigned long get_virthost_addr(const char *hostname, unsigned short *port);
|
||||
|
||||
extern time_t restart_time;
|
||||
|
||||
/*
|
||||
* Apache tries to keep all of its long term filehandles (such as log files,
|
||||
* and sockets) above this number. This is to workaround problems in many
|
||||
* third party libraries that are compiled with a small FD_SETSIZE. There
|
||||
* should be no reason to lower this, because it's only advisory. If a file
|
||||
* can't be allocated above this number then it will remain in the "slack"
|
||||
* area.
|
||||
*
|
||||
* Only the low slack line is used by default. If HIGH_SLACK_LINE is defined
|
||||
* then an attempt is also made to keep all non-FILE * files above the high
|
||||
* slack line. This is to work around a Solaris C library limitation, where it
|
||||
* uses an unsigned char to store the file descriptor.
|
||||
*/
|
||||
#ifndef LOW_SLACK_LINE
|
||||
#define LOW_SLACK_LINE 15
|
||||
#endif
|
||||
/* #define HIGH_SLACK_LINE 255 */
|
||||
|
||||
/*
|
||||
* The ap_slack() function takes a fd, and tries to move it above the indicated
|
||||
* line. It returns an fd which may or may not have moved above the line, and
|
||||
* never fails. If the high line was requested and it fails it will also try
|
||||
* the low line.
|
||||
*/
|
||||
int ap_slack(int fd, int line);
|
||||
#define AP_SLACK_LOW 1
|
||||
#define AP_SLACK_HIGH 2
|
2581
src/afsweb/nsafs.c
2581
src/afsweb/nsafs.c
File diff suppressed because it is too large
Load Diff
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* COMPONENT_NAME: Delite Gateway
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NSAFS_H_
|
||||
#define _NSAFS_H_
|
||||
|
||||
/*
|
||||
* SHA is defined to work on unsigned 32 bit integers.
|
||||
* These values should therefore not change.
|
||||
*/
|
||||
typedef afs_uint32 sha_int;
|
||||
|
||||
#define SHA_BITS_PER_INT 32
|
||||
#define SHA_CHUNK_BITS 512
|
||||
#define SHA_CHUNK_BYTES 64
|
||||
#define SHA_CHUNK_INTS 16
|
||||
#define SHA_HASH_BITS 160
|
||||
#define SHA_HASH_BYTES 20
|
||||
#define SHA_HASH_INTS 5
|
||||
#define SHA_ROUNDS 80
|
||||
|
||||
|
||||
typedef struct shaState {
|
||||
sha_int digest[SHA_HASH_INTS];
|
||||
sha_int bitcountLo;
|
||||
sha_int bitcountHi;
|
||||
sha_int leftoverLen;
|
||||
char leftover[SHA_CHUNK_BYTES];
|
||||
} shaState;
|
||||
|
||||
|
||||
void sha_clear(shaState * shaStateP);
|
||||
void sha_update(shaState * shaStateP, const char *buffer, int bufferLen);
|
||||
void sha_finish(shaState * shaStateP);
|
||||
void sha_hash(shaState * shaStateP, const char *buffer, int bufferLen);
|
||||
void sha_bytes(const shaState * shaStateP, char *bytes);
|
||||
|
||||
extern afs_int32 nsafs_SetToken(struct ktc_principal *aserver,
|
||||
struct ktc_token *atoken,
|
||||
struct ktc_principal *aclient,
|
||||
afs_int32 flags);
|
||||
|
||||
#endif /* _NSAFS_H_ */
|
@ -1,293 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* COMPONENT_NAME: nsafs
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module implements the Secure Hash Algorithm (SHA) as specified in
|
||||
* the Secure Hash Standard (SHS, FIPS PUB 180.1).
|
||||
*/
|
||||
|
||||
#include <afsconfig.h>
|
||||
#include "afs/param.h"
|
||||
|
||||
|
||||
#include "afs/sysincludes.h" /* Standard vendor system headers */
|
||||
#include <net/if.h>
|
||||
#include "afsincludes.h" /* Afs-based standard headers */
|
||||
#include "afs/afs_stats.h"
|
||||
#include "afs/auth.h"
|
||||
#include "afs/cellconfig.h"
|
||||
#include "afs/vice.h"
|
||||
#include "afs/nsafs.h"
|
||||
|
||||
static int big_endian;
|
||||
|
||||
static const sha_int hashinit[] = {
|
||||
0x67452301, 0xEFCDAB89, 0x98BADCFE,
|
||||
0x10325476, 0xC3D2E1F0
|
||||
};
|
||||
|
||||
#define ROTL(n, x) (((x) << (n)) | ((x) >> (SHA_BITS_PER_INT - (n))))
|
||||
|
||||
#ifdef DISABLED_CODE_HERE
|
||||
static sha_int
|
||||
f(int t, sha_int x, sha_int y, sha_int z)
|
||||
{
|
||||
if (t < 0 || t >= SHA_ROUNDS)
|
||||
return 0;
|
||||
if (t < 20)
|
||||
return (z ^ (x & (y ^ z)));
|
||||
if (t < 40)
|
||||
return (x ^ y ^ z);
|
||||
if (t < 60)
|
||||
return ((x & y) | (z & (x | y))); /* saves 1 boolean op */
|
||||
return (x ^ y ^ z); /* 60-79 same as 40-59 */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This is the "magic" function used for each round. */
|
||||
/* Were this a C function, the interface would be: */
|
||||
/* static sha_int f(int t, sha_int x, sha_int y, sha_int z) */
|
||||
/* The function call version preserved above until stable */
|
||||
|
||||
#define f_a(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define f_b(x, y, z) (x ^ y ^ z)
|
||||
#define f_c(x, y, z) (( (x & y) | (z & (x | y))))
|
||||
|
||||
#define f(t, x, y, z) \
|
||||
( (t < 0 || t >= SHA_ROUNDS) ? 0 : \
|
||||
( (t < 20) ? f_a(x, y, z) : \
|
||||
( (t < 40) ? f_b(x, y, z) : \
|
||||
( (t < 60) ? f_c(x, y, z) : f_b(x, y, z)))))
|
||||
|
||||
/*
|
||||
*static sha_int K(int t)
|
||||
*{
|
||||
* if (t < 0 || t >= SHA_ROUNDS) return 0;
|
||||
* if (t < 20)
|
||||
* return 0x5A827999;
|
||||
* if (t < 40)
|
||||
* return 0x6ED9EBA1;
|
||||
* if (t < 60)
|
||||
* return 0x8F1BBCDC;
|
||||
* return 0xCA62C1D6;
|
||||
* }
|
||||
*/
|
||||
|
||||
/* This macro/function supplies the "magic" constant for each round. */
|
||||
/* The function call version preserved above until stable */
|
||||
|
||||
static const sha_int k_vals[] =
|
||||
{ 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 };
|
||||
|
||||
#define K(t) ( (t < 0 || t >= SHA_ROUNDS) ? 0 : k_vals[ t/20 ] )
|
||||
|
||||
/*
|
||||
* Update the internal state based on the given chunk.
|
||||
*/
|
||||
static void
|
||||
transform(shaState * shaStateP, sha_int * chunk)
|
||||
{
|
||||
sha_int A = shaStateP->digest[0];
|
||||
sha_int B = shaStateP->digest[1];
|
||||
sha_int C = shaStateP->digest[2];
|
||||
sha_int D = shaStateP->digest[3];
|
||||
sha_int E = shaStateP->digest[4];
|
||||
sha_int TEMP = 0;
|
||||
|
||||
int t;
|
||||
sha_int W[SHA_ROUNDS];
|
||||
|
||||
for (t = 0; t < SHA_CHUNK_INTS; t++)
|
||||
W[t] = chunk[t];
|
||||
for (; t < SHA_ROUNDS; t++) {
|
||||
TEMP = W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16];
|
||||
W[t] = ROTL(1, TEMP);
|
||||
}
|
||||
|
||||
for (t = 0; t < SHA_ROUNDS; t++) {
|
||||
TEMP = ROTL(5, A) + f(t, B, C, D) + E + W[t] + K(t);
|
||||
E = D;
|
||||
D = C;
|
||||
C = ROTL(30, B);
|
||||
B = A;
|
||||
A = TEMP;
|
||||
}
|
||||
|
||||
shaStateP->digest[0] += A;
|
||||
shaStateP->digest[1] += B;
|
||||
shaStateP->digest[2] += C;
|
||||
shaStateP->digest[3] += D;
|
||||
shaStateP->digest[4] += E;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function takes an array of SHA_CHUNK_BYTES bytes
|
||||
* as input and produces an output array of ints that is
|
||||
* SHA_CHUNK_INTS long.
|
||||
*/
|
||||
static void
|
||||
buildInts(const char *data, sha_int * chunk)
|
||||
{
|
||||
/*
|
||||
* Need to copy the data because we can't be certain that
|
||||
* the input buffer will be aligned correctly.
|
||||
*/
|
||||
memcpy((void *)chunk, (void *)data, SHA_CHUNK_BYTES);
|
||||
|
||||
if (!big_endian) {
|
||||
/* This loop does nothing but waste time on a big endian machine. */
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SHA_CHUNK_INTS; i++)
|
||||
chunk[i] = ntohl(chunk[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This function updates the internal state of the hash by using
|
||||
* buildInts to break the input up into chunks and repeatedly passing
|
||||
* these chunks to transform().
|
||||
*/
|
||||
void
|
||||
sha_update(shaState * shaStateP, const char *buffer, int bufferLen)
|
||||
{
|
||||
int i;
|
||||
sha_int chunk[SHA_CHUNK_INTS];
|
||||
sha_int newLo;
|
||||
|
||||
if (buffer == NULL || bufferLen == 0)
|
||||
return;
|
||||
|
||||
newLo = shaStateP->bitcountLo + (bufferLen << 3);
|
||||
if (newLo < shaStateP->bitcountLo)
|
||||
shaStateP->bitcountHi++;
|
||||
shaStateP->bitcountLo = newLo;
|
||||
shaStateP->bitcountHi += ((bufferLen >> (SHA_BITS_PER_INT - 3)) & 0x07);
|
||||
|
||||
/*
|
||||
* If we won't have enough for a full chunk, just tack this
|
||||
* buffer onto the leftover piece and return.
|
||||
*/
|
||||
if (shaStateP->leftoverLen + bufferLen < SHA_CHUNK_BYTES) {
|
||||
memcpy((void *)&(shaStateP->leftover[shaStateP->leftoverLen]),
|
||||
(void *)buffer, bufferLen);
|
||||
shaStateP->leftoverLen += bufferLen;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we have a leftover chunk, process it first. */
|
||||
if (shaStateP->leftoverLen > 0) {
|
||||
i = (SHA_CHUNK_BYTES - shaStateP->leftoverLen);
|
||||
memcpy((void *)&(shaStateP->leftover[shaStateP->leftoverLen]),
|
||||
(void *)buffer, i);
|
||||
buffer += i;
|
||||
bufferLen -= i;
|
||||
buildInts(shaStateP->leftover, chunk);
|
||||
shaStateP->leftoverLen = 0;
|
||||
transform(shaStateP, chunk);
|
||||
}
|
||||
|
||||
while (bufferLen >= SHA_CHUNK_BYTES) {
|
||||
buildInts(buffer, chunk);
|
||||
transform(shaStateP, chunk);
|
||||
buffer += SHA_CHUNK_BYTES;
|
||||
bufferLen -= SHA_CHUNK_BYTES;
|
||||
}
|
||||
assert((bufferLen >= 0) && (bufferLen < SHA_CHUNK_BYTES));
|
||||
|
||||
if (bufferLen > 0) {
|
||||
memcpy((void *)&shaStateP->leftover[0], (void *)buffer, bufferLen);
|
||||
shaStateP->leftoverLen = bufferLen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This method updates the internal state of the hash using
|
||||
* any leftover data plus appropriate padding and incorporation
|
||||
* of the hash bitcount to finish the hash. The hash value
|
||||
* is not valid until finish() has been called.
|
||||
*/
|
||||
void
|
||||
sha_finish(shaState * shaStateP)
|
||||
{
|
||||
sha_int chunk[SHA_CHUNK_INTS];
|
||||
int i;
|
||||
|
||||
if (shaStateP->leftoverLen > (SHA_CHUNK_BYTES - 9)) {
|
||||
shaStateP->leftover[shaStateP->leftoverLen++] = 0x80;
|
||||
memset(&(shaStateP->leftover[shaStateP->leftoverLen]), 0,
|
||||
(SHA_CHUNK_BYTES - shaStateP->leftoverLen));
|
||||
buildInts(shaStateP->leftover, chunk);
|
||||
transform(shaStateP, chunk);
|
||||
memset(chunk, 0, SHA_CHUNK_BYTES);
|
||||
} else {
|
||||
shaStateP->leftover[shaStateP->leftoverLen++] = 0x80;
|
||||
memset(&(shaStateP->leftover[shaStateP->leftoverLen]), 0,
|
||||
(SHA_CHUNK_BYTES - shaStateP->leftoverLen));
|
||||
buildInts(shaStateP->leftover, chunk);
|
||||
}
|
||||
shaStateP->leftoverLen = 0;
|
||||
|
||||
chunk[SHA_CHUNK_INTS - 2] = shaStateP->bitcountHi;
|
||||
chunk[SHA_CHUNK_INTS - 1] = shaStateP->bitcountLo;
|
||||
transform(shaStateP, chunk);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the hash to its "magic" initial value specified by the
|
||||
* SHS standard, and clear out the bitcount and leftover vars.
|
||||
* This should be used to initialize an shaState.
|
||||
*/
|
||||
void
|
||||
sha_clear(shaState * shaStateP)
|
||||
{
|
||||
big_endian = (0x01020304 == htonl(0x01020304));
|
||||
|
||||
memcpy((void *)&shaStateP->digest[0], (void *)&hashinit[0],
|
||||
SHA_HASH_BYTES);
|
||||
shaStateP->bitcountLo = shaStateP->bitcountHi = 0;
|
||||
shaStateP->leftoverLen = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Hash the buffer and place the result in *shaStateP.
|
||||
*/
|
||||
void
|
||||
sha_hash(shaState * shaStateP, const char *buffer, int bufferLen)
|
||||
{
|
||||
sha_clear(shaStateP);
|
||||
sha_update(shaStateP, buffer, bufferLen);
|
||||
sha_finish(shaStateP);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the current state of the hash as an array of 20 bytes.
|
||||
* This will be an interim result if finish() has not yet been called.
|
||||
*/
|
||||
void
|
||||
sha_bytes(const shaState * shaStateP, char *bytes)
|
||||
{
|
||||
sha_int temp[SHA_HASH_INTS];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SHA_HASH_INTS; i++)
|
||||
temp[i] = htonl(shaStateP->digest[i]);
|
||||
memcpy(bytes, (void *)&temp[0], SHA_HASH_BYTES);
|
||||
}
|
@ -1,518 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* Implements the weblog binary which links with the AFS libraries and acts
|
||||
* as the server for authenticating users for apache access to AFS. Code
|
||||
* structure is based on klog.c. The communication with clients is done
|
||||
* via pipes whose file descriptors are passed as command line arguments
|
||||
* thus making it necessary for a common parent to start this process and
|
||||
* the processes that will communicate with it for them to inherit the
|
||||
* pipes. Also passed as a command line argument is a Silent flag (like klog)
|
||||
* and a cache expiration flag which allows cache expiration times for
|
||||
* tokens to be set for testing purposes
|
||||
*/
|
||||
|
||||
|
||||
/* These two needed for rxgen output to work */
|
||||
#include <afsconfig.h>
|
||||
#include <afs/param.h>
|
||||
|
||||
|
||||
#include <afs/stds.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/errno.h>
|
||||
#include <rx/xdr.h>
|
||||
|
||||
#ifdef AFS_AIX32_ENV
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <lock.h>
|
||||
#include <ubik.h>
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <afs/com_err.h>
|
||||
#include <afs/auth.h>
|
||||
#include <afs/cellconfig.h>
|
||||
#include <afs/cmd.h>
|
||||
|
||||
#include "weblog_errors.h"
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(A,B) ((A)>(B)?(A):(B))
|
||||
#endif /* !MAX */
|
||||
#ifndef MIN
|
||||
#define MIN(A,B) ((A)<(B)?(A):(B))
|
||||
#endif /* !MAX */
|
||||
|
||||
#include "apache_afs_utils.h"
|
||||
|
||||
#define MAXBUFF 1024
|
||||
|
||||
/* For caching */
|
||||
#include "apache_afs_cache.h"
|
||||
|
||||
/* the actual function that does all the work! */
|
||||
int CommandProc();
|
||||
|
||||
static int zero_argc;
|
||||
static char **zero_argv;
|
||||
|
||||
/* pipes used for communicating with web server */
|
||||
/* these are passed as command line args - defaults to stdin/stdout */
|
||||
|
||||
static int readPipe;
|
||||
static int writePipe;
|
||||
|
||||
/*
|
||||
* now I know why this was necessary! - it's a hokie thing -
|
||||
* the call to ka_UserAuthenticateGeneral doesn't compile otherwise
|
||||
*/
|
||||
int
|
||||
osi_audit()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct cmd_syndesc *ts;
|
||||
afs_int32 code;
|
||||
|
||||
#ifdef AFS_AIX32_ENV
|
||||
/*
|
||||
* The following signal action for AIX is necessary so that in case of a
|
||||
* crash (i.e. core is generated) we can include the user's data section
|
||||
* in the core dump. Unfortunately, by default, only a partial core is
|
||||
* generated which, in many cases, isn't too useful.
|
||||
*/
|
||||
struct sigaction nsa;
|
||||
|
||||
sigemptyset(&nsa.sa_mask);
|
||||
nsa.sa_handler = SIG_DFL;
|
||||
nsa.sa_flags = SA_FULLDUMP;
|
||||
sigaction(SIGABRT, &nsa, NULL);
|
||||
sigaction(SIGSEGV, &nsa, NULL);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* we ignore SIGPIPE so that EPIPE is returned if there is no one reading
|
||||
* data being written to the pipe
|
||||
*/
|
||||
|
||||
#ifdef AIX
|
||||
/* TODO - for AIX? */
|
||||
#else
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &sa, NULL);
|
||||
#endif
|
||||
|
||||
zero_argc = argc;
|
||||
zero_argv = argv;
|
||||
|
||||
ts = cmd_CreateSyntax(NULL, CommandProc, NULL, 0,
|
||||
"obtain Kerberos authentication for web servers");
|
||||
|
||||
/* define the command line arguments */
|
||||
#define aREADPIPE 0
|
||||
#define aWRITEPIPE 1
|
||||
#define aCACHEEXPIRATION 2
|
||||
#define aTOKENEXPIRATION 3
|
||||
#define aSILENT 4
|
||||
|
||||
cmd_AddParm(ts, "-readPipe", CMD_SINGLE, CMD_OPTIONAL, "inPipefd");
|
||||
cmd_AddParm(ts, "-writePipe", CMD_SINGLE, CMD_OPTIONAL, "outPipefd");
|
||||
cmd_AddParm(ts, "-cacheExpiration", CMD_SINGLE, CMD_OPTIONAL,
|
||||
"local cache expiration times for tokens");
|
||||
cmd_AddParm(ts, "-tokenExpiration", CMD_SINGLE, CMD_OPTIONAL,
|
||||
"cache manager expiration time for tokens");
|
||||
cmd_AddParm(ts, "-silent", CMD_FLAG, CMD_OPTIONAL, "silent operation");
|
||||
|
||||
code = cmd_Dispatch(argc, argv);
|
||||
|
||||
WEBLOGEXIT(code);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* send a buffer over the pipe
|
||||
*/
|
||||
static int
|
||||
sendToken(int len, void *buf)
|
||||
{
|
||||
if (buf == NULL) {
|
||||
WEBLOGEXIT(NULLARGSERROR);
|
||||
}
|
||||
if (write(writePipe, buf, len) != len) {
|
||||
#ifdef DEBUG
|
||||
perror("weblog: write to pipe error");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* read the incoming buffer from the pipe
|
||||
*/
|
||||
|
||||
static int
|
||||
readFromClient(char *buf)
|
||||
{
|
||||
int n;
|
||||
if (buf == NULL) {
|
||||
WEBLOGEXIT(NULLARGSERROR);
|
||||
}
|
||||
n = read(readPipe, buf, MAXBUFF);
|
||||
if (n < 0) {
|
||||
#ifdef DEBUG
|
||||
perror("weblog: pipe read error");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
if (n == 0) {
|
||||
#ifdef DEBUG
|
||||
perror("weblog: zero bytes read from pipe");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* copies the string spereated by the sep into retbuf and returns the position
|
||||
* from the beginning of the string that this string ends at so you can call
|
||||
* it againword seperated by the sep character and give that value as th start
|
||||
* parameter - used to parse incoming buffer from clients over the pipe
|
||||
*/
|
||||
/*
|
||||
* NOTE - the space seperated credentials failed for passwds with spaces, thus
|
||||
* we use newline for seperators instead
|
||||
*/
|
||||
static int
|
||||
getNullSepWord(char *buf, char sep, char *retBuf, int start)
|
||||
{
|
||||
int ret = 0;
|
||||
int len = strlen(buf) - start;
|
||||
|
||||
/* error checks */
|
||||
if ((buf == NULL) || (retBuf == NULL) || (start < 0)) {
|
||||
fprintf(stderr, "weblog (getWordSep):NULL args\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((buf[start] != sep) && (ret <= len)) {
|
||||
retBuf[ret] = buf[start];
|
||||
ret++;
|
||||
start++;
|
||||
}
|
||||
retBuf[ret] = '\0';
|
||||
return (ret + 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* parses the NEWLINE seperated buffer giving the username, passwd and cell
|
||||
* coming over the pipe from the clients and sets the variables accordingly
|
||||
*/
|
||||
static int
|
||||
parseBuf(char *buf, char *user, char *pass, char *cell, char *type)
|
||||
{
|
||||
char *temp;
|
||||
int start = 0, ret = 0;
|
||||
|
||||
if ((buf == NULL) || (user == NULL) || (pass == NULL) || (cell == NULL)
|
||||
|| (type == NULL)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "afs_Authenticator:parseBuf-an arg was NULL\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
if ((ret = getNullSepWord(buf, '\n', type, start)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
start += ret;
|
||||
if ((ret = getNullSepWord(buf, '\n', user, start)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
start += ret;
|
||||
if ((ret = getNullSepWord(buf, '\n', cell, start)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
start += ret;
|
||||
if ((ret = getNullSepWord(buf, '\n', pass, start)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Discard any authentication information held in trust by the Cache Manager
|
||||
* for the calling process and all other processes in the same PAG
|
||||
*/
|
||||
static int
|
||||
unlog()
|
||||
{
|
||||
return do_pioctl(NULL, 0, NULL, 0, VIOCUNPAG, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
/* we can obtain a PAG by calling this system call */
|
||||
static int
|
||||
makeNewPAG()
|
||||
{
|
||||
return do_setpag();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The main procedure that waits in an infinite loop for data to
|
||||
* arrive through a pipe from the httpds, authenticates the user and
|
||||
* returns a token (or a failure message) over the pipe
|
||||
*/
|
||||
static int
|
||||
CommandProc(struct cmd_syndesc *as, void *arock)
|
||||
{
|
||||
char name[MAXKTCNAMELEN];
|
||||
char cell[MAXKTCREALMLEN];
|
||||
char passwd[BUFSIZ];
|
||||
/* All the constant sizes for these arrays are taken from the code for klog */
|
||||
|
||||
char cksum[SHA_HASH_BYTES]; /* for sha checksum for caching */
|
||||
afs_int32 expires = 0; /* for cache expiration */
|
||||
afs_int32 cacheExpiration = 0; /* configurable cmd line parameter */
|
||||
afs_int32 testExpires = 0; /* cacheExpiration + current time */
|
||||
|
||||
int authtype = 0; /* AFS or AFS-DFS Authentication */
|
||||
int code;
|
||||
int shutdown = 0; /* on getting shutdown from the pipe we GO */
|
||||
int gotToken = 0; /* did we get a token from the cache manager */
|
||||
afs_int32 i = 0; /* for getting primary token held by CM */
|
||||
int dosetpag = 1; /* not used */
|
||||
Date lifetime; /* requested ticket lifetime */
|
||||
char tbuffer[MAXBUFF]; /* for pioctl ops + pipe transfers */
|
||||
static char rn[] = "weblog"; /* Routine name */
|
||||
static int Silent = 0; /* Don't want error messages */
|
||||
afs_int32 password_expires = -1;
|
||||
char *reason; /* string describing errors */
|
||||
char type[10]; /* authentication type AFS or DFS */
|
||||
|
||||
/* blow away command line arguments */
|
||||
for (i = 1; i < zero_argc; i++)
|
||||
memset(zero_argv[i], 0, strlen(zero_argv[i]));
|
||||
zero_argc = 0;
|
||||
|
||||
/* first determine quiet flag based on -silent switch */
|
||||
Silent = (as->parms[aSILENT].items ? 1 : 0);
|
||||
|
||||
code = ka_Init(0);
|
||||
if (code) {
|
||||
if (!Silent) {
|
||||
fprintf(stderr, "%s:ka_Init FAILED\n", rn);
|
||||
}
|
||||
WEBLOGEXIT(KAERROR);
|
||||
}
|
||||
|
||||
/* Parse our arguments. */
|
||||
if (as->parms[aREADPIPE].items)
|
||||
/* there is a file descriptor instead of stdin */
|
||||
readPipe = atoi(as->parms[aREADPIPE].items->data);
|
||||
else
|
||||
readPipe = stdin;
|
||||
|
||||
if (as->parms[aWRITEPIPE].items)
|
||||
/* there is a file descriptor instead of stdout */
|
||||
writePipe = atoi(as->parms[aWRITEPIPE].items->data);
|
||||
else
|
||||
writePipe = stdout;
|
||||
|
||||
if (as->parms[aCACHEEXPIRATION].items)
|
||||
/* set configurable cache expiration time */
|
||||
cacheExpiration = atoi(as->parms[aCACHEEXPIRATION].items->data);
|
||||
|
||||
if (as->parms[aTOKENEXPIRATION].items)
|
||||
/* set configurable token lifetime */
|
||||
lifetime = atoi(as->parms[aTOKENEXPIRATION].items->data);
|
||||
|
||||
/*
|
||||
* Initialize the cache for tokens
|
||||
*/
|
||||
token_cache_init();
|
||||
|
||||
/*
|
||||
* discard any tokens held for this PAG -
|
||||
* should we create a seperate PAG for weblog first? makeNewPAG does that
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s:Before MAKENEWPAG\n", rn);
|
||||
printGroups();
|
||||
fprintf(stderr, "\nWEBLOG: before PAG:\t");
|
||||
printPAG();
|
||||
#endif
|
||||
if (makeNewPAG()) {
|
||||
fprintf(stderr, "WEBLOG: MakeNewPAG failed\n");
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "weblog:AFTER do_setpag,PAG:\t");
|
||||
printPAG();
|
||||
fprintf(stderr, "%s:After MAKENEWPAG\n", rn);
|
||||
printGroups();
|
||||
#endif
|
||||
|
||||
if (unlog()) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "WEBLOG: UNLOG FAILED\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
while (!shutdown) {
|
||||
gotToken = 0;
|
||||
code = readFromClient(tbuffer);
|
||||
if (code > 0) {
|
||||
tbuffer[code] = '\0';
|
||||
code = parseBuf(tbuffer, name, passwd, cell, type);
|
||||
if (code) {
|
||||
fprintf(stderr, "weblog: parseBuf FAILED\n");
|
||||
WEBLOGEXIT(PARSEERROR);
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%s: readFromClient FAILED:%d...exiting\n", rn,
|
||||
code);
|
||||
#endif
|
||||
WEBLOGEXIT(PIPEREADERROR);
|
||||
}
|
||||
|
||||
if (strcasecmp(type, "AFS") == 0) {
|
||||
authtype = 1;
|
||||
}
|
||||
else {
|
||||
authtype = 0;
|
||||
}
|
||||
|
||||
if (!authtype) {
|
||||
reason = (char *)malloc(sizeof(tbuffer));
|
||||
sprintf(reason, "weblog: Unknown Authentication type:%s.", type);
|
||||
goto reply_failure;
|
||||
}
|
||||
|
||||
memset((void *)&tbuffer, 0, sizeof(tbuffer));
|
||||
|
||||
/* look up local cache */
|
||||
weblog_login_checksum(name, cell, passwd, cksum);
|
||||
code = weblog_login_lookup(name, cell, cksum, &tbuffer[0]);
|
||||
|
||||
if (!code) { /* local cache lookup failed */
|
||||
/* authenticate user */
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "WEBLOG GROUPCHECK BEFORE KA_AUTH\n");
|
||||
printGroups();
|
||||
#endif
|
||||
|
||||
if (authtype == 1) {
|
||||
code =
|
||||
ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION + 0, name,
|
||||
NULL, cell, passwd, lifetime,
|
||||
&password_expires, 0, &reason);
|
||||
}
|
||||
|
||||
if (code) {
|
||||
#ifdef DEBUG
|
||||
if (!Silent) {
|
||||
fprintf(stderr,
|
||||
"weblog:Unable to authenticate to AFS because "
|
||||
"%s\n", reason);
|
||||
}
|
||||
#endif
|
||||
goto reply_failure;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"WEBLOG:After ka_UserAuthenticateGeneral GroupCheck\n");
|
||||
printGroups();
|
||||
#endif
|
||||
/* get just the ONE token for this PAG from cache manager */
|
||||
i = 0;
|
||||
memcpy((void *)&tbuffer[0], (void *)&i, sizeof(afs_int32));
|
||||
code =
|
||||
do_pioctl(tbuffer, sizeof(afs_int32), tbuffer,
|
||||
sizeof(tbuffer), VIOCGETTOK, NULL, 0);
|
||||
if (code) {
|
||||
fprintf(stderr, "weblog: failed to get token:%d\n", code);
|
||||
strcpy(reason,
|
||||
"FAILED TO GET TOKEN FROM CACHE MANAGER\n");
|
||||
} else {
|
||||
gotToken = 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
hexDump(tbuffer, sizeof(tbuffer));
|
||||
parseToken(tbuffer);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
/* put the token in local cache with the expiration date/time */
|
||||
expires = getExpiration(tbuffer);
|
||||
if (expires < 0) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Error getting expiration time\n");
|
||||
#endif
|
||||
} else {
|
||||
weblog_login_checksum(name, cell, passwd, cksum);
|
||||
if (cacheExpiration == 0) {
|
||||
weblog_login_store(name, cell, cksum, &tbuffer[0],
|
||||
sizeof(tbuffer), expires);
|
||||
} else {
|
||||
testExpires = cacheExpiration + time(NULL);
|
||||
weblog_login_store(name, cell, cksum, &tbuffer[0],
|
||||
sizeof(tbuffer), MIN(expires,
|
||||
testExpires));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* cache lookup succesful */
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "WEBLOG: Cache lookup succesful\n");
|
||||
#endif
|
||||
gotToken = 1;
|
||||
}
|
||||
|
||||
/* prepare the reply buffer with this token */
|
||||
if (!gotToken) {
|
||||
|
||||
reply_failure:
|
||||
/* respond with a reason why authentication failed */
|
||||
sprintf(tbuffer, "FAILURE:%s", reason);
|
||||
}
|
||||
|
||||
/* send response to client */
|
||||
code = sendToken(sizeof(tbuffer), tbuffer);
|
||||
if (code) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "sendToken FAILED\n");
|
||||
#endif
|
||||
WEBLOGEXIT(PIPESENDERROR);
|
||||
}
|
||||
/* unlog after every request unconditionally */
|
||||
if (unlog()) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "WEBLOG: UNLOG FAILED\n");
|
||||
#endif
|
||||
}
|
||||
} /* end - while */
|
||||
return 0;
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000, International Business Machines Corporation and others.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This software has been released under the terms of the IBM Public
|
||||
* License. For details, see the LICENSE file in the top-level source
|
||||
* directory or online at http://www.openafs.org/dl/license10.html
|
||||
*/
|
||||
|
||||
#ifndef _WEBLOG_ERRORS_H_INCLUDED_
|
||||
#define _WEBLOG_ERRORS_H_INCLUDED_
|
||||
|
||||
/* error code definitions */
|
||||
#define PIPEREAD 1
|
||||
#define PIPESEND 2
|
||||
#define KA 3
|
||||
#define PARSE 4
|
||||
#define NULLARGS 5
|
||||
#define RESTART 6
|
||||
|
||||
#define WEBLOGMINERROR ((10<<16))
|
||||
#define PIPEREADERROR (WEBLOGMINERROR + PIPEREAD)
|
||||
#define PIPESENDERROR (WEBLOGMINERROR + PIPESEND)
|
||||
#define KAERROR (WEBLOGMINERROR + KA)
|
||||
#define NULLARGSERROR (WEBLOGMINERROR + PARSE)
|
||||
#define PARSEERROR (WEBLOGMINERROR + NULLARGS)
|
||||
#define RESTARTERROR (WEBLOGMINERROR + RESTART)
|
||||
|
||||
#define PIPEREADMSG "Error reading from pipe"
|
||||
#define KAMSG "Kerberos Authentication error from ka_init"
|
||||
#define PIPESENDMSG "Error sending through pipe"
|
||||
#define PARSEMSG "Error parsing data recieved from pipe"
|
||||
#define NULLARGSMSG "Null arguments"
|
||||
#define RESTARTMSG "Error restarting"
|
||||
|
||||
|
||||
#define WEBLOGEXIT(code) \
|
||||
rx_Finalize(); \
|
||||
(!code ? exit(0) : exit((code)-WEBLOGMINERROR))
|
||||
|
||||
#endif /* _WEBLOG_ERRORS_H_INCLUDED_ */
|
Loading…
Reference in New Issue
Block a user