NTSTATUS smb_probe_module(const char *subsystem, const char *module) { char *full_path = NULL; TALLOC_CTX *ctx = talloc_stackframe(); NTSTATUS status; /* Check for absolute path */ /* 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] == '/') { status = do_smb_load_module(module, True); TALLOC_FREE(ctx); return status; } full_path = talloc_asprintf(ctx, "%s/%s.%s", modules_path(subsystem), module, shlib_ext()); if (!full_path) { TALLOC_FREE(ctx); return NT_STATUS_NO_MEMORY; } DEBUG(5, ("Probing module '%s': Trying to load from %s\n", module, full_path)); status = do_smb_load_module(full_path, True); TALLOC_FREE(ctx); return status; }
/* Load all modules in list and return number of * modules that has been successfully loaded */ int smb_load_modules(const char **modules) { int i; int success = 0; for(i = 0; modules[i]; i++){ if(NT_STATUS_IS_OK(do_smb_load_module(NULL, modules[i], false))) { success++; } } DEBUG(2, ("%d modules successfully loaded\n", success)); return success; }
NTSTATUS smb_load_module(const char *module_name) { return do_smb_load_module(module_name, False); }
NTSTATUS smb_load_module(const char *subsystem, const char *module) { return do_smb_load_module(subsystem, module, false); }
NTSTATUS smb_probe_module(const char *subsystem, const char *module) { return do_smb_load_module(subsystem, module, true); }