summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/param.h32
-rw-r--r--source4/param/share.c1
-rw-r--r--source4/param/util.c104
-rw-r--r--source4/param/wscript_build2
4 files changed, 2 insertions, 137 deletions
diff --git a/source4/param/param.h b/source4/param/param.h
index 02837c56d9..3b9a75d65a 100644
--- a/source4/param/param.h
+++ b/source4/param/param.h
@@ -39,14 +39,6 @@ struct smbsrv_connection;
#define Auto (2)
-typedef NTSTATUS (*init_module_fn) (void);
-
-/* 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"
-
#include "libds/common/roles.h"
struct loadparm_context;
@@ -293,30 +285,6 @@ char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
const char *name);
-/**
- * Obtain the init function from a shared library file
- */
-init_module_fn load_module(TALLOC_CTX *mem_ctx, const char *path);
-
-/**
- * Obtain list of init functions from the modules in the specified
- * directory
- */
-init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path);
-
-/**
- * Run the specified init functions.
- *
- * @return true if all functions ran successfully, false otherwise
- */
-bool run_init_functions(init_module_fn *fns);
-
-/**
- * Load the initialization functions from DSO files for a specific subsystem.
- *
- * Will return an array of function pointers to initialization functions
- */
-init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, const char *subsystem);
const char *lpcfg_imessaging_path(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx);
struct smb_iconv_handle *smb_iconv_handle_reinit_lp(TALLOC_CTX *mem_ctx,
diff --git a/source4/param/share.c b/source4/param/share.c
index 477ced7167..da0470d560 100644
--- a/source4/param/share.c
+++ b/source4/param/share.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "param/share.h"
#include "param/param.h"
+#include "lib/util/samba_modules.h"
const char *share_string_option(struct share_config *scfg, const char *opt_name, const char *defval)
{
diff --git a/source4/param/util.c b/source4/param/util.c
index d5b9583795..472096f60d 100644
--- a/source4/param/util.c
+++ b/source4/param/util.c
@@ -236,110 +236,6 @@ char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
return fname;
}
-/**
- * Obtain the init function from a shared library file
- */
-init_module_fn load_module(TALLOC_CTX *mem_ctx, const char *path)
-{
- void *handle;
- void *init_fn;
-
- handle = dlopen(path, RTLD_NOW);
- if (handle == NULL) {
- DEBUG(0, ("Unable to open %s: %s\n", path, dlerror()));
- return NULL;
- }
-
- init_fn = dlsym(handle, SAMBA_INIT_MODULE);
-
- if (init_fn == NULL) {
- DEBUG(0, ("Unable to find %s() in %s: %s\n",
- SAMBA_INIT_MODULE, path, dlerror()));
- DEBUG(1, ("Loading module '%s' failed\n", path));
- dlclose(handle);
- return NULL;
- }
-
- return (init_module_fn)init_fn;
-}
-
-/**
- * Obtain list of init functions from the modules in the specified
- * directory
- */
-init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
-{
- DIR *dir;
- struct dirent *entry;
- char *filename;
- int success = 0;
- init_module_fn *ret = talloc_array(mem_ctx, init_module_fn, 2);
-
- ret[0] = NULL;
-
- dir = opendir(path);
- if (dir == NULL) {
- talloc_free(ret);
- return NULL;
- }
-
- while((entry = readdir(dir))) {
- if (ISDOT(entry->d_name) || ISDOTDOT(entry->d_name))
- continue;
-
- filename = talloc_asprintf(mem_ctx, "%s/%s", path, entry->d_name);
-
- ret[success] = load_module(mem_ctx, filename);
- if (ret[success]) {
- ret = talloc_realloc(mem_ctx, ret, init_module_fn, success+2);
- success++;
- ret[success] = NULL;
- }
-
- talloc_free(filename);
- }
-
- closedir(dir);
-
- return ret;
-}
-
-/**
- * Run the specified init functions.
- *
- * @return true if all functions ran successfully, false otherwise
- */
-bool run_init_functions(init_module_fn *fns)
-{
- int i;
- bool ret = true;
-
- if (fns == NULL)
- return true;
-
- for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i]()); }
-
- return ret;
-}
-
-/**
- * Load the initialization functions from DSO files for a specific subsystem.
- *
- * Will return an array of function pointers to initialization functions
- */
-
-init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, const char *subsystem)
-{
- char *path = modules_path(mem_ctx, subsystem);
- init_module_fn *ret;
-
- ret = load_modules(mem_ctx, path);
-
- talloc_free(path);
-
- return ret;
-}
-
const char *lpcfg_imessaging_path(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx)
{
diff --git a/source4/param/wscript_build b/source4/param/wscript_build
index a35463799a..91e128f916 100644
--- a/source4/param/wscript_build
+++ b/source4/param/wscript_build
@@ -32,7 +32,7 @@ bld.SAMBA_SUBSYSTEM('PROVISION',
bld.SAMBA_SUBSYSTEM('share',
source='share.c',
public_headers='share.h',
- deps='samba-util'
+ deps='samba-util samba-modules'
)