diff options
author | Lars Wendler <polynomial-c@gentoo.org> | 2014-08-16 11:52:46 +0000 |
---|---|---|
committer | Lars Wendler <polynomial-c@gentoo.org> | 2014-08-16 11:52:46 +0000 |
commit | 864d13b2b3e833a10e8b7599327025462d7eb174 (patch) | |
tree | c57b707ae22a9ae56208860c5e5cb1037c4657ca /www-servers | |
parent | amd64 stable, bug #519734 (diff) | |
download | gentoo-2-864d13b2b3e833a10e8b7599327025462d7eb174.tar.gz gentoo-2-864d13b2b3e833a10e8b7599327025462d7eb174.tar.bz2 gentoo-2-864d13b2b3e833a10e8b7599327025462d7eb174.zip |
Removed vulnerable versions
(Portage version: 2.2.12/cvs/Linux x86_64, signed Manifest commit with key 0x981CA6FC)
Diffstat (limited to 'www-servers')
-rw-r--r-- | www-servers/apache/ChangeLog | 8 | ||||
-rw-r--r-- | www-servers/apache/apache-2.2.27.ebuild | 126 | ||||
-rw-r--r-- | www-servers/apache/apache-2.4.9-r3.ebuild | 227 | ||||
-rw-r--r-- | www-servers/apache/files/00_systemd.conf | 2 | ||||
-rw-r--r-- | www-servers/apache/files/2.2.22-envvars-std.in | 28 | ||||
-rw-r--r-- | www-servers/apache/files/apache2.4.service | 20 | ||||
-rw-r--r-- | www-servers/apache/files/gentoo-apache-2.2.23-initd_fixups.patch | 40 | ||||
-rw-r--r-- | www-servers/apache/files/httpd-2.4.3-mod_systemd.patch | 163 |
8 files changed, 7 insertions, 607 deletions
diff --git a/www-servers/apache/ChangeLog b/www-servers/apache/ChangeLog index b0b23f450c85..d0a967b0e070 100644 --- a/www-servers/apache/ChangeLog +++ b/www-servers/apache/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for www-servers/apache # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/ChangeLog,v 1.289 2014/08/10 20:08:18 slyfox Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/ChangeLog,v 1.290 2014/08/16 11:52:46 polynomial-c Exp $ + + 16 Aug 2014; Lars Wendler <polynomial-c@gentoo.org> -apache-2.2.27.ebuild, + -apache-2.4.9-r3.ebuild, -files/00_systemd.conf, + -files/httpd-2.4.3-mod_systemd.patch, -files/2.2.22-envvars-std.in, + -files/apache2.4.service, -files/gentoo-apache-2.2.23-initd_fixups.patch: + Removed vulnerable versions. 10 Aug 2014; Sergei Trofimovich <slyfox@gentoo.org> apache-2.2.27-r4.ebuild, apache-2.2.27.ebuild, apache-2.4.10-r1.ebuild, apache-2.4.9-r3.ebuild: diff --git a/www-servers/apache/apache-2.2.27.ebuild b/www-servers/apache/apache-2.2.27.ebuild deleted file mode 100644 index e430325dd712..000000000000 --- a/www-servers/apache/apache-2.2.27.ebuild +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/apache-2.2.27.ebuild,v 1.11 2014/08/10 20:08:18 slyfox Exp $ - -EAPI=5 - -# latest gentoo apache files -GENTOO_PATCHSTAMP="20121012" -GENTOO_DEVELOPER="patrick" -GENTOO_PATCHNAME="gentoo-apache-2.2.23" - -# IUSE/USE_EXPAND magic -IUSE_MPMS_FORK="itk peruser prefork" -IUSE_MPMS_THREAD="event worker" - -IUSE_MODULES="actions alias asis auth_basic auth_digest authn_alias authn_anon -authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default -authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta -charset_lite cgi cgid dav dav_fs dav_lock dbd deflate dir disk_cache dumpio -env expires ext_filter file_cache filter headers ident imagemap include info -log_config log_forensic logio mem_cache mime mime_magic negotiation proxy -proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_scgi rewrite -reqtimeout setenvif speling status substitute unique_id userdir usertrack -version vhost_alias" -# The following are also in the source as of this version, but are not available -# for user selection: -# bucketeer case_filter case_filter_in echo http isapi optional_fn_export -# optional_fn_import optional_hook_export optional_hook_import - -# inter-module dependencies -# TODO: this may still be incomplete -MODULE_DEPENDS=" - dav_fs:dav - dav_lock:dav - deflate:filter - disk_cache:cache - ext_filter:filter - file_cache:cache - log_forensic:log_config - logio:log_config - mem_cache:cache - mime_magic:mime - proxy_ajp:proxy - proxy_balancer:proxy - proxy_connect:proxy - proxy_ftp:proxy - proxy_http:proxy - proxy_scgi:proxy - substitute:filter -" - -# module<->define mappings -MODULE_DEFINES=" - auth_digest:AUTH_DIGEST - authnz_ldap:AUTHNZ_LDAP - cache:CACHE - dav:DAV - dav_fs:DAV - dav_lock:DAV - disk_cache:CACHE - file_cache:CACHE - info:INFO - ldap:LDAP - mem_cache:CACHE - proxy:PROXY - proxy_ajp:PROXY - proxy_balancer:PROXY - proxy_connect:PROXY - proxy_ftp:PROXY - proxy_http:PROXY - ssl:SSL - status:STATUS - suexec:SUEXEC - userdir:USERDIR -" - -# critical modules for the default config -MODULE_CRITICAL=" - authz_host - dir - mime -" - -inherit apache-2 systemd toolchain-funcs - -DESCRIPTION="The Apache Web Server" -HOMEPAGE="http://httpd.apache.org/" - -# some helper scripts are Apache-1.1, thus both are here -LICENSE="Apache-2.0 Apache-1.1" -SLOT="2" -KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" -IUSE="" - -DEPEND="${DEPEND} - >=dev-libs/openssl-0.9.8m - apache2_modules_deflate? ( sys-libs/zlib )" - -# dependency on >=dev-libs/apr-1.4.5 for bug #368651 -RDEPEND="${RDEPEND} - >=dev-libs/apr-1.4.5 - >=dev-libs/openssl-0.9.8m - apache2_modules_mime? ( app-misc/mime-types )" - -# init script fixup - should be rolled into next tarball #389965 -src_prepare() { - apache-2_src_prepare - pushd "${GENTOO_PATCHDIR}" &>/dev/null || die - epatch "${FILESDIR}"/gentoo-apache-2.2.23-initd_fixups.patch - popd &>/dev/null || die - cp "${FILESDIR}"/2.2.22-envvars-std.in "${S}"/support/envvars-std.in || die "Failed to apply LD_PRELOAD fix" -} - -src_configure() { - # Brain dead check. - tc-is-cross-compiler && export ap_cv_void_ptr_lt_long="no" - - apache-2_src_configure -} - -src_install() { - apache-2_src_install - - systemd_newunit "${FILESDIR}/apache2.2.service" "apache2.service" - systemd_dotmpfilesd "${FILESDIR}/apache.conf" -} diff --git a/www-servers/apache/apache-2.4.9-r3.ebuild b/www-servers/apache/apache-2.4.9-r3.ebuild deleted file mode 100644 index d95aca28d4c6..000000000000 --- a/www-servers/apache/apache-2.4.9-r3.ebuild +++ /dev/null @@ -1,227 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/www-servers/apache/apache-2.4.9-r3.ebuild,v 1.2 2014/08/10 20:08:18 slyfox Exp $ - -EAPI=5 - -# latest gentoo apache files -GENTOO_PATCHSTAMP="20140522" -GENTOO_DEVELOPER="polynomial-c" -GENTOO_PATCHNAME="gentoo-apache-2.4.9-r3" - -# IUSE/USE_EXPAND magic -IUSE_MPMS_FORK="peruser prefork" -IUSE_MPMS_THREAD="event worker" - -# << obsolete modules: -# authn_default authz_default mem_cache -# mem_cache is replaced by cache_disk -# ?? buggy modules -# proxy_scgi: startup error: undefined symbol "ap_proxy_release_connection", no fix found -# >> added modules for reason: -# compat: compatibility with 2.2 access control -# authz_host: new module for access control -# authn_core: functionality provided by authn_alias in previous versions -# authz_core: new module, provides core authorization capabilities -# cache_disk: replacement for mem_cache -# lbmethod_byrequests: Split off from mod_proxy_balancer in 2.3 -# lbmethod_bytraffic: Split off from mod_proxy_balancer in 2.3 -# lbmethod_bybusyness: Split off from mod_proxy_balancer in 2.3 -# lbmethod_heartbeat: Split off from mod_proxy_balancer in 2.3 -# slotmem_shm: Slot-based shared memory provider (for lbmethod_byrequests). -# socache_shmcb: shared object cache provider. Default config with ssl needs it -# unixd: fixes startup error: Invalid command 'User' -IUSE_MODULES="access_compat actions alias asis auth_basic auth_digest -authn_alias authn_anon authn_core authn_dbd authn_dbm authn_file authz_core -authz_dbd authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex -cache cache_disk cern_meta charset_lite cgi cgid dav dav_fs dav_lock dbd deflate -dir dumpio env expires ext_filter file_cache filter headers ident imagemap -include info lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness -lbmethod_heartbeat log_config log_forensic logio mime mime_magic negotiation -proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_scgi -proxy_fcgi proxy_wstunnel rewrite ratelimit remoteip reqtimeout setenvif -slotmem_shm speling socache_shmcb status substitute unique_id userdir usertrack -unixd version vhost_alias" -# The following are also in the source as of this version, but are not available -# for user selection: -# bucketeer case_filter case_filter_in echo http isapi optional_fn_export -# optional_fn_import optional_hook_export optional_hook_import - -# inter-module dependencies -# TODO: this may still be incomplete -MODULE_DEPENDS=" - dav_fs:dav - dav_lock:dav - deflate:filter - cache_disk:cache - ext_filter:filter - file_cache:cache - lbmethod_byrequests:proxy_balancer - lbmethod_byrequests:slotmem_shm - lbmethod_bytraffic:proxy_balancer - lbmethod_bybusyness:proxy_balancer - lbmethod_heartbeat:proxy_balancer - log_forensic:log_config - logio:log_config - cache_disk:cache - mime_magic:mime - proxy_ajp:proxy - proxy_balancer:proxy - proxy_balancer:slotmem_shm - proxy_connect:proxy - proxy_ftp:proxy - proxy_http:proxy - proxy_scgi:proxy - proxy_fcgi:proxy - proxy_wstunnel:proxy - substitute:filter -" - -# module<->define mappings -MODULE_DEFINES=" - auth_digest:AUTH_DIGEST - authnz_ldap:AUTHNZ_LDAP - cache:CACHE - cache_disk:CACHE - dav:DAV - dav_fs:DAV - dav_lock:DAV - file_cache:CACHE - info:INFO - ldap:LDAP - proxy:PROXY - proxy_ajp:PROXY - proxy_balancer:PROXY - proxy_connect:PROXY - proxy_ftp:PROXY - proxy_http:PROXY - proxy_fcgi:PROXY - proxy_scgi:PROXY - proxy_wstunnel:PROXY - socache_shmcb:SSL - ssl:SSL - status:STATUS - suexec:SUEXEC - userdir:USERDIR -" - -# critical modules for the default config -MODULE_CRITICAL=" - authn_core - authz_core - authz_host - dir - mime - unixd -" -inherit eutils apache-2 systemd toolchain-funcs - -DESCRIPTION="The Apache Web Server" -HOMEPAGE="http://httpd.apache.org/" - -# some helper scripts are Apache-1.1, thus both are here -LICENSE="Apache-2.0 Apache-1.1" -SLOT="2" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" -IUSE="" - -pkg_setup() { - # dependend critical modules which are not allowed in global scope due - # to USE flag conditionals (bug #499260) - use ssl && MODULE_CRITICAL+=" socache_shmcb" - use doc && MODULE_CRITICAL+=" alias negotiation setenvif" - apache-2_pkg_setup -} - -src_configure() { - # Brain dead check. - tc-is-cross-compiler && export ap_cv_void_ptr_lt_long="no" - - apache-2_src_configure -} - -src_compile() { - if tc-is-cross-compiler; then - # This header is the same across targets, so use the build compiler. - pushd server >/dev/null - emake gen_test_char - tc-export_build_env BUILD_CC - ${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} \ - gen_test_char.c -o gen_test_char $(apr-1-config --includes) || die - popd >/dev/null - fi - - default -} - -src_install() { - apache-2_src_install - for i in /usr/bin/{htdigest,logresolve,htpasswd,htdbm,ab,httxt2dbm}; do - rm "${D}"/$i || die "Failed to prune apache-tools bits" - done - for i in /usr/share/man/man8/{rotatelogs.8,htcacheclean.8}; do - rm "${D}"/$i || die "Failed to prune apache-tools bits" - done - for i in /usr/share/man/man1/{logresolve.1,htdbm.1,htdigest.1,htpasswd.1,dbmmanage.1,ab.1}; do - rm "${D}"/$i || die "Failed to prune apache-tools bits" - done - for i in /usr/sbin/{checkgid,fcgistarter,htcacheclean,rotatelogs}; do - rm "${D}/"$i || die "Failed to prune apache-tools bits" - done - - # install apxs in /usr/bin (bug #502384) and put a symlink into the - # old location until all ebuilds and eclasses have been modified to - # use the new location. - local apxs="/usr/bin/apxs" - cp "${S}"/support/apxs "${D}"${apxs} || die "Failed to install apxs" - ln -s ../bin/apxs "${D}"/usr/sbin/apxs || die - chmod 0755 "${D}"${apxs} || die - - # Note: wait for mod_systemd to be included in the next release, - # then apache2.4.service can be used and systemd support controlled - # through --enable-systemd - systemd_newunit "${FILESDIR}/apache2.2.service" "apache2.service" - systemd_dotmpfilesd "${FILESDIR}/apache.conf" - #insinto /etc/apache2/modules.d - #doins "${FILESDIR}/00_systemd.conf" -} - -pkg_postinst() -{ - apache-2_pkg_postinst || die "apache-2_pkg_postinst failed" - # warnings that default config might not work out of the box - for mod in $MODULE_CRITICAL; do - if ! use "apache2_modules_${mod}"; then - echo - ewarn "Warning: Critical module not installed!" - ewarn "Modules 'authn_core', 'authz_core' and 'unixd'" - ewarn "are highly recomended but might not be in the base profile yet." - ewarn "Default config for ssl needs module 'socache_shmcb'." - ewarn "Enabling the following flags is highly recommended:" - for cmod in $MODULE_CRITICAL; do - use "apache2_modules_${cmod}" || \ - ewarn "+ apache2_modules_${cmod}" - done - echo - break - fi - done - # warning for proxy_balancer and missing load balancing scheduler - if use apache2_modules_proxy_balancer; then - local lbset= - for mod in lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat; do - if use "apache2_modules_${mod}"; then - lbset=1 && break - fi - done - if [ ! $lbset ]; then - echo - ewarn "Info: Missing load balancing scheduler algorithm module" - ewarn "(They were split off from proxy_balancer in 2.3)" - ewarn "In order to get the ability of load balancing, at least" - ewarn "one of these modules has to be present:" - ewarn "lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat" - echo - fi - fi -} diff --git a/www-servers/apache/files/00_systemd.conf b/www-servers/apache/files/00_systemd.conf deleted file mode 100644 index b208c972dd50..000000000000 --- a/www-servers/apache/files/00_systemd.conf +++ /dev/null @@ -1,2 +0,0 @@ -# This file configures systemd module: -LoadModule systemd_module modules/mod_systemd.so diff --git a/www-servers/apache/files/2.2.22-envvars-std.in b/www-servers/apache/files/2.2.22-envvars-std.in deleted file mode 100644 index 9493bc749ca2..000000000000 --- a/www-servers/apache/files/2.2.22-envvars-std.in +++ /dev/null @@ -1,28 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# envvars-std - default environment variables for apachectl -# -# This file is generated from envvars-std.in -# -if test "x$@SHLIBPATH_VAR@" != "x" ; then - @SHLIBPATH_VAR@="@exp_libdir@:$@SHLIBPATH_VAR@" -else - @SHLIBPATH_VAR@="@exp_libdir@" -fi -export @SHLIBPATH_VAR@ -# -@OS_SPECIFIC_VARS@ diff --git a/www-servers/apache/files/apache2.4.service b/www-servers/apache/files/apache2.4.service deleted file mode 100644 index ace453f12e50..000000000000 --- a/www-servers/apache/files/apache2.4.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=The Apache HTTP Server -After=network.target remote-fs.target nss-lookup.target - -[Service] -Type=notify -EnvironmentFile=/etc/conf.d/apache2 -ExecStart=/usr/sbin/apache2 $APACHE2_OPTS -DFOREGROUND -ExecReload=/usr/sbin/apache2 $APACHE2_OPTS -k graceful -ExecStop=/usr/sbin/apache2 $APACHE2_OPTS -k graceful-stop -# We want systemd to give httpd some time to finish gracefully, but still want -# it to kill httpd after TimeoutStopSec if something went wrong during the -# graceful stop. Normally, Systemd sends SIGTERM signal right after the -# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give -# httpd time to finish. -KillSignal=SIGCONT -PrivateTmp=true - -[Install] -WantedBy=multi-user.target diff --git a/www-servers/apache/files/gentoo-apache-2.2.23-initd_fixups.patch b/www-servers/apache/files/gentoo-apache-2.2.23-initd_fixups.patch deleted file mode 100644 index 92a073117a11..000000000000 --- a/www-servers/apache/files/gentoo-apache-2.2.23-initd_fixups.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- gentoo-apache-2.2.23/init/apache2.initd -+++ gentoo-apache-2.2.23/init/apache2.initd -@@ -77,12 +77,16 @@ - # Use start stop daemon to apply system limits #347301 - start-stop-daemon --start -- ${APACHE2} ${APACHE2_OPTS} -k start - -- i=0 -- while [ ! -e "${PIDFILE}" ] && [ $i -lt ${TIMEOUT} ]; do -+ local i=0 retval=1 -+ while [ $i -lt ${TIMEOUT} ] ; do -+ if [ -e "${PIDFILE}" ] ; then -+ retval=0 -+ break -+ fi - sleep 1 && i=$(expr $i + 1) - done - -- eend $(test $i -lt ${TIMEOUT}) -+ eend ${retval} - } - - stop() { -@@ -101,13 +105,14 @@ - ebegin "Stopping ${SVCNAME}" - ${APACHE2} ${APACHE2_OPTS} -k stop - -- i=0 -- while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \ -+ local i=0 retval=0 -+ while ( test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \ - && [ $i -lt ${TIMEOUT} ]; do - sleep 1 && i=$(expr $i + 1) - done -+ [ -e "${PIDFILE}" ] && retval=1 - -- eend $(test $i -lt ${TIMEOUT}) -+ eend ${retval} - } - - reload() { diff --git a/www-servers/apache/files/httpd-2.4.3-mod_systemd.patch b/www-servers/apache/files/httpd-2.4.3-mod_systemd.patch deleted file mode 100644 index a9b1fd9910a1..000000000000 --- a/www-servers/apache/files/httpd-2.4.3-mod_systemd.patch +++ /dev/null @@ -1,163 +0,0 @@ ---- httpd-2.4.3/modules/arch/unix/config5.m4.systemd -+++ httpd-2.4.3/modules/arch/unix/config5.m4 -@@ -18,6 +18,19 @@ APACHE_MODULE(privileges, Per-virtualhos - fi - ]) - -+ -+APACHE_MODULE(systemd, Systemd support, , , $unixd_mods_enabled, [ -+ AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") -+ AC_CHECK_HEADERS(systemd/sd-daemon.h, [ap_HAVE_SD_DAEMON_H="yes"], [ap_HAVE_SD_DAEMON_H="no"]) -+ if test $ap_HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; then -+ AC_MSG_WARN([Your system does not support systemd.]) -+ enable_systemd="no" -+ else -+ APR_ADDTO(MOD_SYSTEMD_LDADD, [$SYSTEMD_LIBS]) -+ enable_systemd="yes" -+ fi -+]) -+ - APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current]) - - APACHE_MODPATH_FINISH ---- httpd-2.4.3/modules/arch/unix/mod_systemd.c.systemd -+++ httpd-2.4.3/modules/arch/unix/mod_systemd.c -@@ -0,0 +1,138 @@ -+/* Licensed to the Apache Software Foundation (ASF) under one or more -+ * contributor license agreements. See the NOTICE file distributed with -+ * this work for additional information regarding copyright ownership. -+ * The ASF licenses this file to You under the Apache License, Version 2.0 -+ * (the "License"); you may not use this file except in compliance with -+ * the License. You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ * -+ */ -+ -+#include <stdint.h> -+#include <ap_config.h> -+#include "ap_mpm.h" -+#include <http_core.h> -+#include <http_log.h> -+#include <apr_version.h> -+#include <apr_pools.h> -+#include <apr_strings.h> -+#include "unixd.h" -+#include "scoreboard.h" -+#include "mpm_common.h" -+ -+#include "systemd/sd-daemon.h" -+ -+#if APR_HAVE_UNISTD_H -+#include <unistd.h> -+#endif -+ -+#define KBYTE 1024 -+ -+static pid_t pid; /* PID of the main httpd instance */ -+static int server_limit, thread_limit, threads_per_child, max_servers; -+static time_t last_update_time; -+static unsigned long last_update_access; -+static unsigned long last_update_kbytes; -+ -+static int systemd_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type) -+{ -+ int rv; -+ last_update_time = time(0); -+ -+ ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit); -+ ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit); -+ ap_mpm_query(AP_MPMQ_MAX_THREADS, &threads_per_child); -+ /* work around buggy MPMs */ -+ if (threads_per_child == 0) -+ threads_per_child = 1; -+ ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_servers); -+ -+ pid = getpid(); -+ -+ rv = sd_notifyf(0, "READY=1\n" -+ "STATUS=Processing requests...\n" -+ "MAINPID=%lu", -+ (unsigned long) pid); -+ if (rv < 0) { -+ ap_log_perror(APLOG_MARK, APLOG_ERR, 0, p, -+ "sd_notifyf returned an error %d", rv); -+ } -+ -+ return OK; -+} -+ -+static int systemd_monitor(apr_pool_t *p, server_rec *s) -+{ -+ int i, j, res, rv; -+ process_score *ps_record; -+ worker_score *ws_record; -+ unsigned long access = 0; -+ unsigned long bytes = 0; -+ unsigned long kbytes = 0; -+ char bps[5]; -+ time_t now = time(0); -+ time_t elapsed = now - last_update_time; -+ -+ for (i = 0; i < server_limit; ++i) { -+ ps_record = ap_get_scoreboard_process(i); -+ for (j = 0; j < thread_limit; ++j) { -+ ws_record = ap_get_scoreboard_worker_from_indexes(i, j); -+ if (ap_extended_status && !ps_record->quiescing && ps_record->pid) { -+ res = ws_record->status; -+ if (ws_record->access_count != 0 || -+ (res != SERVER_READY && res != SERVER_DEAD)) { -+ access += ws_record->access_count; -+ bytes += ws_record->bytes_served; -+ if (bytes >= KBYTE) { -+ kbytes += (bytes >> 10); -+ bytes = bytes & 0x3ff; -+ } -+ } -+ } -+ } -+ } -+ -+ apr_strfsize((unsigned long)(KBYTE *(float) (kbytes - last_update_kbytes) -+ / (float) elapsed), bps); -+ -+ rv = sd_notifyf(0, "READY=1\n" -+ "STATUS=Total requests: %lu; Current requests/sec: %.3g; " -+ "Current traffic: %sB/sec\n", access, -+ ((float)access - last_update_access) / (float) elapsed, bps); -+ if (rv < 0) { -+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00000) -+ "sd_notifyf returned an error %d", rv); -+ } -+ -+ last_update_access = access; -+ last_update_kbytes = kbytes; -+ last_update_time = now; -+ -+ return DECLINED; -+} -+ -+static void systemd_register_hooks(apr_pool_t *p) -+{ -+ /* We know the PID in this hook ... */ -+ ap_hook_pre_mpm(systemd_pre_mpm, NULL, NULL, APR_HOOK_LAST); -+ /* Used to update httpd's status line using sd_notifyf */ -+ ap_hook_monitor(systemd_monitor, NULL, NULL, APR_HOOK_MIDDLE); -+} -+ -+module AP_MODULE_DECLARE_DATA systemd_module = -+{ -+ STANDARD20_MODULE_STUFF, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ systemd_register_hooks, -+}; |