On Wed, Apr 11, 2018 at 5:49 PM, Yann Ylavic <ylavic....@gmail.com> wrote:
> Maybe we need a global EXEC_ON_READ setting (before any vhost) to
> control/ignore AP_MODULE_FLAG_ALWAYS_MERGE?

Something like the attached possibly...
Index: include/http_config.h
===================================================================
--- include/http_config.h	(revision 1828882)
+++ include/http_config.h	(working copy)
@@ -545,6 +545,12 @@ AP_DECLARE(void) ap_set_module_config(ap_conf_vect
  */
 AP_DECLARE(int) ap_get_module_flags(const module *m);
 
+/**
+ * Module flags to be ignored
+ * @var module ap_module_flags_umask
+ */
+AP_DECLARE_DATA extern int ap_module_flags_umask;
+
 #if !defined(AP_DEBUG)
 
 #define ap_get_module_config(v,m)       \
Index: server/core.c
===================================================================
--- server/core.c	(revision 1828882)
+++ server/core.c	(working copy)
@@ -4018,6 +4018,21 @@ static const char *set_http_method(cmd_parms *cmd,
     return NULL;
 }
 
+static const char *set_module_flags_umask(cmd_parms *cmd, void *dummy,
+                                          const char *arg)
+{
+    long umask;
+    char *end;
+
+    umask = strtol(arg, &end, 0);
+    if (*end || (umask & ~APR_INT32_MIN)) {
+        return "Invalid ModuleFlagsUmask";
+    }
+    
+    ap_module_flags_umask = (int)umask;
+    return NULL;
+}
+
 static apr_hash_t *errorlog_hash;
 
 static int log_constant_item(const ap_errorlog_info *info, const char *arg,
@@ -4551,6 +4566,8 @@ AP_INIT_ITERATE("HttpProtocolOptions", set_http_pr
                 "'Unsafe' or 'Strict' (default). Sets HTTP acceptance rules"),
 AP_INIT_ITERATE("RegisterHttpMethod", set_http_method, NULL, RSRC_CONF,
                 "Registers non-standard HTTP methods"),
+AP_INIT_TAKE1("ModuleFlagsUmask", set_module_flags_umask, NULL, RSRC_CONF | EXEC_ON_READ,
+              "Umask applied to module flags"),
 { NULL }
 };
 
Index: server/util_debug.c
===================================================================
--- server/util_debug.c	(revision 1828882)
+++ server/util_debug.c	(working copy)
@@ -34,6 +34,7 @@
 #undef strstr
 #endif
 
+AP_DECLARE_DATA int ap_module_flags_umask;
 
 #if defined(ap_strchr)
 #undef ap_strchr
@@ -115,7 +116,7 @@ AP_DECLARE(int) ap_get_module_flags(const module *
         return 0;
     }
 
-    return m->flags;
+    return m->flags & ~ap_module_flags_umask;
 }
 
 #if defined(ap_get_core_module_config)

Reply via email to