]> granicus.if.org Git - apache/commitdiff
Add a new directive EnableExceptionHook that must be specified for
authorJeff Trawick <trawick@apache.org>
Thu, 19 Feb 2004 11:19:43 +0000 (11:19 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 19 Feb 2004 11:19:43 +0000 (11:19 +0000)
exception hooks to be called (in addition to the build time
requirements).

The 2.1-dev feature is now more aligned with the 1.3.30-dev feature,
in that there is a build-time requirement as well as a configuration
requirement.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102686 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/mpm_common.h
server/core.c
server/mpm_common.c

diff --git a/CHANGES b/CHANGES
index 08ac9f1eaf0a54cf4789e95e944ee19138a7cb04..efec25930d56be981bf07763d4a06e3b754a5c2e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -97,9 +97,10 @@ Changes with Apache 2.1.0-dev
      directory, display the MPM name and some MPM properties.
      [Geoffrey Young <geoff apache.org>]
 
-  *) Add fatal exception hook for use by debug modules.  The hook is only
-     available if the --enable-exception-hook configure parm is used.
-     [Jeff Trawick]
+  *) Add fatal exception hook for use by diagnostic modules.  The hook
+     is only available if the --enable-exception-hook configure parm 
+     is used and the EnableExceptionHook directive has been set to 
+     "on".  [Jeff Trawick]
 
   *) mod_ssl/mod_status: Re-enable support for output of SSL session
      cache information in server-status page.  [Joe Orton]
index 4636df5db19b38f6a418cd6d17c37bf73859d48d..13d7afd9bb8b79ab094bf33201ffef9d3dcb1129 100644 (file)
@@ -254,6 +254,11 @@ extern apr_status_t ap_fatal_signal_setup(server_rec *s, apr_pool_t *pconf);
 extern apr_status_t ap_fatal_signal_child_setup(server_rec *s);
 #endif
 
+#if AP_ENABLE_EXCEPTION_HOOK
+extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
+                                             const char *arg);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
index 826e5fe2db39313a26c705460d32cf81f9ae640b..2bd91f1355e4f6d0877a9daf5f9e77f91c24a5a7 100644 (file)
@@ -3231,6 +3231,10 @@ AP_INIT_TAKE1("AcceptMutex", ap_mpm_set_accept_lock_mech, NULL, RSRC_CONF,
 AP_INIT_TAKE1("MaxMemFree", ap_mpm_set_max_mem_free, NULL, RSRC_CONF,
               "Maximum number of 1k blocks a particular childs allocator may hold."),
 #endif
+#if AP_ENABLE_EXCEPTION_HOOK
+AP_INIT_TAKE1("EnableExceptionHook", ap_mpm_set_exception_hook, NULL, RSRC_CONF,
+              "Controls whether exception hook may be called after a crash"),
+#endif
 { NULL }
 };
 
index 5ccbaff4e53c68103cfd5722d3855b538601ee31..d814984b5a26a41b16e7a1e0181b53bcca0c0de6 100644 (file)
@@ -879,6 +879,34 @@ static pid_t parent_pid, my_pid;
 apr_pool_t *pconf;
 
 #if AP_ENABLE_EXCEPTION_HOOK
+
+static int exception_hook_enabled;
+
+const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
+                                      const char *arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    if (cmd->server->is_virtual) {
+       return "EnableExceptionHook directive not allowed in <VirtualHost>";
+    }
+
+    if (strcasecmp(arg, "on") == 0) {
+        exception_hook_enabled = 1;
+    }
+    else if (strcasecmp(arg, "off") == 0) {
+        exception_hook_enabled = 0;
+    }
+    else {
+        return "parameter must be 'on' or 'off'";
+    }
+
+    return NULL;
+}
+
 APR_HOOK_STRUCT(
     APR_HOOK_LINK(fatal_exception)
 )
@@ -890,7 +918,8 @@ static void run_fatal_exception_hook(int sig)
 {
     ap_exception_info_t ei = {0};
 
-    if (geteuid() != 0 && 
+    if (exception_hook_enabled &&
+        geteuid() != 0 && 
         my_pid != parent_pid) {
         ei.sig = sig;
         ei.pid = my_pid;