Use the new modules stuff to load dynrpc modules. Basically this means:
authorJelmer Vernooij <jelmer@samba.org>
Tue, 18 Feb 2003 18:34:48 +0000 (18:34 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 18 Feb 2003 18:34:48 +0000 (18:34 +0000)
- 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)

source3/rpc_server/srv_dfs.c
source3/rpc_server/srv_lsa.c
source3/rpc_server/srv_netlog.c
source3/rpc_server/srv_pipe.c
source3/rpc_server/srv_reg.c
source3/rpc_server/srv_samr.c
source3/rpc_server/srv_spoolss.c
source3/rpc_server/srv_srvsvc.c
source3/rpc_server/srv_wkssvc.c

index f6e9ca3d567ba295e6ba2a42ca400fc53cc5cf10..14c1cb4088edaea0de6fca414fd718f2e90d1e25 100644 (file)
@@ -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
index fad8f5641abef0cb25a27f0c2b2356dd1b0f23d5..0e4039326b6aac8c302ba390ba852a4c467d4f03 100644 (file)
@@ -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
index f377d3952bf038aa5d9afd61b9a0e8d65ca09155..c9e4fc1b1f621d30f765c44e1247f0511b4f71c0 100644 (file)
@@ -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
index 50127005a101f16acc20501277d2d3bcca6c68aa..0b8b7b229aac1cf51a9d78d076dbebfa74177211 100644 (file)
@@ -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))
index 04960f8e3a3c54c5c70cf65cddff99033a0ef1fd..8fc1d42b2fb09c2a93d59211ab1cc0f68f6e8871 100644 (file)
@@ -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
index 3a31ec82e14e28a692553e262bb6620f80711a28..b75195ceefd9433428fbe3655f841ac1c1f3a83a 100644 (file)
@@ -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
index 5832ae876bfed0f59e03b75ae685179b73b1c6fe..3023922a5b31f6efa255e222556f1ae7d3d0cb8d 100755 (executable)
@@ -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
index 983c660965129528c7d91e54ff823c4404a4c484..7c5e317c8776a1c4c4e679bf31badff3d33a533a 100644 (file)
@@ -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
index 1fed2cc6db0853443b0c826132d38d3e1300caea..e0d662ea8018efaf5fb641d352b068101058a1c5 100644 (file)
@@ -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