Index: module.c =================================================================== RCS file: /data/cvs/samba/source/lib/module.c,v retrieving revision 1.6.2.10 diff -c -u -r1.6.2.10 module.c --- module.c 15 Aug 2003 04:42:03 -0000 1.6.2.10 +++ module.c 4 Sep 2003 02:00:54 -0000 @@ -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 @@ 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 @@ 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 @@ 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 @@ /* 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 @@ 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 */