From 8d8a8c9633ea04d269d70b1fa8f4393cc73f7bbd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 20 Feb 2003 22:26:28 +0000 Subject: Make init_module() and thus smb_load_module() return an int. modules/developer.c: init_module() should return an int (This used to be commit 7f59703550378ff2333e3c851bf1a77037510abd) --- source3/include/smb.h | 2 +- source3/lib/module.c | 18 +++++++++--------- source3/modules/developer.c | 2 +- source3/rpc_server/srv_pipe.c | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'source3') diff --git a/source3/include/smb.h b/source3/include/smb.h index f96a19954a..71051e341e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1721,6 +1721,6 @@ extern struct poptOption popt_common_netbios_name[]; extern struct poptOption popt_common_log_base[]; /* Module support */ -typedef NTSTATUS (init_module_function) (void); +typedef int (init_module_function) (void); #endif /* _SMB_H */ diff --git a/source3/lib/module.c b/source3/lib/module.c index 6febe8a9f1..dd94f79950 100644 --- a/source3/lib/module.c +++ b/source3/lib/module.c @@ -22,11 +22,11 @@ #include "includes.h" #ifdef HAVE_DLOPEN -NTSTATUS smb_load_module(const char *module_name) +int smb_load_module(const char *module_name) { void *handle; init_module_function *init; - NTSTATUS nt_status; + int status; const char *error; /* Always try to use LAZY symbol resolving; if the plugin has @@ -37,7 +37,7 @@ NTSTATUS smb_load_module(const char *module_name) if(!handle) { DEBUG(0, ("Error loading module '%s': %s\n", module_name, sys_dlerror())); - return NT_STATUS_UNSUCCESSFUL; + return False; } init = sys_dlsym(handle, "init_module"); @@ -47,14 +47,14 @@ NTSTATUS smb_load_module(const char *module_name) error = sys_dlerror(); if (error) { DEBUG(0, ("Error trying to resolve symbol 'init_module' in %s: %s\n", module_name, error)); - return NT_STATUS_UNSUCCESSFUL; + return False; } - nt_status = init(); + status = init(); DEBUG(2, ("Module '%s' loaded\n", module_name)); - return nt_status; + return status; } /* Load all modules in list and return number of @@ -65,7 +65,7 @@ int smb_load_modules(const char **modules) int success = 0; for(i = 0; modules[i]; i++){ - if(NT_STATUS_IS_OK(smb_load_module(modules[i]))) { + if(smb_load_module(modules[i])) { success++; } } @@ -77,10 +77,10 @@ int smb_load_modules(const char **modules) #else /* HAVE_DLOPEN */ -NTSTATUS smb_load_module(const char *module_name) +int smb_load_module(const char *module_name) { DEBUG(0,("This samba executable has not been build with plugin support")); - return NT_STATUS_NOT_SUPPORTED; + return False; } int smb_load_modules(const char **modules) diff --git a/source3/modules/developer.c b/source3/modules/developer.c index c12bbc562a..a697abcd22 100644 --- a/source3/modules/developer.c +++ b/source3/modules/developer.c @@ -128,5 +128,5 @@ struct charset_functions weird_functions = {"WEIRD", weird_pull, weird_push}; int init_module(void) { smb_register_charset(&weird_functions); - return 0; + return 1; } diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 0b8b7b229a..f6deac68f8 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -794,10 +794,10 @@ int rpc_pipe_register_commands(const char *clnt, const char *srv, const struct a /******************************************************************* Register commands to an RPC pipe *******************************************************************/ -NTSTATUS rpc_load_module(const char *module) +int rpc_load_module(const char *module) { pstring full_path; - NTSTATUS status; + int status; pstrcpy(full_path, lib_path("rpc")); pstrcat(full_path, "/librpc_"); @@ -805,7 +805,7 @@ NTSTATUS rpc_load_module(const char *module) pstrcat(full_path, "."); pstrcat(full_path, shlib_ext()); - if (!NT_STATUS_IS_OK(status = smb_load_module(full_path))) { + if (!(status = smb_load_module(full_path))) { DEBUG(0, ("Could not load requested pipe %s as %s\n", module, full_path)); } @@ -858,7 +858,7 @@ BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) } } - if (!api_fd_commands[i].name && !NT_STATUS_IS_OK(rpc_load_module(p->name))) { + if (!api_fd_commands[i].name && !rpc_load_module(p->name)) { DEBUG(3,("api_pipe_bind_req: Unknown pipe name %s in bind request.\n", p->name )); if(!setup_bind_nak(p)) -- cgit