diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-02-18 18:34:48 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-02-18 18:34:48 +0000 |
commit | c536b88b2b71c264a1e31ada51e463fee5cb949b (patch) | |
tree | 406f7c9d2d1ca7afc1245ddf9487f7106fd91b83 | |
parent | 030beddfb3c5208256c08b3cd2620332113f6308 (diff) | |
download | samba-c536b88b2b71c264a1e31ada51e463fee5cb949b.tar.gz samba-c536b88b2b71c264a1e31ada51e463fee5cb949b.tar.bz2 samba-c536b88b2b71c264a1e31ada51e463fee5cb949b.zip |
Use the new modules stuff to load dynrpc modules. Basically this means:
- calling the initialization function in the module init_module() instead of rpc_pipe_init()
- calling smb_load_module() to do the dlopen(), dlsym() and init_module() calls
I'll merge this to 3.0, together with the smb_load_module() function.
Discussed with Anthony.
(This used to be commit 3757ed8df06ca2b306bef336bdb9c7671f5e6a65)
-rw-r--r-- | source3/rpc_server/srv_dfs.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_lsa.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_netlog.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 31 | ||||
-rw-r--r-- | source3/rpc_server/srv_reg.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr.c | 2 | ||||
-rwxr-xr-x | source3/rpc_server/srv_spoolss.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc.c | 2 | ||||
-rw-r--r-- | source3/rpc_server/srv_wkssvc.c | 2 |
9 files changed, 14 insertions, 33 deletions
diff --git a/source3/rpc_server/srv_dfs.c b/source3/rpc_server/srv_dfs.c index f6e9ca3d56..14c1cb4088 100644 --- a/source3/rpc_server/srv_dfs.c +++ b/source3/rpc_server/srv_dfs.c @@ -159,7 +159,7 @@ static BOOL api_dfs_enum(pipes_struct *p) ********************************************************************/ #ifdef RPC_DFS_DYNAMIC -int rpc_pipe_init(void) +int init_module(void) #else int rpc_dfs_init(void) #endif diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index fad8f5641a..0e4039326b 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -772,7 +772,7 @@ static BOOL api_lsa_remove_acct_rights(pipes_struct *p) ***************************************************************************/ #ifdef RPC_LSA_DYNAMIC -int rpc_pipe_init(void) +int init_module(void) #else int rpc_lsa_init(void) #endif diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c index f377d3952b..c9e4fc1b1f 100644 --- a/source3/rpc_server/srv_netlog.c +++ b/source3/rpc_server/srv_netlog.c @@ -322,7 +322,7 @@ static BOOL api_net_logon_ctrl(pipes_struct *p) ********************************************************************/ #ifdef RPC_NETLOG_DYNAMIC -int rpc_pipe_init(void) +int init_module(void) #else int rpc_net_init(void) #endif diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 50127005a1..0b8b7b229a 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -794,42 +794,23 @@ int rpc_pipe_register_commands(const char *clnt, const char *srv, const struct a /******************************************************************* Register commands to an RPC pipe *******************************************************************/ -int rpc_load_module(const char *module) +NTSTATUS rpc_load_module(const char *module) { -#ifdef HAVE_DLOPEN - void *handle; - int (*module_init)(void); pstring full_path; - char *error; + NTSTATUS status; pstrcpy(full_path, lib_path("rpc")); pstrcat(full_path, "/librpc_"); pstrcat(full_path, module); pstrcat(full_path, "."); pstrcat(full_path, shlib_ext()); - - handle = sys_dlopen(full_path, RTLD_LAZY); - if (!handle) { + + if (!NT_STATUS_IS_OK(status = smb_load_module(full_path))) { DEBUG(0, ("Could not load requested pipe %s as %s\n", module, full_path)); - DEBUG(0, (" Error: %s\n", dlerror())); - return 0; } - DEBUG(3, ("Module '%s' loaded\n", full_path)); - - module_init = sys_dlsym(handle, "rpc_pipe_init"); - if ((error = sys_dlerror()) != NULL) { - DEBUG(0, ("Error trying to resolve symbol 'rpc_pipe_init' in %s: %s\n", - full_path, error)); - return 0; - } - - return module_init(); -#else - DEBUG(0,("Attempting to load a dynamic RPC pipe when dlopen isn't available\n")); - return 0; -#endif + return status; } /******************************************************************* @@ -877,7 +858,7 @@ BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) } } - if (!api_fd_commands[i].name && !rpc_load_module(p->name)) { + if (!api_fd_commands[i].name && !NT_STATUS_IS_OK(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)) diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c index 04960f8e3a..8fc1d42b2f 100644 --- a/source3/rpc_server/srv_reg.c +++ b/source3/rpc_server/srv_reg.c @@ -374,7 +374,7 @@ static BOOL api_reg_save_key(pipes_struct *p) ********************************************************************/ #ifdef RPC_REG_DYNAMIC -int rpc_pipe_init(void) +int init_module(void) #else int rpc_reg_init(void) #endif diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 3a31ec82e1..b75195ceef 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -1444,7 +1444,7 @@ static BOOL api_samr_set_dom_info(pipes_struct *p) ********************************************************************/ #ifdef RPC_SAMR_DYNAMIC -int rpc_pipe_init(void) +int init_module(void) #else int rpc_samr_init(void) #endif diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index 5832ae876b..3023922a5b 100755 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -1581,7 +1581,7 @@ static BOOL api_spoolss_replycloseprinter(pipes_struct *p) ********************************************************************/ #ifdef RPC_SPOOLSS_DYNAMIC -int rpc_pipe_init(void) +int init_module(void) #else int rpc_spoolss_init(void) #endif diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c index 983c660965..7c5e317c87 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -527,7 +527,7 @@ static BOOL api_srv_net_file_set_secdesc(pipes_struct *p) ********************************************************************/ #ifdef RPC_SVC_DYNAMIC -int rpc_pipe_init(void) +int init_module(void) #else int rpc_srv_init(void) #endif diff --git a/source3/rpc_server/srv_wkssvc.c b/source3/rpc_server/srv_wkssvc.c index 1fed2cc6db..e0d662ea80 100644 --- a/source3/rpc_server/srv_wkssvc.c +++ b/source3/rpc_server/srv_wkssvc.c @@ -61,7 +61,7 @@ static BOOL api_wks_query_info(pipes_struct *p) ********************************************************************/ #ifdef RPC_WKS_DYNAMIC -int rpc_pipe_init(void) +int init_module(void) #else int rpc_wks_init(void) #endif |