]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Trigger an error when a LoadModule directive attempts to
authorJeff Trawick <trawick@apache.org>
Fri, 19 Apr 2002 18:31:20 +0000 (18:31 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 19 Apr 2002 18:31:20 +0000 (18:31 +0000)
load a module which is built-in.  This is a common error when
switching from a DSO build to a static build.

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

CHANGES
modules/mappers/mod_so.c

diff --git a/CHANGES b/CHANGES
index 02728c26f22151257d94cb6d9b96e7eb79e2ae6a..570b88d158d13b31fd309c81a1f025b3d6b1e536 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
 Changes with Apache 2.0.36
 
+  *) Trigger an error when a LoadModule directive attempts to
+     load a module which is built-in.  This is a common error when
+     switching from a DSO build to a static build.  [Jeff Trawick]
+
   *) Change instdso.sh to use libtool --install everywhere and then
      clean up some stray files and symlinks that libtool leaves around
      on some platforms.  This gets subversion building properly since
index be2caf0cd0cd81889480e76d84d0cde5f3dad134..1c32829203662158a6b49440047f701daf1b90f8 100644 (file)
@@ -220,6 +220,7 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
     /* 
      * check for already existing module
      * If it already exists, we have nothing to do 
+     * Check both dynamically-loaded modules and statically-linked modules.
      */
     sconf = (so_server_conf *)ap_get_module_config(cmd->server->module_config, 
                                                &so_module);
@@ -233,6 +234,45 @@ static const char *load_module(cmd_parms *cmd, void *dummy,
             return NULL;
         }
     }
+
+    for (i = 0; ap_preloaded_modules[i]; i++) {
+        const char *preload_name;
+        apr_size_t preload_len;
+        apr_size_t thismod_len;
+
+        modp = ap_preloaded_modules[i];
+
+        /* make sure we're comparing apples with apples
+         * make sure name of preloaded module is mod_FOO.c
+         * make sure name of structure being loaded is FOO_module
+         */
+
+        if (memcmp(modp->name, "mod_", 4)) {
+            continue;
+        }
+
+        preload_name = modp->name + strlen("mod_");
+        preload_len = strlen(preload_name) - 2;
+
+        if (strlen(modname) <= strlen("_module")) {
+            continue;
+        }
+        thismod_len = strlen(modname) - strlen("_module");
+        if (strcmp(modname + thismod_len, "_module")) {
+            continue;
+        }
+
+        if (thismod_len != preload_len) {
+            continue;
+        }
+
+        if (!memcmp(modname, preload_name, preload_len)) {
+            return apr_pstrcat(cmd->pool, "module ", modname,
+                               " is built-in and can't be loaded",
+                               NULL);
+        }
+    }
+
     modi = apr_array_push(sconf->loaded_modules);
     modi->name = modname;