[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha4-91-g1b06210

Andrew Tridgell tridge at samba.org
Tue Jun 17 03:12:25 GMT 2008


The branch, v4-0-test has been updated
       via  1b0621068998590e7b1e9528b78744dcd2cd5909 (commit)
      from  649f6c0c1084828dda7d50bd2904208192de77da (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 1b0621068998590e7b1e9528b78744dcd2cd5909
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Jun 17 13:11:29 2008 +1000

    Change our module code to not use the special symbol name init_module()
    
    Current glibc libraries include a function called init_module(). If we
    use the same name, then a dlsym() can find the glibc function if the
    module doesn't have an initialisation function.
    
    In ldb, none of our modules have an init_module(), so we end up calling the libc
    functions with bogus arguments.

-----------------------------------------------------------------------

Summary of changes:
 source/include/includes.h           |    6 ++++++
 source/lib/ldb/common/ldb.c         |   10 ----------
 source/lib/ldb/common/ldb_modules.c |   10 ----------
 source/param/util.c                 |    2 +-
 4 files changed, 7 insertions(+), 21 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/includes.h b/source/include/includes.h
index 1a92e46..df0d8f7 100644
--- a/source/include/includes.h
+++ b/source/include/includes.h
@@ -54,4 +54,10 @@
 #define TALLOC_ABORT(reason) smb_panic(reason)
 #endif
 
+/* this needs to be a string which is not in the C library. We
+   previously used "init_module", but that meant that modules which
+   did not define this function ended up calling the C library
+   function init_module() which makes a system call */
+#define SAMBA_INIT_MODULE "samba_init_module"
+
 #endif /* _INCLUDES_H */
diff --git a/source/lib/ldb/common/ldb.c b/source/lib/ldb/common/ldb.c
index d0570c5..cac0a38 100644
--- a/source/lib/ldb/common/ldb.c
+++ b/source/lib/ldb/common/ldb.c
@@ -185,16 +185,6 @@ int ldb_connect_backend(struct ldb_context *ldb,
 	fn = ldb_find_backend(backend);
 
 	if (fn == NULL) {
-		int (*init_fn) (void);
-
-		init_fn = ldb_dso_load_symbol(ldb, backend,
-					      "init_module");
-		if (init_fn != NULL && init_fn() == 0) {
-			fn = ldb_find_backend(backend);
-		}
-	}
-
-	if (fn == NULL) {
 		struct ldb_backend_ops *ops;
 		char *symbol_name = talloc_asprintf(ldb, "ldb_%s_backend_ops", backend);
 		if (symbol_name == NULL) {
diff --git a/source/lib/ldb/common/ldb_modules.c b/source/lib/ldb/common/ldb_modules.c
index ddbe0f2..fbfb5e5 100644
--- a/source/lib/ldb/common/ldb_modules.c
+++ b/source/lib/ldb/common/ldb_modules.c
@@ -224,16 +224,6 @@ int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, str
 		
 		ops = ldb_find_module_ops(module_list[i]);
 		if (ops == NULL) {
-			int (*init_fn) (void);
-
-			init_fn = ldb_dso_load_symbol(ldb, module_list[i], 
-						      "init_module");
-			if (init_fn != NULL && init_fn() == 0) {
-				ops = ldb_find_module_ops(module_list[i]);
-			}
-		}
-
-		if (ops == NULL) {
 			char *symbol_name = talloc_asprintf(ldb, "ldb_%s_module_ops", 
 												module_list[i]);
 			if (symbol_name == NULL) {
diff --git a/source/param/util.c b/source/param/util.c
index 15e3b47..ec19293 100644
--- a/source/param/util.c
+++ b/source/param/util.c
@@ -182,7 +182,7 @@ init_module_fn load_module(TALLOC_CTX *mem_ctx, const char *path)
 		return NULL;
 	}
 
-	init_fn = dlsym(handle, "init_module");
+	init_fn = dlsym(handle, SAMBA_INIT_MODULE);
 
 	if (init_fn == NULL) {
 		DEBUG(0, ("Unable to find init_module() in %s: %s\n", path, dlerror()));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list