summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/module.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/source3/lib/module.c b/source3/lib/module.c
index d860cba819..e2c6f6dcf5 100644
--- a/source3/lib/module.c
+++ b/source3/lib/module.c
@@ -23,7 +23,11 @@
#include "includes.h"
#ifdef HAVE_DLOPEN
-NTSTATUS smb_load_module(const char *module_name)
+
+/* Load a dynamic module. Only log a level 0 error if we are not checking
+ for the existence of a module (probling). */
+
+static NTSTATUS do_smb_load_module(const char *module_name, BOOL is_probe)
{
void *handle;
init_module_function *init;
@@ -37,7 +41,10 @@ NTSTATUS smb_load_module(const char *module_name)
handle = sys_dlopen(module_name, RTLD_LAZY);
if(!handle) {
- DEBUG(0, ("Error loading module '%s': %s\n", module_name, sys_dlerror()));
+ int level = is_probe ? 2 : 0;
+ DEBUG(level, ("Error loading module '%s': %s\n", module_name,
+ sys_dlerror()));
+
return NT_STATUS_UNSUCCESSFUL;
}
@@ -47,7 +54,8 @@ NTSTATUS smb_load_module(const char *module_name)
sys_dlsym() can validly return NULL */
error = sys_dlerror();
if (error) {
- DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", module_name, error));
+ DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n",
+ module_name, error));
return NT_STATUS_UNSUCCESSFUL;
}
@@ -58,6 +66,11 @@ NTSTATUS smb_load_module(const char *module_name)
return status;
}
+NTSTATUS smb_load_module(const char *module_name)
+{
+ return do_smb_load_module(module_name, False);
+}
+
/* Load all modules in list and return number of
* modules that has been successfully loaded */
int smb_load_modules(const char **modules)
@@ -85,8 +98,11 @@ NTSTATUS smb_probe_module(const char *subsystem, const char *module)
/* if we make any 'samba multibyte string'
calls here, we break
for loading string modules */
+
+ DEBUG(5, ("Probing module '%s'\n", module));
+
if (module[0] == '/')
- return smb_load_module(module);
+ return do_smb_load_module(module, True);
pstrcpy(full_path, lib_path(subsystem));
pstrcat(full_path, "/");
@@ -94,9 +110,9 @@ NTSTATUS smb_probe_module(const char *subsystem, const char *module)
pstrcat(full_path, ".");
pstrcat(full_path, shlib_ext());
- DEBUG(5, ("Probing module %s: Trying to load from %s\n", module, full_path));
+ DEBUG(5, ("Probing module '%s': Trying to load from %s\n", module, full_path));
- return smb_load_module(full_path);
+ return do_smb_load_module(full_path, True);
}
#else /* HAVE_DLOPEN */