Make init_module() and thus smb_load_module() return an int.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 20 Feb 2003 22:26:28 +0000 (22:26 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 20 Feb 2003 22:26:28 +0000 (22:26 +0000)
modules/developer.c: init_module() should return an int
(This used to be commit 7f59703550378ff2333e3c851bf1a77037510abd)

source3/include/smb.h
source3/lib/module.c
source3/modules/developer.c
source3/rpc_server/srv_pipe.c

index f96a19954a24770b395f273224e6b339bdd33526..71051e341e16f2119c006ffe823f5f0870155eab 100644 (file)
@@ -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 */
index 6febe8a9f1644df14f90bdbabea3e06eaa3e8c35..dd94f799506fd7004876d3adea1b07cdf8b1e17e 100644 (file)
 #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)
index c12bbc562ad1e3d7c889f4013f9651cd925679a8..a697abcd22f76c5539b19f34a42c0deffd639971 100644 (file)
@@ -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;
 }
index 0b8b7b229aac1cf51a9d78d076dbebfa74177211..f6deac68f8281684f6d4206ac58ac93f91755f0e 100644 (file)
@@ -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))