1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-05 21:57:51 +03:00

Quieten level 0 debug when probing for modules. We shouldn't display so loud

an error when a smb_probe_module() fails.  Also tidy up debugs a bit.

Bug 375.
This commit is contained in:
Tim Potter -
parent ef140d15ea
commit 24a1720472

View File

@ -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 */