You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ge...@apache.org on 2004/09/08 15:35:12 UTC
cvs commit: apache-1.3/src/modules/standard mod_so.c
geoff 2004/09/08 06:35:12
Modified: src CHANGES
src/modules/standard mod_so.c
Log:
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.
Revision Changes Path
1.1954 +5 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1953
retrieving revision 1.1954
diff -u -r1.1953 -r1.1954
--- CHANGES 2 Sep 2004 09:37:38 -0000 1.1953
+++ CHANGES 8 Sep 2004 13:35:12 -0000 1.1954
@@ -1,5 +1,10 @@
Changes with Apache 1.3.32
+ *) 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, Geoffrey Young]
+
*) Fix trivial bug in mod_log_forensic that caused the child
to seg fault when certain invalid requests were fired at it with
forensic logging is enabled. PR 29313.
1.43 +40 -0 apache-1.3/src/modules/standard/mod_so.c
Index: mod_so.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_so.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- mod_so.c 20 Feb 2004 20:38:27 -0000 1.42
+++ mod_so.c 8 Sep 2004 13:35:12 -0000 1.43
@@ -182,6 +182,7 @@
/*
* 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);
@@ -194,6 +195,45 @@
return NULL;
}
}
+
+ for (i = 0; ap_preloaded_modules[i]; i++) {
+ const char *preload_name;
+ size_t preload_len;
+ 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 ap_pstrcat(cmd->pool, "module ", modname,
+ " is built-in and can't be loaded",
+ NULL);
+ }
+ }
+
modi = ap_push_array(sconf->loaded_modules);
modi->name = modname;