summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Short <zul@gentoo.org>2004-06-11 18:51:09 +0000
committerChuck Short <zul@gentoo.org>2004-06-11 18:51:09 +0000
commit1a129d0486e1064d3d5d3bd82d9cf42e6dffd782 (patch)
tree8fa37d758f9945fa7c14ae6af3d3e804cfbb903f
parentStable on alpha. (diff)
downloadhistorical-1a129d0486e1064d3d5d3bd82d9cf42e6dffd782.tar.gz
historical-1a129d0486e1064d3d5d3bd82d9cf42e6dffd782.tar.bz2
historical-1a129d0486e1064d3d5d3bd82d9cf42e6dffd782.zip
Added patch for security fix.
-rw-r--r--net-www/apache/ChangeLog12
-rw-r--r--net-www/apache/Manifest9
-rw-r--r--net-www/apache/apache-1.3.31-r2.ebuild237
-rw-r--r--net-www/apache/files/digest-apache-1.3.31-r22
-rw-r--r--net-www/apache/files/patches/1.3.31-r2/00_apache_proxy_security_fix.patch21
-rw-r--r--net-www/apache/files/patches/1.3.31-r2/00_gentoo_apachectl.patch806
-rw-r--r--net-www/apache/files/patches/1.3.31-r2/00_gentoo_base.patch786
-rw-r--r--net-www/apache/files/patches/1.3.31-r2/00_gentoo_db4_detect.patch29
-rw-r--r--net-www/apache/files/patches/1.3.31-r2/00_gentoo_suexec_pam.patch70
9 files changed, 1970 insertions, 2 deletions
diff --git a/net-www/apache/ChangeLog b/net-www/apache/ChangeLog
index 9c72782f72f9..70d9d695ccd7 100644
--- a/net-www/apache/ChangeLog
+++ b/net-www/apache/ChangeLog
@@ -1,6 +1,16 @@
# ChangeLog for net-www/apache
# Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-www/apache/ChangeLog,v 1.197 2004/06/10 22:56:54 zul Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-www/apache/ChangeLog,v 1.198 2004/06/11 18:51:08 zul Exp $
+
+*apache-1.3.31-r2 (11 Jun 2004)
+
+ 11 Jun 2004; Chuck Short <zul@gentoo.org> apache-1.3.31-r2.ebuild,
+ files/patches/1.3.31-r2/00_apache_proxy_security_fix.patch,
+ files/patches/1.3.31-r2/00_gentoo_apachectl.patch,
+ files/patches/1.3.31-r2/00_gentoo_base.patch,
+ files/patches/1.3.31-r2/00_gentoo_db4_detect.patch,
+ files/patches/1.3.31-r2/00_gentoo_suexec_pam.patch:
+ Added patch for mod_proxy security hole. Closes #53544.
09 Jun 2004; Guy Martin <gmsoft@gentoo.org> apache-1.3.31-r1.ebuild,
apache-2.0.49-r3.ebuild:
diff --git a/net-www/apache/Manifest b/net-www/apache/Manifest
index 3ea063db8340..4aab5658a156 100644
--- a/net-www/apache/Manifest
+++ b/net-www/apache/Manifest
@@ -2,15 +2,17 @@ MD5 536cd8fc6a679f4a9cc0e3cd81fe8df6 apache-2.0.49-r2.ebuild 13097
MD5 cdf590244c2432f89f430ddb4d096234 apache-1.3.29-r2.ebuild 7143
MD5 06fd1e5c0a9875c51ae41611a1b0fee9 apache-1.3.31.ebuild 6703
MD5 0db141c3deb9681139e541aa52beb768 apache-2.0.49-r1.ebuild 12686
+MD5 a827a22d7c30eef4ef9d8e50b119843c apache-1.3.31-r2.ebuild 6841
MD5 99f48c117f6f2088663e4e7660a51ae3 apache-2.0.49-r3.ebuild 12997
MD5 560a017fb276c511c94a69ffe8f1b736 apache-1.3.31-r1.ebuild 6711
-MD5 03336faeafd6e78ff9c2305825152a71 ChangeLog 35856
+MD5 42ea6ffdf58484941e015426707c226e ChangeLog 36288
MD5 5b6dd438f81019e56fa641841c0c13fe metadata.xml 501
MD5 d4b8a4908870107e15cc1edbd0ec6ebb files/apache-1.3.29_mod_auth_db.patch 729
MD5 161245c7aa1eb785db53b34d6a10be43 files/suexec_pam_gentoo.patch 2149
MD5 7be16a0103be642b354ddcba5fb4bd91 files/apache-builtin-mods 2464
MD5 589e8773eb94f785be510f74b2e39ad0 files/digest-apache-1.3.29-r2 211
MD5 7d4cec8690cb2c6406b84990d8365587 files/digest-apache-1.3.31-r1 139
+MD5 7d4cec8690cb2c6406b84990d8365587 files/digest-apache-1.3.31-r2 139
MD5 d3626a1e31a675c60d066c111d552adf files/suexec.pam 59
MD5 3a7818b24f0952694c7b878ba3d8e79a files/digest-apache-2.0.49-r1 65
MD5 3a7818b24f0952694c7b878ba3d8e79a files/digest-apache-2.0.49-r2 65
@@ -114,3 +116,8 @@ MD5 3c0dfc9f2dc93ae46eb6382cf9533f18 files/patches/1.3.31-r1/00_gentoo_base.patc
MD5 a63b9472904d3500cf72b370a9ee3200 files/patches/1.3.31-r1/00_gentoo_db4_detect.patch 1304
MD5 161245c7aa1eb785db53b34d6a10be43 files/patches/1.3.31-r1/00_gentoo_suexec_pam.patch 2149
MD5 61df284cb67dfde3085aec5543eeb03c files/patches/1.3.31-r1/00_gentoo_apachectl.patch 32836
+MD5 3c0dfc9f2dc93ae46eb6382cf9533f18 files/patches/1.3.31-r2/00_gentoo_base.patch 27799
+MD5 a63b9472904d3500cf72b370a9ee3200 files/patches/1.3.31-r2/00_gentoo_db4_detect.patch 1304
+MD5 161245c7aa1eb785db53b34d6a10be43 files/patches/1.3.31-r2/00_gentoo_suexec_pam.patch 2149
+MD5 c42fc79a9d08f38a8d8938883451f6b6 files/patches/1.3.31-r2/00_apache_proxy_security_fix.patch 790
+MD5 61df284cb67dfde3085aec5543eeb03c files/patches/1.3.31-r2/00_gentoo_apachectl.patch 32836
diff --git a/net-www/apache/apache-1.3.31-r2.ebuild b/net-www/apache/apache-1.3.31-r2.ebuild
new file mode 100644
index 000000000000..06234432edbe
--- /dev/null
+++ b/net-www/apache/apache-1.3.31-r2.ebuild
@@ -0,0 +1,237 @@
+# Copyright 1999-2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-www/apache/apache-1.3.31-r2.ebuild,v 1.1 2004/06/11 18:51:08 zul Exp $
+
+inherit eutils fixheadtails
+
+IUSE="pam"
+
+mod_ssl_ver=2.8.18
+PATCH_LEVEL="${PV}-r2"
+
+S=${WORKDIR}/${PN}_${PV}
+DESCRIPTION="The Apache Web Server"
+HOMEPAGE="http://www.apache.org http://www.modssl.org"
+KEYWORDS="~x86 ~ppc ~sparc ~alpha ~hppa ~amd64 ~ia64 ~mips"
+SRC_URI="http://www.apache.org/dist/httpd/apache_${PV}.tar.gz
+ ftp://ftp.modssl.org/source/mod_ssl-${mod_ssl_ver}-${PV}.tar.gz"
+
+# The mod_ssl archive is only for providing the EAPI patch in here.
+# You should install the net-www/mod_ssl package for the actual DSO.
+
+DEPEND="dev-lang/perl <=sys-libs/db-4.1
+ >=dev-libs/mm-1.1.3
+ >=sys-libs/gdbm-1.8
+ >=dev-libs/expat-1.95.2
+ >=sys-apps/sed-4
+ =sys-libs/db-1.85-r1"
+LICENSE="Apache-2.0"
+SLOT="1"
+
+#Standard location for Gentoo Linux
+DATADIR="/var/www/localhost"
+
+src_unpack() {
+ local myssl
+ unpack ${A} || die
+ cd ${S} || die
+
+ epatch ${FILESDIR}/patches/${PATCH_LEVEL}/00_gentoo_base.patch
+ epatch ${FILESDIR}/patches/${PATCH_LEVEL}/00_gentoo_db4_detect.patch
+ epatch ${FILESDIR}/patches/${PATCH_LEVEL}/00_gentoo_apachectl.patch
+ epatch ${FILESDIR}/patches/${PATCH_LEVEL}/00_apache_proxy_security_fix.patch
+
+ if use pam ; then
+ epatch ${FILESDIR}/patches/${PVR}/00_gentoo_suexec_pam.patch
+ fi
+
+ #Obsolete 'head -1' and 'tail -1' calls.
+ ht_fix_file src/Configure src/helpers/getuid.sh
+
+ # setup eapi...
+ myssl=${WORKDIR}/mod_ssl-${mod_ssl_ver}-${PV}
+ cp ${myssl}/pkg.eapi/*.h src/include
+ cp ${myssl}/pkg.eapi/*.c src/ap
+ epatch ${myssl}/pkg.eapi/eapi.patch || die "eapi"
+
+ # set a reasonable MM_CORE_PATH location..
+ sed -i -e 's:logs/mm:/var/cache/apache-mm/mm:' \
+ src/include/httpd.h
+}
+
+src_compile() {
+ local myconf mycflags
+ mycflags="${CFLAGS}"
+ unset CFLAGS ; unset CXXFLAGS
+
+ select_modules_config || die "determining modules"
+
+ #-DBUFFERED_LOGS
+ OPTIM="${mycflags} -DHARD_SERVER_LIMIT=${HARD_SERVER_LIMIT:=512} \
+ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" \
+ LIBS="-lgdbm -lpthread" \
+ EAPI_MM=SYSTEM \
+ ./configure \
+ --prefix=/usr \
+ --exec-prefix=/usr \
+ --bindir=/usr/bin \
+ --sbindir=/usr/sbin \
+ --libexecdir=/usr/lib/apache \
+ --mandir=/usr/share/man \
+ --sysconfdir=/etc/apache/conf \
+ --datadir=${DATADIR} \
+ --cgidir=${DATADIR}/cgi-bin \
+ --iconsdir=${DATADIR}/icons \
+ --htdocsdir=${DATADIR}/htdocs \
+ --manualdir=/usr/share/doc/${PF}/manual \
+ --includedir=/usr/include/apache \
+ --localstatedir=/var \
+ --runtimedir=/var/run \
+ --logfiledir=/var/log/apache \
+ --proxycachedir=/var/cache/apache \
+ --serverroot=/etc/apache \
+ --target=apache \
+ --server-uid=apache \
+ --server-gid=apache \
+ --with-perl=/usr/bin/perl \
+ --enable-rule=EAPI \
+ --enable-rule=SHARED_CHAIN \
+ ${MY_BUILTINS} \
+ --enable-suexec \
+ --suexec-uidmin=1000 \
+ --suexec-gidmin=100 \
+ --suexec-caller=apache \
+ --suexec-userdir=public_html \
+ --suexec-docroot=/var/www \
+ --suexec-safepath="/bin:/usr/bin" \
+ --suexec-logfile=/var/log/apache/suexec_log \
+ \
+ ${myconf} || die "bad ./configure"
+
+ emake || die "compile problem"
+}
+
+src_install() {
+ local myfile
+
+ GID=`id -g apache`
+ if [ -z "${GID}" ]; then
+ einfo "Using default GID of 81 for Apache"
+ GID=81
+ fi
+
+ make install-quiet root=${D} || die
+ dodoc ABOUT_APACHE Announcement INSTALL* LICENSE* README* WARNING* \
+ ${FILESDIR}/robots.txt
+
+ #protect the suexec binary
+ fowners root:${GID} /usr/sbin/suexec
+ fperms 4710 /usr/sbin/suexec
+
+ # nice support scripts..
+ for myfile in apacheaddmod apachedelmod \
+ apachelogserverstatus apachesplitlogfile
+ do
+ exeinto /usr/sbin
+ doexe ${FILESDIR}/$myfile
+ done
+
+ # setup links in /etc/apache..
+ cd ${D}/etc/apache
+ ln -sf ../../usr/lib/apache modules
+ # apxs needs this to pickup the right lib for install..
+ ln -sf ../../usr/lib lib
+ ln -sf ../../var/log/apache logs
+ ln -sf ../../usr/lib/apache-extramodules extramodules
+
+ # drop in a convenient link to the manual
+ dosym /usr/share/doc/${PF}/manual ${DATADIR}/htdocs/manual
+
+ # deprecated config files, empty dirs..
+ rm -f ${D}/etc/apache/conf/apache.conf.default
+ rm -f ${D}/etc/apache/conf/access.conf*
+ rm -f ${D}/etc/apache/conf/srm.conf*
+
+ # now the config files..
+ insinto /etc/apache/conf
+ doins ${FILESDIR}/conf/commonapache.conf
+ doins ${FILESDIR}/conf/apache.conf
+
+ # Added by Jason Wever <weeve@gentoo.org>
+ # A little sedfu to fix bug #7172 for sparc64s
+ if [ ${ARCH} = "sparc" ]
+ then
+ sed -i -e '15a\AcceptMutex fcntl' \
+ ${D}/etc/apache/conf/apache.conf
+ fi
+
+ insinto /etc/apache/conf/vhosts
+ doins ${FILESDIR}/conf/VirtualHomePages.conf
+ doins ${FILESDIR}/conf/DynamicVhosts.conf
+ doins ${FILESDIR}/conf/Vhosts.conf
+
+ exeinto /etc/init.d ; newexe ${FILESDIR}/apache.rc6 apache
+ insinto /etc/conf.d ; newins ${FILESDIR}/apache.confd apache
+ insinto /etc/apache ; doins ${FILESDIR}/apache-builtin-mods
+
+ if use pam; then
+ insinto /etc/pam.d ; newins ${FILESDIR}/suexec.pam suexec
+ fi
+
+ #empty dirs
+ keepdir /var/cache/apache /var/cache/apache-mm /usr/lib/apache-extramodules /etc/apache/conf/addon-modules /var/log/apache
+}
+
+pkg_postinst() {
+ # these are in baselayout now; it will not hurt to leave them here though
+ # moved to pkg_postinst by jnelson, moved to pkg_preinst by lostlogic
+ getent group apache >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ groupadd -g 81 apache || die "problem adding group apache"
+ fi
+
+ # usermod returns 2 on user-exists-but-no-flags-given
+ #usermod apache &>/dev/null
+ #if [ $? != 2 ]; then
+ getent passwd apache >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ useradd -u 81 -g apache -s /bin/false -d /var/www/localhost -c "apache" apache
+ assert "problem adding user apache"
+ fi
+
+ einfo
+ einfo "Please remember to update your config files in /etc/apache"
+ einfo "as --datadir has been changed to ${DATADIR}!"
+ einfo
+}
+
+parse_modules_config() {
+ local filename=$1
+ local name=""
+ local dso=""
+ local disable=""
+ [ -f ${filename} ] || return 1
+ einfo "Using ${filename} for builtins."
+ for i in `cat $filename | sed "s/^#.*//"` ; do
+ if [ $i == "-" ] ; then
+ disable="true"
+ elif [ -z "$name" ] && [ ! -z "`echo $i | grep "mod_"`" ] ; then
+ name=`echo $i | sed "s/mod_//"`
+ elif [ "$disable" ] && ( [ $i == "static" ] || [ $i == "shared" ] ) ; then
+ MY_BUILTINS="${MY_BUILTINS} --disable-module=$name"
+ name="" ; disable=""
+ elif [ $i == "static" ] ; then
+ MY_BUILTINS="${MY_BUILTINS} --enable-module=$name --disable-shared=$name"
+ name="" ; disable=""
+ elif [ $i == "shared" ] ; then
+ MY_BUILTINS="${MY_BUILTINS} --enable-module=$name --enable-shared=$name"
+ name="" ; disable=""
+ fi
+ done
+}
+
+select_modules_config() {
+ parse_modules_config /etc/apache/apache-builtin-mods || \
+ parse_modules_config ${FILESDIR}/apache-builtin-mods || \
+ return 1
+}
diff --git a/net-www/apache/files/digest-apache-1.3.31-r2 b/net-www/apache/files/digest-apache-1.3.31-r2
new file mode 100644
index 000000000000..72445cf02f09
--- /dev/null
+++ b/net-www/apache/files/digest-apache-1.3.31-r2
@@ -0,0 +1,2 @@
+MD5 bd548a06ac48dda496b4e613572bb020 apache_1.3.31.tar.gz 2467371
+MD5 4e966d62bb9304fef153b03868756543 mod_ssl-2.8.18-1.3.31.tar.gz 754214
diff --git a/net-www/apache/files/patches/1.3.31-r2/00_apache_proxy_security_fix.patch b/net-www/apache/files/patches/1.3.31-r2/00_apache_proxy_security_fix.patch
new file mode 100644
index 000000000000..326cdd05c256
--- /dev/null
+++ b/net-www/apache/files/patches/1.3.31-r2/00_apache_proxy_security_fix.patch
@@ -0,0 +1,21 @@
+===================================================================
+RCS file: /home/cvspublic/apache-1.3/src/modules/proxy/proxy_http.c,v
+retrieving revision 1.106
+retrieving revision 1.107
+diff -u -r1.106 -r1.107
+--- apache-1.3/src/modules/proxy/proxy_http.c 2004/03/29 17:47:15 1.106
++++ apache-1.3/src/modules/proxy/proxy_http.c 2004/06/11 07:54:38 1.107
+@@ -485,6 +485,13 @@
+ content_length = ap_table_get(resp_hdrs, "Content-Length");
+ if (content_length != NULL) {
+ c->len = ap_strtol(content_length, NULL, 10);
++
++ if (c->len < 0) {
++ ap_kill_timeout(r);
++ return ap_proxyerror(r, HTTP_BAD_GATEWAY, ap_pstrcat(r->pool,
++ "Invalid Content-Length from remote server",
++ NULL));
++ }
+ }
+
+ }
diff --git a/net-www/apache/files/patches/1.3.31-r2/00_gentoo_apachectl.patch b/net-www/apache/files/patches/1.3.31-r2/00_gentoo_apachectl.patch
new file mode 100644
index 000000000000..9315c15fbace
--- /dev/null
+++ b/net-www/apache/files/patches/1.3.31-r2/00_gentoo_apachectl.patch
@@ -0,0 +1,806 @@
+diff -Naur apache_1.3.31/Makefile.tmpl apache_1.3.31-gentoo/Makefile.tmpl
+--- apache_1.3.31/Makefile.tmpl 2004-02-20 22:40:50.000000000 +0000
++++ apache_1.3.31-gentoo/Makefile.tmpl 2004-05-08 10:09:06.963665624 +0000
+@@ -366,7 +366,6 @@
+ fi; \
+ echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
+ sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
+- -e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
+ < $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
+ $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
+ echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
+diff -Naur apache_1.3.31/Makefile.tmpl.orig apache_1.3.31-gentoo/Makefile.tmpl.orig
+--- apache_1.3.31/Makefile.tmpl.orig 1970-01-01 00:00:00.000000000 +0000
++++ apache_1.3.31-gentoo/Makefile.tmpl.orig 2004-02-20 22:40:50.000000000 +0000
+@@ -0,0 +1,586 @@
++# Copyright 1999-2004 The Apache Software Foundation
++#
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++
++##
++## Makefile -- Apache Autoconf-style Interface (APACI)
++## top-level control Makefile for out-of-the-box
++## build and installation procedure.
++##
++## Written by Ralf S. Engelschall <rse@apache.org>
++##
++
++## ==================================================================
++## Options
++## ==================================================================
++
++# safe environment
++SHELL = @SHELL@
++
++# what platform are we on
++PLATFORM = @PLATFORM@
++
++# paths to the source tree parts
++TOP = .
++SRC = @SRC@
++MKF = @MKF@
++AUX = @AUX@
++
++# build tools
++CP = cp
++LN = ln
++RM = rm -f
++MKDIR = $(TOP)/$(AUX)/mkdir.sh
++INSTALL = $(TOP)/$(AUX)/install.sh -c
++IFLAGS_PROGRAM = @IFLAGS_PROGRAM@
++IFLAGS_CORE = @IFLAGS_CORE@
++IFLAGS_DSO = @IFLAGS_DSO@
++IFLAGS_SCRIPT = @IFLAGS_SCRIPT@
++IFLAGS_DATA = @IFLAGS_DATA@
++INSTALL_PROGRAM = $(INSTALL) $(IFLAGS_PROGRAM)
++INSTALL_CORE = $(INSTALL) $(IFLAGS_CORE)
++INSTALL_DSO = $(INSTALL) $(IFLAGS_DSO)
++INSTALL_SCRIPT = $(INSTALL) $(IFLAGS_SCRIPT)
++INSTALL_DATA = $(INSTALL) $(IFLAGS_DATA)
++PERL = @PERL@
++TAR = @TAR@
++TAROPT = @TAROPT@
++
++# installation name of Apache webserver
++TARGET = @TARGET@
++
++# installation root
++# (overrideable by package maintainers for
++# rolling packages without bristling the system)
++root =
++
++# installation paths
++prefix = @prefix@
++exec_prefix = @exec_prefix@
++bindir = @bindir@
++sbindir = @sbindir@
++libexecdir = @libexecdir@
++mandir = @mandir@
++sysconfdir = @sysconfdir@
++datadir = @datadir@
++iconsdir = @iconsdir@
++htdocsdir = @htdocsdir@
++manualdir = @manualdir@
++cgidir = @cgidir@
++includedir = @includedir@
++localstatedir = @localstatedir@
++runtimedir = @runtimedir@
++logfiledir = @logfiledir@
++proxycachedir = @proxycachedir@
++
++libexecdir_relative = @libexecdir_relative@
++
++# suexec details (optional)
++suexec = @suexec@
++suexec_caller = @suexec_caller@
++suexec_docroot = @suexec_docroot@
++suexec_logexec = @suexec_logexec@
++suexec_userdir = @suexec_userdir@
++suexec_uidmin = @suexec_uidmin@
++suexec_gidmin = @suexec_gidmin@
++suexec_safepath = @suexec_safepath@
++suexec_umask = @suexec_umask@
++
++# some substituted configuration parameters
++conf_user = @conf_user@
++conf_group = @conf_group@
++conf_port = @conf_port@
++conf_serveradmin = @conf_serveradmin@
++conf_servername = @conf_servername@
++
++# usage of src/support stuff
++build-support = @build_support@
++install-support = @install_support@
++clean-support = @clean_support@
++distclean-support = @distclean_support@
++
++# forwarding arguments
++MFWD = root=$(root)
++
++## ==================================================================
++## Targets
++## ==================================================================
++
++# default target
++all: build
++
++## ------------------------------------------------------------------
++## Build Target
++## ------------------------------------------------------------------
++
++# build the package
++build:
++ @echo "===> $(SRC)"
++ @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build-std
++ @if [ "x$(build-support)" != "x" ]; then \
++ $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) $(build-support); \
++ fi
++ @touch $(TOP)/$(SRC)/.apaci.build.ok
++ @echo "<=== $(SRC)"
++
++# the non-verbose variant for package maintainers
++build-quiet:
++ @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 build
++
++# build the standard stuff
++build-std:
++ @case "x$(PLATFORM)" in \
++ x*390*) _C89_STEPS="0xffffffff"; export _C89_STEPS;; \
++ esac; \
++ cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ all
++
++# build the additional support stuff
++build-support:
++ @echo "===> $(SRC)/support"; \
++ case "x$(PLATFORM)" in \
++ x*390*) _C89_STEPS="0xffffffff"; export _C89_STEPS;; \
++ esac; \
++ cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) all || exit 1; \
++ if [ ".$(suexec)" = .1 ]; then \
++ $(MAKE) $(MFLAGS) \
++ EXTRA_CFLAGS='\
++ $(suexec_umask) \
++ -DHTTPD_USER=\"$(suexec_caller)\" \
++ -DUID_MIN=$(suexec_uidmin) \
++ -DGID_MIN=$(suexec_gidmin) \
++ -DUSERDIR_SUFFIX=\"$(suexec_userdir)\" \
++ -DLOG_EXEC=\"$(suexec_logexec)\" \
++ -DDOC_ROOT=\"$(suexec_docroot)\" \
++ -DSAFE_PATH=\"$(suexec_safepath)\"' \
++ suexec; \
++ fi
++ @echo "<=== $(SRC)/support"
++
++## ------------------------------------------------------------------
++## Installation Targets
++## ------------------------------------------------------------------
++
++# indirection step to avoid conflict with INSTALL document
++# on case-insenstive filesystems, for instance on OS/2
++install: install-all
++
++# the install target for installing the complete Apache
++# package. This is implemented by running subtargets for the
++# separate parts of the installation process.
++install-all:
++ @if [ ! -f $(TOP)/$(SRC)/.apaci.build.ok ]; then \
++ $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) build; \
++ else \
++ :; \
++ fi
++ @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) \
++ install-mktree install-programs $(install-support) \
++ install-include install-data install-config
++ -@$(RM) $(SRC)/.apaci.install.tmp
++ -@$(RM) $(SRC)/.apaci.install.conf
++ -@if [ ".$(QUIET)" != .1 ]; then \
++ if [ ".$(TARGET)" = .httpd ]; then \
++ apachectl='apachectl'; \
++ else \
++ apachectl="$(TARGET)ctl"; \
++ fi; \
++ echo "+--------------------------------------------------------+"; \
++ echo "| You now have successfully built and installed the |"; \
++ echo "| Apache 1.3 HTTP server. To verify that Apache actually |"; \
++ echo "| works correctly you now should first check the |"; \
++ echo "| (initially created or preserved) configuration files |"; \
++ echo "| |"; \
++ echo "| $(sysconfdir)/$(TARGET).conf"; \
++ echo "| |"; \
++ echo "| and then you should be able to immediately fire up |"; \
++ echo "| Apache the first time by running: |"; \
++ echo "| |"; \
++ echo "| $(sbindir)/$${apachectl} start"; \
++ echo "| |"; \
++ echo "| Thanks for using Apache. The Apache Group |"; \
++ echo "| http://www.apache.org/ |"; \
++ echo "+--------------------------------------------------------+"; \
++ fi
++
++# the non-verbose variant for package maintainers
++install-quiet:
++ @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) QUIET=1 install-all
++
++# create the installation tree
++install-mktree:
++ @echo "===> [mktree: Creating Apache installation tree]"
++ $(MKDIR) $(root)$(bindir)
++ $(MKDIR) $(root)$(sbindir)
++ $(MKDIR) $(root)$(libexecdir)
++ $(MKDIR) $(root)$(mandir)/man1
++ $(MKDIR) $(root)$(mandir)/man8
++ $(MKDIR) $(root)$(sysconfdir)
++ $(MKDIR) $(root)$(htdocsdir)
++ $(MKDIR) $(root)$(manualdir)
++ $(MKDIR) $(root)$(iconsdir)
++ $(MKDIR) $(root)$(cgidir)
++ $(MKDIR) $(root)$(includedir)
++ $(MKDIR) $(root)$(includedir)/xml
++ $(MKDIR) $(root)$(runtimedir)
++ $(MKDIR) $(root)$(logfiledir)
++ $(MKDIR) $(root)$(proxycachedir)
++ -@if [ "x`$(AUX)/getuid.sh`" = "x0" ]; then \
++ echo "chown $(conf_user) $(root)$(proxycachedir)"; \
++ chown $(conf_user) $(root)$(proxycachedir); \
++ echo "chgrp $(conf_group) $(root)$(proxycachedir)"; \
++ chgrp "$(conf_group)" $(root)$(proxycachedir); \
++ fi
++ @echo "<=== [mktree]"
++
++# install the server program and optionally corresponding
++# shared object files.
++install-programs:
++ @echo "===> [programs: Installing Apache $(TARGET) program and shared objects]"
++ -@if [ ".`grep '^[ ]*AddModule.*mod_so\.o' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
++ echo "$(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
++ $(INSTALL_CORE) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
++ SHLIB_EXPORT_FILES="`grep '^SHLIB_EXPORT_FILES=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
++ if [ ".$${SHLIB_EXPORT_FILES}" != . ]; then \
++ $(CP) $(TOP)/$(SRC)/support/httpd.exp $(root)$(libexecdir)/; \
++ chmod 644 $(root)$(libexecdir)/httpd.exp; \
++ fi; \
++ else \
++ echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET)"; \
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/$(TARGET) $(root)$(sbindir)/$(TARGET); \
++ fi
++ -@if [ ".`grep 'SUBTARGET=target_shared' $(TOP)/$(SRC)/Makefile`" != . ]; then \
++ SHLIB_SUFFIX_NAME="`grep '^SHLIB_SUFFIX_NAME=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
++ SHLIB_SUFFIX_LIST="`grep '^SHLIB_SUFFIX_LIST=' $(TOP)/$(SRC)/Makefile | sed -e 's:^.*=::'`"; \
++ echo "$(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep"; \
++ $(INSTALL_CORE) $(TOP)/$(SRC)/lib$(TARGET).ep $(root)$(libexecdir)/lib$(TARGET).ep; \
++ echo "$(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}"; \
++ $(INSTALL_DSO) $(TOP)/$(SRC)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}; \
++ if [ ".$${SHLIB_SUFFIX_LIST}" != . ]; then \
++ echo "$(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*"; \
++ $(RM) $(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.*; \
++ for suffix in $${SHLIB_SUFFIX_LIST} ""; do \
++ [ ".$${suffix}" = . ] && continue; \
++ echo "$(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}"; \
++ $(LN) $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME} $(root)$(libexecdir)/lib$(TARGET).$${SHLIB_SUFFIX_NAME}.$${suffix}; \
++ done; \
++ fi; \
++ fi
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/httpd.8 $(root)$(mandir)/man8/$(TARGET).8
++ -@$(RM) $(SRC)/.apaci.install.conf; touch $(SRC)/.apaci.install.conf
++ -@if [ ".`grep '^[ ]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci`" != . ]; then \
++ for mod in `egrep '^[ ]*SharedModule' $(TOP)/$(SRC)/Configuration.apaci |\
++ sed -e 's/^[ ]*SharedModule[ ]*//'`; do \
++ file=`echo $${mod} | sed -e 's;^.*/\([^/]*\);\1;'`; \
++ echo "$(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}"; \
++ $(INSTALL_DSO) $(TOP)/$(SRC)/$${mod} $(root)$(libexecdir)/$${file}; \
++ name=`$(TOP)/$(AUX)/fmn.sh $(TOP)/$(SRC)/$${mod}`; \
++ echo dummy | awk '{ printf("LoadModule %-18s %s\n", modname, modpath); }' \
++ modname="$${name}" modpath="$(libexecdir_relative)$${file}" >>$(SRC)/.apaci.install.conf; \
++ done; \
++ echo "" >>$(SRC)/.apaci.install.conf; \
++ echo "# Reconstruction of the complete module list from all available modules" >>$(SRC)/.apaci.install.conf; \
++ echo "# (static and shared ones) to achieve correct module execution order." >>$(SRC)/.apaci.install.conf; \
++ echo "# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]" >>$(SRC)/.apaci.install.conf; \
++ echo "ClearModuleList" >>$(SRC)/.apaci.install.conf; \
++ egrep "^[ ]*(Add|Shared)Module" $(SRC)/Configuration.apaci |\
++ sed -e 's:SharedModule:AddModule:' \
++ -e 's:modules/[^/]*/::' \
++ -e 's:[ ]lib: mod_:' \
++ -e 's:\.[dsoam].*$$:.c:' >>$(SRC)/.apaci.install.conf; \
++ fi
++ @echo "<=== [programs]"
++
++# install the support programs and scripts
++install-support:
++ @echo "===> [support: Installing Apache support programs and scripts]"
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
++ @if [ ".$(TARGET)" = .httpd ]; then \
++ apachectl='apachectl'; \
++ else \
++ apachectl="$(TARGET)ctl"; \
++ fi; \
++ echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
++ sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
++ -e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
++ < $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
++ $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
++ echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/checkgid $(root)$(bindir)/checkgid
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
++ @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
++ sed -e 's;^#!/.*;#!$(PERL);' \
++ < $(TOP)/$(SRC)/support/dbmmanage > $(TOP)/$(SRC)/.apaci.install.tmp && \
++ $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(bindir)/dbmmanage
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
++ @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
++ sed -e 's;^#!/.*;#!$(PERL);' \
++ -e 's;\@prefix\@;$(prefix);' \
++ -e 's;\@sbindir\@;$(sbindir);' \
++ -e 's;\@libexecdir\@;$(libexecdir);' \
++ -e 's;\@includedir\@;$(includedir);' \
++ -e 's;\@sysconfdir\@;$(sysconfdir);' \
++ < $(TOP)/$(SRC)/support/apxs > $(TOP)/$(SRC)/.apaci.install.tmp && \
++ $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/apxs
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
++ -@if [ ".$(suexec)" = .1 ]; then \
++ echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
++ echo "chown root $(root)$(sbindir)/suexec"; \
++ chown root $(root)$(sbindir)/suexec; \
++ echo "chmod 4711 $(root)$(sbindir)/suexec"; \
++ chmod 4711 $(root)$(sbindir)/suexec; \
++ echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
++ fi
++ @echo "<=== [support]"
++
++# install the support programs and scripts for binary distribution
++install-binsupport:
++ @echo "===> [support: Installing Apache support programs and scripts for binary distribution]"
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/ab $(root)$(sbindir)/ab
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/ab.8 $(root)$(mandir)/man8/ab.8
++ @if [ ".$(TARGET)" = .httpd ]; then \
++ apachectl='apachectl'; \
++ else \
++ apachectl="$(TARGET)ctl"; \
++ fi; \
++ echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apachectl[*] $(root)$(sbindir)/$${apachectl}"; \
++ sed -e 's;PIDFILE=.*;PIDFILE=$(runtimedir)/$(TARGET).pid;' \
++ -e 's;HTTPD=.*;HTTPD=$(sbindir)/$(TARGET);' \
++ < $(TOP)/$(SRC)/support/apachectl > $(TOP)/$(SRC)/.apaci.install.tmp && \
++ $(INSTALL_SCRIPT) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sbindir)/$${apachectl}; \
++ echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8"; \
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/apachectl.8 $(root)$(mandir)/man8/$${apachectl}.8
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/checkgid $(root)$(bindir)/checkgid
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htpasswd $(root)$(bindir)/htpasswd
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/htpasswd.1 $(root)$(mandir)/man1/htpasswd.1
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/htdigest $(root)$(bindir)/htdigest
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/htdigest.1 $(root)$(mandir)/man1/htdigest.1
++ @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage[*] $(root)$(bindir)/dbmmanage"; \
++ $(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/dbmmanage $(root)$(bindir)/dbmmanage
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/dbmmanage.1 $(root)$(mandir)/man1/dbmmanage.1
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/logresolve $(root)$(sbindir)/logresolve
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/logresolve.8 $(root)$(mandir)/man8/logresolve.8
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/rotatelogs $(root)$(sbindir)/rotatelogs
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/rotatelogs.8 $(root)$(mandir)/man8/rotatelogs.8
++ @echo "$(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs[*] $(root)$(sbindir)/apxs"; \
++ $(INSTALL_SCRIPT) $(TOP)/$(SRC)/support/apxs $(root)$(sbindir)/apxs
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/apxs.8 $(root)$(mandir)/man8/apxs.8
++ -@if [ ".$(suexec)" = .1 ]; then \
++ echo "$(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec"; \
++ $(INSTALL_PROGRAM) $(TOP)/$(SRC)/support/suexec $(root)$(sbindir)/suexec; \
++ echo "chown root $(root)$(sbindir)/suexec"; \
++ chown root $(root)$(sbindir)/suexec; \
++ echo "chmod 4711 $(root)$(sbindir)/suexec"; \
++ chmod 4711 $(root)$(sbindir)/suexec; \
++ echo "$(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8"; \
++ $(INSTALL_DATA) $(TOP)/$(SRC)/support/suexec.8 $(root)$(mandir)/man8/suexec.8; \
++ fi
++ @echo "<=== [support]"
++
++# install the Apache C header files
++install-include:
++ @echo "===> [include: Installing Apache C header files]"
++ $(CP) $(TOP)/$(SRC)/include/*.h $(root)$(includedir)/
++ $(CP) $(TOP)/$(SRC)/lib/expat-lite/*.h $(root)$(includedir)/xml/
++ @osdir=`grep '^OSDIR=' $(TOP)/$(SRC)/Makefile.config | sed -e 's:^OSDIR=.*/os/:os/:'`; \
++ echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/"; \
++ $(CP) $(TOP)/$(SRC)/$${osdir}/os.h $(root)$(includedir)/; \
++ echo "$(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/"; \
++ $(CP) $(TOP)/$(SRC)/$${osdir}/os-inline.c $(root)$(includedir)/
++ chmod 644 $(root)$(includedir)/*.h $(root)$(includedir)/xml/*.h
++ @echo "<=== [include]"
++
++# create an initial document root containing the Apache manual,
++# icons and distributed CGI scripts.
++install-data:
++ @echo "===> [data: Installing initial data files]"
++ -@if [ -f $(root)$(htdocsdir)/index.html ] || [ -f $(root)$(htdocsdir)/index.html.en ]; then \
++ echo "[PRESERVING EXISTING DATA SUBDIR: $(root)$(htdocsdir)/]"; \
++ else \
++ echo "Copying tree $(TOP)/htdocs/ -> $(root)$(htdocsdir)/"; \
++ (cd $(TOP)/htdocs/ && $(TAR) $(TAROPT) - index* apache_pb.* ) |\
++ (cd $(root)$(htdocsdir)/ && $(TAR) -xf -); \
++ find $(root)$(htdocsdir)/ -type d -exec chmod a+rx {} \; ; \
++ find $(root)$(htdocsdir)/ -type f -print | xargs chmod a+r ; \
++ fi
++ -@if [ -d $(TOP)/htdocs/manual ]; then \
++ echo "Copying tree $(TOP)/htdocs/manual -> $(root)/$(manualdir)/"; \
++ (cd $(TOP)/htdocs/manual/ && $(TAR) $(TAROPT) - *) |\
++ (cd $(root)$(manualdir)/ && $(TAR) -xf -); \
++ find $(root)$(manualdir)/ -type d -exec chmod a+rx {} \; ; \
++ find $(root)$(manualdir)/ -type f -print | xargs chmod a+r ; \
++ fi
++ -@if [ -f $(root)$(cgidir)/printenv ]; then \
++ echo "[PRESERVING EXISTING CGI SUBDIR: $(root)$(cgidir)/]"; \
++ else \
++ for script in printenv test-cgi; do \
++ cat $(TOP)/cgi-bin/$${script} |\
++ sed -e 's;^#!/.*perl;#!$(PERL);' \
++ > $(TOP)/$(SRC)/.apaci.install.tmp; \
++ echo "$(INSTALL_DATA) $(TOP)/conf/$${script}[*] $(root)$(cgidir)/$${script}"; \
++ $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(cgidir)/$${script}; \
++ done; \
++ fi
++ @echo "Copying tree $(TOP)/icons/ -> $(root)$(iconsdir)/"; \
++ (cd $(TOP)/icons/ && $(TAR) $(TAROPT) - *) |\
++ (cd $(root)$(iconsdir)/ && $(TAR) -xf -); \
++ find $(root)$(iconsdir)/ -type d -exec chmod a+rx {} \; ;\
++ find $(root)$(iconsdir)/ -type f -exec chmod a+r {} \;
++ @echo "<=== [data]"
++
++# create the initial configuration by providing default files
++# and initial config files while preserving existing ones.
++install-config:
++ @echo "===> [config: Installing Apache configuration files]"
++ -@for conf in httpd.conf access.conf srm.conf; do \
++ if [ .$$conf = .httpd.conf ]; then \
++ target_conf="$(TARGET).conf"; \
++ else \
++ target_conf="$$conf"; \
++ fi; \
++ if [ ".$(TARGET)" = .httpd ]; then \
++ target_prefix=""; \
++ else \
++ target_prefix="$(TARGET)_"; \
++ fi; \
++ (echo "##"; \
++ echo "## $${target_conf} -- Apache HTTP server configuration file"; \
++ echo "##"; \
++ echo ""; \
++ cat $(TOP)/conf/$${conf}-dist ) |\
++ sed -e '/# LoadModule/r $(TOP)/$(SRC)/.apaci.install.conf' \
++ -e 's;@@ServerRoot@@/htdocs/manual;$(manualdir);' \
++ -e 's;@@ServerRoot@@/htdocs;$(htdocsdir);' \
++ -e 's;@@ServerRoot@@/icons;$(iconsdir);' \
++ -e 's;@@ServerRoot@@/cgi-bin;$(cgidir);' \
++ -e 's;@@ServerRoot@@/proxy;$(proxycachedir);' \
++ -e 's;@@ServerRoot@@;$(prefix);g' \
++ -e 's;httpd\.conf;$(TARGET).conf;' \
++ -e 's;logs/accept\.lock;$(runtimedir)/$(TARGET).lock;' \
++ -e 's;logs/apache_runtime_status;$(runtimedir)/$(TARGET).scoreboard;' \
++ -e 's;logs/httpd\.pid;$(runtimedir)/$(TARGET).pid;' \
++ -e "s;logs/access_log;$(logfiledir)/$${target_prefix}access_log;" \
++ -e "s;logs/error_log;$(logfiledir)/$${target_prefix}error_log;" \
++ -e "s;logs/referer_log;$(logfiledir)/$${target_prefix}referer_log;" \
++ -e "s;logs/agent_log;$(logfiledir)/$${target_prefix}agent_log;" \
++ -e 's;conf/magic;$(sysconfdir)/magic;' \
++ -e 's;conf/srm.conf;$(sysconfdir)/srm.conf;' \
++ -e 's;conf/access.conf;$(sysconfdir)/access.conf;' \
++ -e 's;conf/mime\.types;$(sysconfdir)/mime.types;' \
++ -e 's;User nobody;User $(conf_user);' \
++ -e 's;Group #-1;Group $(conf_group);' \
++ -e 's;^Group "#-1";Group $(conf_group);' \
++ -e 's;Port 80;Port $(conf_port);' \
++ -e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
++ -e 's;ServerName new.host.name;ServerName $(conf_servername);' \
++ > $(TOP)/$(SRC)/.apaci.install.tmp && \
++ echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}.default"; \
++ $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}.default; \
++ if [ ! -f "$(root)$(sysconfdir)/$${target_conf}" ]; then \
++ echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${target_conf}"; \
++ $(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${target_conf}; \
++ else \
++ echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${target_conf}]"; \
++ fi; \
++ done
++ -@for conf in mime.types magic; do \
++ echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default"; \
++ $(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}.default; \
++ if [ ! -f "$(root)$(sysconfdir)/$${conf}" ]; then \
++ echo "$(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}"; \
++ $(INSTALL_DATA) $(TOP)/conf/$${conf} $(root)$(sysconfdir)/$${conf}; \
++ else \
++ echo "[PRESERVING EXISTING CONFIG FILE: $(root)$(sysconfdir)/$${conf}]"; \
++ fi; \
++ done
++ @echo "<=== [config]"
++
++
++## ------------------------------------------------------------------
++## Cleanup Targets
++## ------------------------------------------------------------------
++
++# cleanup the source tree by removing anything which was
++# created by the build target
++clean:
++ @echo "===> $(SRC)"
++ @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) clean-std $(clean-support)
++ @echo "<=== $(SRC)"
++ @$(RM) $(TOP)/$(SRC)/.apaci.build.ok
++
++# clean the standard stuff
++clean-std:
++ @cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ clean
++
++# clean additional support stuff
++clean-support:
++ @echo "===> $(SRC)/support"; \
++ cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) clean; \
++ if [ ".$(suexec)" = .1 ]; then \
++ echo "$(RM) suexec"; \
++ $(RM) suexec; \
++ fi; \
++ echo "<=== $(SRC)/support"
++
++# cleanup the source tree by removing anything which was
++# created by the configure step and the build target.
++# When --shadow is used we just remove the complete shadow tree.
++distclean:
++ @if [ ".$(SRC)" = .src ]; then \
++ $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-normal; \
++ else \
++ $(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-shadow; \
++ fi
++
++distclean-normal:
++ @echo "===> $(SRC)"
++ @$(MAKE) -f $(TOP)/$(MKF) $(MFLAGS) $(MFWD) distclean-std $(distclean-support)
++ @echo "<=== $(SRC)"
++ -$(RM) $(SRC)/Configuration.apaci
++ -$(RM) $(SRC)/apaci
++ @$(RM) $(SRC)/.apaci.build.ok
++ -$(RM) Makefile
++ -$(RM) config.status
++
++# clean the standard stuff
++distclean-std:
++ @cd $(TOP)/$(SRC); $(MAKE) $(MFLAGS) SDP=$(SRC)/ distclean
++
++distclean-support:
++ @echo "===> $(SRC)/support"; \
++ cd $(TOP)/$(SRC)/support; $(MAKE) $(MFLAGS) distclean; \
++ if [ ".$(suexec)" = .1 ]; then \
++ echo "$(RM) suexec"; \
++ $(RM) suexec; \
++ fi; \
++ echo "<=== $(SRC)/support"
++
++distclean-shadow:
++ $(RM) -r $(SRC)
++ $(RM) $(TOP)/$(MKF)
++ -@if [ ".`ls $(TOP)/src.* 2>/dev/null`" = . ]; then \
++ echo "$(RM) Makefile"; \
++ $(RM) Makefile; \
++ fi
++
+diff -Naur apache_1.3.31/src/support/apachectl apache_1.3.31-gentoo/src/support/apachectl
+--- apache_1.3.31/src/support/apachectl 2004-02-20 22:02:24.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/apachectl 2004-05-08 10:09:07.044653312 +0000
+@@ -40,7 +40,8 @@
+ PIDFILE=/usr/local/apache/logs/httpd.pid
+ #
+ # the path to your httpd binary, including options if necessary
+-HTTPD='/usr/local/apache/src/httpd'
++. /etc/conf.d/apache
++HTTPD="/usr/sbin/apache ${APACHE_OPTS}"
+ #
+ # a command that outputs a formatted text version of the HTML at the
+ # url given on the command line. Designed for lynx, however other
+diff -Naur apache_1.3.31/src/support/apachectl.orig apache_1.3.31-gentoo/src/support/apachectl.orig
+--- apache_1.3.31/src/support/apachectl.orig 1970-01-01 00:00:00.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/apachectl.orig 2004-02-20 22:02:24.000000000 +0000
+@@ -0,0 +1,188 @@
++#!/bin/sh
++#
++# Copyright 1999-2004 The Apache Software Foundation
++#
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++#
++#
++# Apache control script designed to allow an easy command line interface
++# to controlling Apache. Written by Marc Slemko, 1997/08/23
++#
++# The exit codes returned are:
++# 0 - operation completed successfully
++# 1 -
++# 2 - usage error
++# 3 - httpd could not be started
++# 4 - httpd could not be stopped
++# 5 - httpd could not be started during a restart
++# 6 - httpd could not be restarted during a restart
++# 7 - httpd could not be restarted during a graceful restart
++# 8 - configuration syntax error
++#
++# When multiple arguments are given, only the error from the _last_
++# one is reported. Run "apachectl help" for usage info
++#
++#
++# |||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||
++# -------------------- --------------------
++#
++# the path to your PID file
++PIDFILE=/usr/local/apache/logs/httpd.pid
++#
++# the path to your httpd binary, including options if necessary
++HTTPD='/usr/local/apache/src/httpd'
++#
++# a command that outputs a formatted text version of the HTML at the
++# url given on the command line. Designed for lynx, however other
++# programs may work.
++LYNX="lynx -dump"
++#
++# the URL to your server's mod_status status page. If you do not
++# have one, then status and fullstatus will not work.
++STATUSURL="http://localhost/server-status"
++#
++# -------------------- --------------------
++# |||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||
++
++ERROR=0
++ARGV="$@"
++if [ "x$ARGV" = "x" ] ; then
++ ARGS="help"
++fi
++
++for ARG in $@ $ARGS
++do
++ # check for pidfile
++ if [ -f $PIDFILE ] ; then
++ PID=`cat $PIDFILE`
++ if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
++ STATUS="httpd (pid $PID) running"
++ RUNNING=1
++ else
++ STATUS="httpd (pid $PID?) not running"
++ RUNNING=0
++ fi
++ else
++ STATUS="httpd (no pid file) not running"
++ RUNNING=0
++ fi
++
++ case $ARG in
++ start)
++ if [ $RUNNING -eq 1 ]; then
++ echo "$0 $ARG: httpd (pid $PID) already running"
++ continue
++ fi
++ if $HTTPD ; then
++ echo "$0 $ARG: httpd started"
++ else
++ echo "$0 $ARG: httpd could not be started"
++ ERROR=3
++ fi
++ ;;
++ stop)
++ if [ $RUNNING -eq 0 ]; then
++ echo "$0 $ARG: $STATUS"
++ continue
++ fi
++ if kill $PID ; then
++ echo "$0 $ARG: httpd stopped"
++ else
++ echo "$0 $ARG: httpd could not be stopped"
++ ERROR=4
++ fi
++ ;;
++ restart)
++ if [ $RUNNING -eq 0 ]; then
++ echo "$0 $ARG: httpd not running, trying to start"
++ if $HTTPD ; then
++ echo "$0 $ARG: httpd started"
++ else
++ echo "$0 $ARG: httpd could not be started"
++ ERROR=5
++ fi
++ else
++ if $HTTPD -t >/dev/null 2>&1; then
++ if kill -HUP $PID ; then
++ echo "$0 $ARG: httpd restarted"
++ else
++ echo "$0 $ARG: httpd could not be restarted"
++ ERROR=6
++ fi
++ else
++ echo "$0 $ARG: configuration broken, ignoring restart"
++ echo "$0 $ARG: (run 'apachectl configtest' for details)"
++ ERROR=6
++ fi
++ fi
++ ;;
++ graceful)
++ if [ $RUNNING -eq 0 ]; then
++ echo "$0 $ARG: httpd not running, trying to start"
++ if $HTTPD ; then
++ echo "$0 $ARG: httpd started"
++ else
++ echo "$0 $ARG: httpd could not be started"
++ ERROR=5
++ fi
++ else
++ if $HTTPD -t >/dev/null 2>&1; then
++ if kill -USR1 $PID ; then
++ echo "$0 $ARG: httpd gracefully restarted"
++ else
++ echo "$0 $ARG: httpd could not be restarted"
++ ERROR=7
++ fi
++ else
++ echo "$0 $ARG: configuration broken, ignoring restart"
++ echo "$0 $ARG: (run 'apachectl configtest' for details)"
++ ERROR=7
++ fi
++ fi
++ ;;
++ status)
++ $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
++ ;;
++ fullstatus)
++ $LYNX $STATUSURL
++ ;;
++ configtest)
++ if $HTTPD -t; then
++ :
++ else
++ ERROR=8
++ fi
++ ;;
++ *)
++ echo "usage: $0 (start|stop|restart|fullstatus|status|graceful|configtest|help)"
++ cat <<EOF
++
++start - start httpd
++stop - stop httpd
++restart - restart httpd if running by sending a SIGHUP or start if
++ not running
++fullstatus - dump a full status screen; requires lynx and mod_status enabled
++status - dump a short status screen; requires lynx and mod_status enabled
++graceful - do a graceful restart by sending a SIGUSR1 or start if not running
++configtest - do a configuration syntax test
++help - this screen
++
++EOF
++ ERROR=2
++ ;;
++
++ esac
++
++done
++
++exit $ERROR
diff --git a/net-www/apache/files/patches/1.3.31-r2/00_gentoo_base.patch b/net-www/apache/files/patches/1.3.31-r2/00_gentoo_base.patch
new file mode 100644
index 000000000000..e7c85b5b14bc
--- /dev/null
+++ b/net-www/apache/files/patches/1.3.31-r2/00_gentoo_base.patch
@@ -0,0 +1,786 @@
+diff -Naur apache_1.3.31/cgi-bin/printenv apache_1.3.31-gentoo/cgi-bin/printenv
+--- apache_1.3.31/cgi-bin/printenv 1999-11-24 18:10:58.000000000 +0000
++++ apache_1.3.31-gentoo/cgi-bin/printenv 2004-05-08 09:49:06.461169744 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/perl
++#!/usr/bin/perl
+ ##
+ ## printenv -- demo CGI program which just prints its environment
+ ##
+diff -Naur apache_1.3.31/conf/mime.types apache_1.3.31-gentoo/conf/mime.types
+--- apache_1.3.31/conf/mime.types 2004-01-10 22:57:46.000000000 +0000
++++ apache_1.3.31-gentoo/conf/mime.types 2004-05-08 09:49:06.481166704 +0000
+@@ -344,19 +344,18 @@
+ application/x-bcpio bcpio
+ application/x-cdlink vcd
+ application/x-chess-pgn pgn
+-application/x-compress
+ application/x-cpio cpio
+ application/x-csh csh
+ application/x-director dcr dir dxr
+ application/x-dvi dvi
+ application/x-futuresplash spl
+ application/x-gtar gtar
+-application/x-gzip
+ application/x-hdf hdf
+ application/x-javascript js
+ application/x-koan skp skd skt skm
+ application/x-latex latex
+ application/x-netcdf nc cdf
++application/x-ogg ogg
+ application/x-sh sh
+ application/x-shar shar
+ application/x-shockwave-flash swf
+diff -Naur apache_1.3.31/config.layout apache_1.3.31-gentoo/config.layout
+--- apache_1.3.31/config.layout 2002-05-16 16:32:31.000000000 +0000
++++ apache_1.3.31-gentoo/config.layout 2004-05-08 09:49:06.487165792 +0000
+@@ -28,6 +28,7 @@
+ runtimedir: $localstatedir/logs
+ logfiledir: $localstatedir/logs
+ proxycachedir: $localstatedir/proxy
++ serverroot: $prefix
+ </Layout>
+
+ # GNU standards conforming path layout.
+@@ -50,6 +51,7 @@
+ runtimedir: $localstatedir/run
+ logfiledir: $localstatedir/log
+ proxycachedir: $localstatedir/proxy
++ serverroot: $prefix
+ </Layout>
+
+ # Apache binary distribution path layout
+@@ -92,6 +94,7 @@
+ runtimedir: $prefix/Logs
+ logfiledir: $prefix/Logs
+ proxycachedir: $prefix/ProxyCache
++ serverroot: $prefix
+ </Layout>
+
+ # Darwin/Mac OS Layout
+@@ -115,8 +118,8 @@
+ proxycachedir: $runtimedir/proxy
+ </Layout>
+
+-# Red Hat Linux 7.x layout
+-<Layout RedHat>
++# ADVX layout
++<Layout ADVX>
+ prefix: /usr
+ exec_prefix: $prefix
+ bindir: $prefix/bin
+@@ -134,6 +137,7 @@
+ runtimedir: $localstatedir/run
+ logfiledir: $localstatedir/log/httpd
+ proxycachedir: $localstatedir/cache/httpd
++ serverroot: /etc/httpd
+ </Layout>
+
+ # According to the /opt filesystem conventions
+diff -Naur apache_1.3.31/configure apache_1.3.31-gentoo/configure
+--- apache_1.3.31/configure 2004-02-20 22:40:50.000000000 +0000
++++ apache_1.3.31-gentoo/configure 2004-05-08 09:49:06.617146032 +0000
+@@ -460,7 +460,7 @@
+ for var in prefix exec_prefix bindir sbindir libexecdir mandir \
+ sysconfdir datadir iconsdir htdocsdir manualdir cgidir \
+ includedir localstatedir runtimedir logfiledir \
+- proxycachedir; do
++ proxycachedir serverroot; do
+ eval "val=\"\$$var\""
+ case $val in
+ *+ )
+@@ -621,6 +621,9 @@
+ sysconfdir="$apc_optarg"
+ autosuffix_sysconfdir=no
+ ;;
++ --serverroot=*)
++ serverroot="$apc_optarg"
++ ;;
+ --datadir=*)
+ datadir="$apc_optarg"
+ autosuffix_datadir=no
+@@ -1070,7 +1073,7 @@
+ for var in prefix exec_prefix bindir sbindir libexecdir mandir \
+ sysconfdir datadir iconsdir htdocsdir manualdir cgidir \
+ includedir localstatedir runtimedir logfiledir \
+- proxycachedir suexec_docroot suexec_logexec ; do
++ proxycachedir suexec_docroot suexec_logexec serverroot; do
+ eval "val=\"\$$var\"";
+ val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
+ eval "$var=\"$val\""
+@@ -1175,8 +1178,8 @@
+ ## path is just the emtpy one, i.e. ""]
+ ##
+ runtimedir_relative=`echo $runtimedir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
+-logfiledir_relative=`echo $logfiledir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
+-sysconfdir_relative=`echo $sysconfdir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
++logfiledir_relative=`echo $logfiledir | sed -e "s:^$serverroot/*::" -e 's:\(.\)$:\1/:'`
++sysconfdir_relative=`echo $sysconfdir | sed -e "s:^$serverroot/*::" -e 's:\(.\)$:\1/:'`
+ libexecdir_relative=`echo $libexecdir | sed -e "s:^$prefix/*::" -e 's:\(.\)$:\1/:'`
+
+ ##
+@@ -1204,7 +1207,7 @@
+ echo " proxycachedir: $proxycachedir"
+ echo ""
+ echo "Compilation paths:"
+- echo " HTTPD_ROOT: $prefix"
++ echo " HTTPD_ROOT: $serverroot"
+ echo " SHARED_CORE_DIR: $libexecdir"
+ echo " DEFAULT_PIDLOG: ${runtimedir_relative}${thetarget}.pid"
+ echo " DEFAULT_SCOREBOARD: ${runtimedir_relative}${thetarget}.scoreboard"
+@@ -1263,6 +1266,7 @@
+ -e "s%@libexecdir_relative@%$libexecdir_relative%g" \
+ -e "s%@mandir@%$mandir%g" \
+ -e "s%@sysconfdir@%$sysconfdir%g" \
++-e "s%@serverroot@%$serverroot%g" \
+ -e "s%@datadir@%$datadir%g" \
+ -e "s%@iconsdir@%$iconsdir%g" \
+ -e "s%@htdocsdir@%$htdocsdir%g" \
+@@ -1301,7 +1305,7 @@
+ echo "#!/bin/sh" >$src/apaci
+ echo "## USED AS A COMMAND LINE EXPANDER TO OVERRIDE PATHS" >>$src/apaci
+ echo "## WITHOUT DISTURBING THE KNOWN MAKE BUILD PROCESS DISPLAY" >>$src/apaci
+-echo "echo '-DHTTPD_ROOT=\"$prefix\"'" >>$src/apaci
++echo "echo '-DHTTPD_ROOT=\"$serverroot\"'" >>$src/apaci
+ echo "echo '-DSUEXEC_BIN=\"$sbindir/suexec\"'" >>$src/apaci
+ echo "echo '-DSHARED_CORE_DIR=\"$libexecdir\"'" >>$src/apaci
+ echo "echo '-DDEFAULT_PIDLOG=\"${runtimedir_relative}${thetarget}.pid\"'" >>$src/apaci
+diff -Naur apache_1.3.31/src/helpers/find-dbm-lib apache_1.3.31-gentoo/src/helpers/find-dbm-lib
+--- apache_1.3.31/src/helpers/find-dbm-lib 2004-02-16 22:23:09.000000000 +0000
++++ apache_1.3.31-gentoo/src/helpers/find-dbm-lib 2004-05-08 09:49:06.621145424 +0000
+@@ -28,17 +28,7 @@
+ *-linux*)
+ # many systems don't have -ldbm
+ DBM_LIB=""
+- if ./helpers/TestCompile lib ndbm dbm_open; then
+- DBM_LIB="-lndbm"
+- if ./helpers/TestCompile lib db1 dbm_open; then
+- # Red Hat needs this; ndbm.h lives in db1
+- CFLAGS="$CFLAGS -I/usr/include/db1"
+- fi
+- elif ./helpers/TestCompile lib db1 dbm_open; then
+- # For Red Hat 7, if not handled by the ndbm case above
+- DBM_LIB="-ldb1"
+- CFLAGS="$CFLAGS -I/usr/include/db1"
+- elif ./helpers/TestCompile lib gdbm dbm_open; then
++ if ./helpers/TestCompile lib gdbm dbm_open; then
+ DBM_LIB="-lgdbm"
+ CFLAGS="$CFLAGS -I/usr/include/gdbm"
+ elif ./helpers/TestCompile lib dbm dbm_open; then
+diff -Naur apache_1.3.31/src/include/hsregex.h apache_1.3.31-gentoo/src/include/hsregex.h
+--- apache_1.3.31/src/include/hsregex.h 2004-04-15 15:51:51.000000000 +0000
++++ apache_1.3.31-gentoo/src/include/hsregex.h 2004-05-08 09:49:06.626144664 +0000
+@@ -22,7 +22,7 @@
+ #define ap_private_extern
+ #endif
+
+-typedef off_t regoff_t;
++typedef int regoff_t;
+ typedef struct {
+ int re_magic;
+ size_t re_nsub; /* number of parenthesized subexpressions */
+diff -Naur apache_1.3.31/src/main/http_core.c apache_1.3.31-gentoo/src/main/http_core.c
+--- apache_1.3.31/src/main/http_core.c 2004-05-03 20:15:26.000000000 +0000
++++ apache_1.3.31-gentoo/src/main/http_core.c 2004-05-08 09:51:58.137071040 +0000
+@@ -2140,8 +2140,9 @@
+ else {
+ cmd->server->server_uid = ap_user_id;
+ fprintf(stderr,
+- "Warning: User directive in <VirtualHost> "
++ "ERROR: User directive in <VirtualHost> "
+ "requires SUEXEC wrapper.\n");
++ exit (1);
+ }
+ }
+ #if !defined (BIG_SECURITY_HOLE) && !defined (OS2)
+@@ -2181,8 +2182,9 @@
+ else {
+ cmd->server->server_gid = ap_group_id;
+ fprintf(stderr,
+- "Warning: Group directive in <VirtualHost> requires "
++ "ERROR: Group directive in <VirtualHost> requires "
+ "SUEXEC wrapper.\n");
++ exit (1);
+ }
+ }
+
+diff -Naur apache_1.3.31/src/main/http_main.c apache_1.3.31-gentoo/src/main/http_main.c
+--- apache_1.3.31/src/main/http_main.c 2004-04-06 16:42:19.000000000 +0000
++++ apache_1.3.31-gentoo/src/main/http_main.c 2004-05-08 09:49:06.929098608 +0000
+@@ -425,6 +425,7 @@
+ }
+ else {
+ ap_add_version_component(SERVER_BASEVERSION " (" PLATFORM ")");
++ ap_add_version_component(" (Gentoo/Linux)");
+ }
+ /*
+ * Lock the server_version string if we're not displaying
+diff -Naur apache_1.3.31/src/modules/standard/mod_auth_dbm.c apache_1.3.31-gentoo/src/modules/standard/mod_auth_dbm.c
+--- apache_1.3.31/src/modules/standard/mod_auth_dbm.c 2004-02-20 20:37:40.000000000 +0000
++++ apache_1.3.31-gentoo/src/modules/standard/mod_auth_dbm.c 2004-05-08 09:49:07.027083712 +0000
+@@ -38,7 +38,8 @@
+ #define dbm_fetch sdbm_fetch
+ #define dbm_close sdbm_close
+ #else
+-#include <ndbm.h>
++#define DB_DBM_HSEARCH 1
++#include <db.h>
+ #endif
+
+ /*
+diff -Naur apache_1.3.31/src/support/apxs.pl apache_1.3.31-gentoo/src/support/apxs.pl
+--- apache_1.3.31/src/support/apxs.pl 2004-02-20 22:02:24.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/apxs.pl 2004-05-08 09:49:07.123069120 +0000
+@@ -187,15 +187,15 @@
+ ##
+ if ($^O ne "MSWin32") {
+ if (not -x "$CFG_SBINDIR/$CFG_TARGET") {
+- print STDERR "apxs:Error: $CFG_SBINDIR/$CFG_TARGET not found or not executable\n";
+- exit(1);
++ print STDERR "apxs:Warning: $CFG_SBINDIR/$CFG_TARGET not found or not executable\n";
++ print STDERR "apxs:Warning: Continuing anyway...\n";
+ }
+ if (not grep(/mod_so/, `$CFG_SBINDIR/$CFG_TARGET -l`)) {
+- print STDERR "apxs:Error: Sorry, no DSO support for Apache available\n";
+- print STDERR "apxs:Error: under your platform. Make sure the Apache\n";
+- print STDERR "apxs:Error: module mod_so is compiled into your server\n";
+- print STDERR "apxs:Error: binary `$CFG_SBINDIR/$CFG_TARGET'.\n";
+- exit(1);
++ print STDERR "apxs:Warning: No shared object support for Apache\n";
++ print STDERR "apxs:Warning: available under your platform. Make sure\n";
++ print STDERR "apxs:Warning: the Apache module mod_so is compiled into\n";
++ print STDERR "apxs:Warning: your server binary `$CFG_SBINDIR/$CFG_TARGET'.\n";
++ print STDERR "apxs:Warning: Continuing anyway...\n";
+ }
+ }
+
+@@ -469,7 +469,7 @@
+ $filename = "mod_${name}.c";
+ }
+ my $dir = $CFG_LIBEXECDIR;
+- $dir =~ s|^$CFG_PREFIX/?||;
++ $dir =~ s|^$CFG_SYSCONFDIR/?||;
+ $dir =~ s|(.)$|$1/|;
+ push(@lmd, sprintf("LoadModule %-18s %s", "${name}_module", "$dir$t"));
+ push(@amd, sprintf("AddModule %s", $filename));
+diff -Naur apache_1.3.31/src/support/dbmmanage apache_1.3.31-gentoo/src/support/dbmmanage
+--- apache_1.3.31/src/support/dbmmanage 2004-02-20 22:02:24.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/dbmmanage 2004-05-08 09:53:56.276111176 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/perl
++#!/usr/bin/perl
+ #
+ # Copyright 1999-2004 The Apache Software Foundation
+ #
+diff -Naur apache_1.3.31/src/support/htdigest.c apache_1.3.31-gentoo/src/support/htdigest.c
+--- apache_1.3.31/src/support/htdigest.c 2004-02-20 22:02:24.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/htdigest.c 2004-05-08 09:49:07.153064560 +0000
+@@ -52,7 +52,7 @@
+
+ #define MAX_STRING_LEN 256
+
+-char *tn;
++char tn[MAX_STRING_LEN];
+
+
+ static void getword(char *word, char *line, char stop)
+@@ -115,7 +115,7 @@
+ ap_getpass("Re-type new password: ", pwv, sizeof(pwv));
+ if (strcmp(pwin, pwv) != 0) {
+ fprintf(stderr, "They don't match, sorry.\n");
+- if (tn) {
++ if (strlen(tn)) {
+ unlink(tn);
+ }
+ exit(1);
+@@ -146,7 +146,7 @@
+ static void interrupted(void)
+ {
+ fprintf(stderr, "Interrupted.\n");
+- if (tn)
++ if (strlen(tn))
+ unlink(tn);
+ exit(1);
+ }
+@@ -174,8 +174,9 @@
+ char x[MAX_STRING_LEN];
+ char command[MAX_STRING_LEN];
+ int found;
++ int tfd;
+
+- tn = NULL;
++ strcpy (tn, "/tmp/htdigest-XXXXXX");
+ signal(SIGINT, (void (*)(int)) interrupted);
+ if (argc == 5) {
+ if (strcmp(argv[1], "-c"))
+@@ -199,8 +200,12 @@
+ else if (argc != 4)
+ usage();
+
+- tn = tmpnam(NULL);
+- if (!(tfp = fopen(tn, "w"))) {
++ tfd = mkstemp (tn);
++ if (tfd == -1) {
++ fprintf(stderr, "Could not open temp file.\n");
++ exit(1);
++ }
++ if (!(tfp = fdopen(tfd, "w"))) {
+ fprintf(stderr, "Could not open temp file.\n");
+ exit(1);
+ }
+diff -Naur apache_1.3.31/src/support/htpasswd.c apache_1.3.31-gentoo/src/support/htpasswd.c
+--- apache_1.3.31/src/support/htpasswd.c 2004-02-20 22:02:24.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/htpasswd.c 2004-05-08 09:49:07.249049968 +0000
+@@ -81,7 +81,7 @@
+ * This needs to be declared statically so the signal handler can
+ * access it.
+ */
+-static char *tempfilename;
++static char tempfilename[MAX_STRING_LEN];
+ /*
+ * If our platform knows about the tmpnam() external buffer size, create
+ * a buffer to pass in. This is needed in a threaded environment, or
+@@ -241,7 +241,7 @@
+ static void interrupted(void)
+ {
+ fprintf(stderr, "Interrupted.\n");
+- if (tempfilename != NULL) {
++ if (strlen(tempfilename) > 0) {
+ unlink(tempfilename);
+ }
+ exit(ERR_INTERRUPTED);
+@@ -333,8 +333,10 @@
+ int noninteractive = 0;
+ int i;
+ int args_left = 2;
++ int tfd;
++
++ memset (tempfilename, 0x00, sizeof(tempfilename));
+
+- tempfilename = NULL;
+ signal(SIGINT, (void (*)(int)) interrupted);
+
+ /*
+@@ -521,8 +523,9 @@
+ * to add or update. Let's do it..
+ */
+ errno = 0;
+- tempfilename = tmpnam(tname_buf);
+- if ((tempfilename == NULL) || (*tempfilename == '\0')) {
++ strcpy(tempfilename, "/tmp/htpasswd-XXXXXX");
++ tfd = mkstemp(tempfilename);
++ if (tfd == -1) {
+ fprintf(stderr, "%s: unable to generate temporary filename\n",
+ argv[0]);
+ if (errno == 0) {
+@@ -531,7 +534,7 @@
+ perror("tmpnam");
+ exit(ERR_FILEPERM);
+ }
+- ftemp = fopen(tempfilename, "w+");
++ ftemp = fdopen(tfd, "w+");
+ if (ftemp == NULL) {
+ fprintf(stderr, "%s: unable to create temporary file '%s'\n", argv[0],
+ tempfilename);
+diff -Naur apache_1.3.31/src/support/httpd.8 apache_1.3.31-gentoo/src/support/httpd.8
+--- apache_1.3.31/src/support/httpd.8 2004-02-20 22:40:51.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/httpd.8 2004-05-08 09:49:07.254049208 +0000
+@@ -153,21 +153,17 @@
+ , and then exit.
+ .SH FILES
+ .PD 0
+-.B /usr/local/apache/conf/httpd.conf
++.B /etc/apache/conf/apache.conf
+ .br
+-.B /usr/local/apache/conf/srm.conf
++.B /etc/apache/conf/apache-mime.types
+ .br
+-.B /usr/local/apache/conf/access.conf
++.B /etc/apache/conf/magic
+ .br
+-.B /usr/local/apache/conf/mime.types
++.B /var/log/apache/error_log
+ .br
+-.B /usr/local/apache/conf/magic
++.B /var/log/apache/access_log
+ .br
+-.B /usr/local/apache/logs/error_log
+-.br
+-.B /usr/local/apache/logs/access_log
+-.br
+-.B /usr/local/apache/logs/httpd.pid
++.B /var/run/apache.pid
+ .PD
+ .SH SEE ALSO
+ .BR inetd (8).
+diff -Naur apache_1.3.31/src/support/log_server_status apache_1.3.31-gentoo/src/support/log_server_status
+--- apache_1.3.31/src/support/log_server_status 2004-02-20 22:02:24.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/log_server_status 2004-05-08 09:52:52.257843432 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/perl
++#!/usr/bin/perl
+ #
+ # Copyright 1999-2004 The Apache Software Foundation
+ #
+diff -Naur apache_1.3.31/src/support/phf_abuse_log.cgi apache_1.3.31-gentoo/src/support/phf_abuse_log.cgi
+--- apache_1.3.31/src/support/phf_abuse_log.cgi 2004-02-20 22:02:24.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/phf_abuse_log.cgi 2004-05-08 09:53:26.217680752 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/perl
++#!/usr/bin/perl
+ #
+ # Copyright 1999-2004 The Apache Software Foundation
+ #
+diff -Naur apache_1.3.31/src/support/suexec.c apache_1.3.31-gentoo/src/support/suexec.c
+--- apache_1.3.31/src/support/suexec.c 2004-02-20 22:02:24.000000000 +0000
++++ apache_1.3.31-gentoo/src/support/suexec.c 2004-05-08 09:49:07.455018656 +0000
+@@ -47,6 +47,7 @@
+ #include <sys/types.h>
+
+ #include <stdarg.h>
++#include <strings.h>
+
+ #include "suexec.h"
+
+@@ -131,6 +132,8 @@
+ "UNIQUE_ID=",
+ "USER_NAME=",
+ "TZ=",
++ "HTTPS",
++ "REDIRECT_HTTPS",
+ NULL
+ };
+
+@@ -219,6 +222,244 @@
+ environ = cleanenv;
+ }
+
++#define MY_STATE_NORMAL 0
++#define MY_STATE_SPACE 1
++#define MY_STATE_QUOTES 2
++#define MY_STATE_APOSTROPHES 3
++#define MY_STATE_END 4
++
++char** param_separate(char* params, int addl_slots) {
++ int state, actpos, actarg_start, actarg_len, argnum;
++ char **res=0;
++ char backslash=0;
++
++ if (params==0) return(0);
++
++ if (*params==0) {
++ res=(char**)malloc(sizeof(char*)*(1+addl_slots));
++ for (actpos=0;actpos<addl_slots+1;++actpos) res[actpos]=0;
++ return(res);
++ }
++ actpos=0;backslash=0;argnum=0;state=MY_STATE_SPACE;
++ while (state!=MY_STATE_END) {
++ switch (state) {
++
++ case MY_STATE_SPACE:
++ switch (params[actpos]) {
++ case 0 :
++ state=MY_STATE_END;
++ break;
++
++ case ' ' :
++ case '\t':
++ break;
++
++ case '\'':
++ state=MY_STATE_APOSTROPHES;
++ actarg_start=actpos+1;
++ break;
++ case '"':
++ state=MY_STATE_QUOTES;
++ actarg_start=actpos+1;
++ break;
++ default:
++ state=MY_STATE_NORMAL;
++ actarg_start=actpos;
++ }
++ break;
++
++ case MY_STATE_NORMAL:
++
++ switch (params[actpos]) {
++ case 0 :
++ state=MY_STATE_END;
++ ++argnum;
++ actarg_len=actpos-actarg_start;
++ break;
++
++ case ' ':
++ case '\t':
++ state=MY_STATE_SPACE;
++ ++argnum;
++ actarg_len=actpos-actarg_start;
++ break;
++ }
++ break;
++
++ case MY_STATE_APOSTROPHES:
++
++ switch (params[actpos]) {
++ case 0 :
++ state=MY_STATE_END;
++ ++argnum;
++ actarg_len=actpos-actarg_start;
++ break;
++
++ case '\\':
++ backslash=1-backslash;
++ break;
++
++ case '\'':
++ if (! backslash) {
++ state=MY_STATE_SPACE;
++ ++argnum;
++ actarg_len=actpos-actarg_start;
++ }
++ break;
++ }
++ if (params[actpos]!='\\') backslash=0;
++ break;
++
++ case MY_STATE_QUOTES:
++
++ switch (params[actpos]) {
++ case 0 :
++ state=MY_STATE_END;
++ ++argnum;
++ actarg_len=actpos-actarg_start;
++ break;
++
++ case '\\':
++ backslash=1-backslash;
++ break;
++
++ case '"':
++ if (! backslash) {
++ state=MY_STATE_SPACE;
++ ++argnum;
++ actarg_len=actpos-actarg_start;
++ }
++ break;
++ }
++ if (params[actpos]!='\\') backslash=0;
++ break;
++ }
++ actpos++;
++ }
++
++ res=(char**)malloc(sizeof(char*)*(argnum+1+addl_slots));
++ for (actpos=0;actpos<argnum+addl_slots+1;++actpos) res[actpos]=0;
++
++
++ actpos=0;backslash=0;argnum=0;state=MY_STATE_SPACE;
++ while (state!=MY_STATE_END) {
++ switch (state) {
++
++ case MY_STATE_SPACE:
++ switch (params[actpos]) {
++ case 0 :
++ state=MY_STATE_END;
++ break;
++
++ case ' ' :
++ case '\t':
++ break;
++
++ case '\'':
++ state=MY_STATE_APOSTROPHES;
++ actarg_start=actpos+1;
++ break;
++ case '"':
++ state=MY_STATE_QUOTES;
++ actarg_start=actpos+1;
++ break;
++ default:
++ state=MY_STATE_NORMAL;
++ actarg_start=actpos;
++ }
++ break;
++
++ case MY_STATE_NORMAL:
++
++ switch (params[actpos]) {
++ case 0 :
++ state=MY_STATE_END;
++ actarg_len=actpos-actarg_start;
++ res[argnum]=(char*)malloc(actarg_len+1);
++ strncpy(res[argnum],&params[actarg_start],actarg_len);
++ res[argnum][actarg_len]=0;
++ ++argnum;
++ break;
++
++ case ' ':
++ case '\t':
++ state=MY_STATE_SPACE;
++ actarg_len=actpos-actarg_start;
++ res[argnum]=(char*)malloc(actarg_len+1);
++ strncpy(res[argnum],&params[actarg_start],actarg_len);
++ res[argnum][actarg_len]=0;
++ ++argnum;
++ break;
++ }
++ break;
++
++ case MY_STATE_APOSTROPHES:
++
++ switch (params[actpos]) {
++ case 0 :
++ state=MY_STATE_END;
++ actarg_len=actpos-actarg_start;
++ res[argnum]=(char*)malloc(actarg_len+1);
++ strncpy(res[argnum],&params[actarg_start],actarg_len);
++ res[argnum][actarg_len]=0;
++ ++argnum;
++ break;
++
++ case '\\':
++ backslash=1-backslash;
++ break;
++
++ case '\'':
++ if (! backslash) {
++ state=MY_STATE_SPACE;
++ actarg_len=actpos-actarg_start;
++ res[argnum]=(char*)malloc(actarg_len+1);
++ strncpy(res[argnum],&params[actarg_start],actarg_len);
++ res[argnum][actarg_len]=0;
++ ++argnum;
++ }
++ break;
++ }
++ if (params[actpos]!='\\') backslash=0;
++ break;
++
++ case MY_STATE_QUOTES:
++
++ switch (params[actpos]) {
++ case 0 :
++ state=MY_STATE_END;
++ actarg_len=actpos-actarg_start;
++ res[argnum]=(char*)malloc(actarg_len+1);
++ strncpy(res[argnum],&params[actarg_start],actarg_len);
++ res[argnum][actarg_len]=0;
++ ++argnum;
++ break;
++
++ case '\\':
++ backslash=1-backslash;
++ break;
++
++ case '"':
++ if (! backslash) {
++ state=MY_STATE_SPACE;
++ actarg_len=actpos-actarg_start;
++ res[argnum]=(char*)malloc(actarg_len+1);
++ strncpy(res[argnum],&params[actarg_start],actarg_len);
++ res[argnum][actarg_len]=0;
++ ++argnum;
++ }
++ break;
++ }
++ if (params[actpos]!='\\') backslash=0;
++ break;
++ }
++ actpos++;
++ }
++
++ return(res);
++}
++
++
+ int main(int argc, char *argv[])
+ {
+ int userdir = 0; /* ~userdir flag */
+@@ -231,6 +472,10 @@
+ char *actual_gname; /* actual group name */
+ char *prog; /* name of this program */
+ char *cmd; /* command to be executed */
++
++ int ind, ind2;
++ char **passedargv = 0;
++
+ char cwd[AP_MAXPATH]; /* current working directory */
+ char dwd[AP_MAXPATH]; /* docroot working directory */
+ struct passwd *pw; /* password entry holder */
+@@ -510,8 +755,18 @@
+ /*
+ * Error out if we cannot stat the program.
+ */
+- if (((lstat(cmd, &prg_info)) != 0) || (S_ISLNK(prg_info.st_mode))) {
+- log_err("error: cannot stat program: (%s)\n", cmd);
++ passedargv=param_separate(cmd,argc-4);
++ for (ind=0; passedargv[ind]; ++ind);
++ for (ind2=4;ind2<argc;++ind2,++ind) {
++ if (argv[ind2]!=0) if (argv[ind2][0]!=0) passedargv[ind]=strdup(argv[ind2]);
++ if (passedargv[ind]==0) {
++ passedargv[ind]=malloc(1);
++ passedargv[ind][0]=0;
++ }
++ }
++
++ if (((lstat(passedargv[0], &prg_info)) != 0) || (S_ISLNK(prg_info.st_mode))) {
++ log_err("error: cannot stat program: (%s)\n", passedargv[0]);
+ exit(117);
+ }
+
+@@ -519,7 +774,7 @@
+ * Error out if the program is writable by others.
+ */
+ if ((prg_info.st_mode & S_IWOTH) || (prg_info.st_mode & S_IWGRP)) {
+- log_err("error: file is writable by others: (%s/%s)\n", cwd, cmd);
++ log_err("error: file is writable by others: (%s/%s)\n", cwd, passedargv[0]);
+ exit(118);
+ }
+
+@@ -527,7 +782,7 @@
+ * Error out if the file is setuid or setgid.
+ */
+ if ((prg_info.st_mode & S_ISUID) || (prg_info.st_mode & S_ISGID)) {
+- log_err("error: file is either setuid or setgid: (%s/%s)\n", cwd, cmd);
++ log_err("error: file is either setuid or setgid: (%s/%s)\n", cwd, passedargv[0]);
+ exit(119);
+ }
+
+@@ -552,7 +807,7 @@
+ * "[error] Premature end of script headers: ..."
+ */
+ if (!(prg_info.st_mode & S_IXUSR)) {
+- log_err("error: file has no execute permission: (%s/%s)\n", cwd, cmd);
++ log_err("error: file has no execute permission: (%s/%s)\n", cwd, passedargv[0]);
+ exit(121);
+ }
+
+@@ -584,6 +839,8 @@
+ /*
+ * Execute the command, replacing our image with its own.
+ */
++ execv(passedargv[0], passedargv);
++#if 0
+ #ifdef NEED_HASHBANG_EMUL
+ /* We need the #! emulation when we want to execute scripts */
+ {
+@@ -594,7 +851,7 @@
+ #else /*NEED_HASHBANG_EMUL*/
+ execv(cmd, &argv[3]);
+ #endif /*NEED_HASHBANG_EMUL*/
+-
++#endif
+ /*
+ * (I can't help myself...sorry.)
+ *
+@@ -604,5 +861,10 @@
+ * Oh well, log the failure and error out.
+ */
+ log_err("emerg: (%d)%s: exec failed (%s)\n", errno, strerror(errno), cmd);
++
++ for (ind=0;passedargv[ind];++ind) free(passedargv[ind]);
++ free(passedargv);
++ passedargv=0;
++
+ exit(255);
+ }
diff --git a/net-www/apache/files/patches/1.3.31-r2/00_gentoo_db4_detect.patch b/net-www/apache/files/patches/1.3.31-r2/00_gentoo_db4_detect.patch
new file mode 100644
index 000000000000..1a5242366fad
--- /dev/null
+++ b/net-www/apache/files/patches/1.3.31-r2/00_gentoo_db4_detect.patch
@@ -0,0 +1,29 @@
+diff -Naur apache_1.3.31/src/modules/standard/mod_auth_db.module apache_1.3.31-gentoo/src/modules/standard/mod_auth_db.module
+--- apache_1.3.31/src/modules/standard/mod_auth_db.module 2001-10-16 09:12:02.000000000 +0000
++++ apache_1.3.31-gentoo/src/modules/standard/mod_auth_db.module 2004-05-08 10:17:13.716667920 +0000
+@@ -2,7 +2,24 @@
+ ConfigStart
+ DB_VERSION=''
+ DB_LIB=''
+- if ./helpers/TestCompile func db_create; then
++
++ if ./helpers/TestCompile lib db-4 db_create_4000; then
++ DB_VERSION='Berkeley-DB/4.x'
++ DB_LIB='-ldb-4'
++ CFLAGS="$CFLAGS -I/usr/include/db4"
++ elif ./helpers/TestCompile lib db-4.0 db_create_4000; then
++ DB_VERSION='Berkeley-DB/4.x'
++ DB_LIB='-ldb-4.0'
++ CFLAGS="$CFLAGS -I/usr/include/db4"
++ elif ./helpers/TestCompile lib db-4.1 db_create_4001; then
++ DB_VERSION='Berkeley-DB/4.1'
++ DB_LIB='-ldb-4.1'
++ CFLAGS="$CFLAGS -I/usr/include/db4.1"
++ elif ./helpers/TestCompile lib db-4.2 db_create_4002; then
++ DB_VERSION='Berkeley-DB/4.2'
++ DB_LIB='-ldb-4.2'
++ CFLAGS="$CFLAGS -I/usr/include/db4.2"
++ elif ./helpers/TestCompile func db_create; then
+ DB_VERSION='Berkeley-DB/3.x'
+ elif ./helpers/TestCompile lib db db_create; then
+ DB_VERSION='Berkeley-DB/3.x'
diff --git a/net-www/apache/files/patches/1.3.31-r2/00_gentoo_suexec_pam.patch b/net-www/apache/files/patches/1.3.31-r2/00_gentoo_suexec_pam.patch
new file mode 100644
index 000000000000..cad50147b683
--- /dev/null
+++ b/net-www/apache/files/patches/1.3.31-r2/00_gentoo_suexec_pam.patch
@@ -0,0 +1,70 @@
+diff -ur apache_1.3.27/src/support/Makefile.tmpl apache_1.3.27.old/src/support/Makefile.tmpl~
+--- apache_1.3.27/src/support/Makefile.tmpl Sat Mar 2 20:46:23 2002
++++ apache_1.3.27.old/src/support/Makefile.tmpl Mon Nov 4 14:33:14 2002
+@@ -49,6 +49,8 @@
+ -e 's%@LDFLAGS_MOD_SHLIB@%$(LDFLAGS_MOD_SHLIB)%g' \
+ -e 's%@LIBS_SHLIB@%$(LIBS_SHLIB)%g' && chmod a+x apxs
+
++suexec: CFLAGS += -DSUEXEC_PAM_SESSION
++suexec: LIBS += -lpam
+ suexec: suexec.o
+ $(CC) $(CFLAGS) -o suexec $(LDFLAGS) suexec.o $(LIBS)
+
+diff -ur apache_1.3.27/src/support/suexec.c apache_1.3.27.old/src/support/suexec.c
+--- apache_1.3.27/src/support/suexec.c Mon Nov 4 14:30:16 2002
++++ apache_1.3.27.old/src/support/suexec.c Mon Nov 4 14:35:45 2002
+@@ -92,6 +92,10 @@
+ #include <stdarg.h>
+ #include <strings.h>
+
++#ifdef SUEXEC_PAM_SESSION
++#include <security/pam_appl.h>
++#endif
++
+ #include "suexec.h"
+
+ /*
+@@ -848,6 +852,43 @@
+ #endif /* SUEXEC_UMASK */
+ clean_env();
+
++#ifdef SUEXEC_PAM_SESSION
++ /*
++ * Use PAM session support. Initial goal was to use the pam_limits module.
++ */
++
++#ifndef PAM_SERVICE_NAME
++#define PAM_SERVICE_NAME "suexec"
++#endif /* PAM_SERVICE_NAME */
++
++#define PAM_CALL(call, name, err_code, do_end) \
++ do \
++ { \
++ rc = (call); \
++ if (rc != PAM_SUCCESS) \
++ { \
++ log_err("error: %s(): [%d] %s\n", (name), rc, pam_strerror(pamh, rc)); \
++ (do_end) && pam_end(pamh, rc); \
++ exit(err_code); \
++ } \
++ } while (0)
++
++ {
++ int rc;
++ pam_handle_t *pamh = NULL;
++ struct pam_conv pamc = { NULL, NULL };
++
++ PAM_CALL(pam_start(PAM_SERVICE_NAME, actual_uname, &pamc, &pamh),
++ "pam_start", 241, 0);
++ PAM_CALL(pam_open_session(pamh, 0), "pam_open_session", 242, 1);
++ PAM_CALL(pam_close_session(pamh, 0), "pam_close_session", 243, 1);
++ PAM_CALL(pam_end(pamh, 0), "pam_end", 244, 0);
++ }
++
++#undef PAM_CALL
++#undef PAM_SERVICE_NAME
++#endif /* SUEXEC_PAM_SESSION */
++
+ /*
+ * Be sure to close the log file so the CGI can't
+ * mess with it. If the exec fails, it will be reopened