diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-11-14 22:23:23 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:48 -0500 |
commit | 31ded4901b4529ad2e49871502cab5ecba71483a (patch) | |
tree | 9ee5bf3ede7f672060e843c3c09cf5e9ad5f0fb4 /source4/lib | |
parent | e856a8d83c18820a270ef865d2d7869849ce4e20 (diff) | |
download | samba-31ded4901b4529ad2e49871502cab5ecba71483a.tar.gz samba-31ded4901b4529ad2e49871502cab5ecba71483a.tar.bz2 samba-31ded4901b4529ad2e49871502cab5ecba71483a.zip |
r3737: - Get rid of the register_subsystem() and register_backend() functions.
- Re-disable tdbtool (it was building fine on my Debian box but other
machines were having problems)
(This used to be commit 0d7bb2c40b7a9ed59df3f8944133ea562697e814)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/basic.mk | 1 | ||||
-rw-r--r-- | source4/lib/dcom/common/tables.c | 21 | ||||
-rw-r--r-- | source4/lib/dcom/config.mk | 1 | ||||
-rw-r--r-- | source4/lib/iconv.c | 19 | ||||
-rw-r--r-- | source4/lib/module.c | 172 | ||||
-rw-r--r-- | source4/lib/registry/common/reg_interface.c | 15 | ||||
-rw-r--r-- | source4/lib/registry/config.mk | 1 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_dir/reg_backend_dir.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_w95/reg_backend_w95.c | 2 | ||||
-rw-r--r-- | source4/lib/tdb/config.mk | 1 |
14 files changed, 10 insertions, 233 deletions
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 68f41db089..7360eddf94 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -66,7 +66,6 @@ ADD_OBJ_FILES = \ lib/select.o \ lib/pam_errors.o \ intl/lang_tdb.o \ - lib/module.o \ lib/mutex.o \ lib/events.o \ lib/server_mutex.o \ diff --git a/source4/lib/dcom/common/tables.c b/source4/lib/dcom/common/tables.c index d6b7cfa78f..f9f1c49380 100644 --- a/source4/lib/dcom/common/tables.c +++ b/source4/lib/dcom/common/tables.c @@ -72,7 +72,7 @@ const void *dcom_proxy_vtable_by_iid(const struct GUID *iid) return iface->proxy_vtable; } -static NTSTATUS dcom_register_interface(const void *_iface) +NTSTATUS dcom_register_interface(const void *_iface) { const struct dcom_interface *iface = _iface; struct interface_list *l = talloc_zero_p(interfaces, struct interface_list); @@ -84,7 +84,7 @@ static NTSTATUS dcom_register_interface(const void *_iface) return NT_STATUS_OK; } -static NTSTATUS dcom_register_class(const void *_class) +NTSTATUS dcom_register_class(const void *_class) { const struct dcom_class *class = _class; struct class_list *l = talloc_zero_p(classes, struct class_list); @@ -95,20 +95,3 @@ static NTSTATUS dcom_register_class(const void *_class) return NT_STATUS_OK; } - -NTSTATUS libdcom_init(void) -{ - NTSTATUS status; - - status = register_subsystem("dcom_interface", dcom_register_interface); - if (NT_STATUS_IS_ERR(status)) { - return status; - } - - register_subsystem("dcom_class", dcom_register_class); - if (NT_STATUS_IS_ERR(status)) { - return status; - } - - return status; -} diff --git a/source4/lib/dcom/config.mk b/source4/lib/dcom/config.mk index 6ebf16324f..21d90024d4 100644 --- a/source4/lib/dcom/config.mk +++ b/source4/lib/dcom/config.mk @@ -1,7 +1,6 @@ ################################################ # Start SUBSYSTEM LIBDCOM [SUBSYSTEM::LIBDCOM] -INIT_FUNCTION = libdcom_init INIT_OBJ_FILES = \ lib/dcom/common/main.o \ lib/dcom/common/tables.o diff --git a/source4/lib/iconv.c b/source4/lib/iconv.c index 085ec0ec2f..045ed36320 100644 --- a/source4/lib/iconv.c +++ b/source4/lib/iconv.c @@ -73,7 +73,7 @@ static const struct charset_functions builtin_functions[] = { static struct charset_functions *charsets = NULL; -static NTSTATUS charset_register_backend(const void *_funcs) +NTSTATUS charset_register_backend(const void *_funcs) { struct charset_functions *funcs = memdup(_funcs,sizeof(struct charset_functions)); struct charset_functions *c = charsets; @@ -92,22 +92,6 @@ static NTSTATUS charset_register_backend(const void *_funcs) return NT_STATUS_OK; } -static void lazy_initialize_iconv(void) -{ - static BOOL initialized = False; - int i; - - if (!initialized) { - initialized = True; - register_subsystem("charset", charset_register_backend); - - charset_init_static_modules; - - for(i = 0; builtin_functions[i].name; i++) - register_backend("charset", &builtin_functions[i]); - } -} - #ifdef HAVE_NATIVE_ICONV /* if there was an error then reset the internal state, this ensures that we don't have a shift state remaining for @@ -179,7 +163,6 @@ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode) smb_iconv_t ret; struct charset_functions *from, *to; - lazy_initialize_iconv(); from = charsets; to = charsets; diff --git a/source4/lib/module.c b/source4/lib/module.c deleted file mode 100644 index 80360e4e72..0000000000 --- a/source4/lib/module.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - Unix SMB/CIFS implementation. - module loading system - - Copyright (C) Jelmer Vernooij 2002-2004 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" -#include "system/dir.h" -#include "system/filesys.h" -#include "dlinklist.h" - -#ifdef HAVE_DLOPEN - -/* Load module (or directory with modules) recursively. - * Includes running the init_module() function */ -NTSTATUS smb_load_module(const char *module_name) -{ - void *handle; - init_module_function init; - NTSTATUS status; - const char *error; - struct stat st; - DIR *dir; - struct dirent *dirent; - - if(stat(module_name, &st) < 0) { - DEBUG(0, ("Can't stat module '%s'\n", module_name)); - return NT_STATUS_UNSUCCESSFUL; - } - - /* If the argument is a directory, recursively load all files / - * directories in it */ - - /* How about symlinks pointing to themselves - wouldn't we rather - * want to use wildcards here? */ - if(S_ISDIR(st.st_mode)) { - dir = opendir(module_name); - while ((dirent = readdir(dir))) { - smb_load_module(dirent->d_name); - } - } - - /* Always try to use LAZY symbol resolving; if the plugin has - * backwards compatibility, there might be symbols in the - * plugin referencing to old (removed) functions - */ - handle = sys_dlopen(module_name, RTLD_LAZY); - - if(!handle) { - DEBUG(0, ("Error loading module '%s': %s\n", module_name, sys_dlerror())); - return NT_STATUS_UNSUCCESSFUL; - } - - init = (init_module_function)sys_dlsym(handle, "init_module"); - - /* we must check sys_dlerror() to determine if it worked, because - sys_dlsym() can validly return NULL */ - 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; - } - - status = init(); - - DEBUG(2, ("Module '%s' loaded\n", module_name)); - - 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(smb_load_module(modules[i]))) { - success++; - } - } - - DEBUG(2, ("%d modules successfully loaded\n", success)); - - return success; -} - -#else /* HAVE_DLOPEN */ - -NTSTATUS smb_load_module(const char *module_name) -{ - DEBUG(0,("This samba executable has not been built with plugin support\n")); - return NT_STATUS_NOT_SUPPORTED; -} - -int smb_load_modules(const char **modules) -{ - DEBUG(0,("This samba executable has not been built with plugin support\n")); - return -1; -} - -#endif /* HAVE_DLOPEN */ - -void init_modules(void) -{ - if(lp_preload_modules()) - smb_load_modules(lp_preload_modules()); -} - -struct subsystem { - char *name; - register_backend_function callback; - struct subsystem *prev, *next; -}; - -static struct subsystem *subsystems = NULL; - -NTSTATUS register_subsystem(const char *name, register_backend_function callback) -{ - struct subsystem *s; - struct subsystem *t = subsystems; - - while(t) { - if(!strcmp(name, t->name)) { - /* its already registered! */ - DEBUG(0,("Subsystem '%s' already registered\n", name)); - return NT_STATUS_OBJECT_NAME_COLLISION; - } - t = t->next; - } - - s = smb_xmalloc(sizeof(struct subsystem)); - - s->name = smb_xstrdup(name); - s->callback = callback; - s->prev = s->next = NULL; - - DLIST_ADD(subsystems, s); - - return NT_STATUS_OK; -} - -NTSTATUS register_backend(const char *subsystem, const void *args) -{ - /* Find the specified subsystem */ - struct subsystem *s = subsystems; - - while(s) { - if(!strcmp(subsystem, s->name)) return s->callback(args); - s = s->next; - } - - DEBUG(0, ("Unable to register backend for subsystem '%s'\n", subsystem)); - - return NT_STATUS_NOT_IMPLEMENTED; -} diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c index 0399fc26aa..77440cea0f 100644 --- a/source4/lib/registry/common/reg_interface.c +++ b/source4/lib/registry/common/reg_interface.c @@ -59,21 +59,6 @@ NTSTATUS registry_register(const void *_function) return NT_STATUS_OK; } -NTSTATUS registry_init(void) -{ - NTSTATUS status; - - status = register_subsystem("registry", registry_register); - if (NT_STATUS_IS_ERR(status)) { - DEBUG(0, ("Error registering registry subsystem: %s\n", nt_errstr(status))); - return status; - } - - registry_init_static_modules; - - return NT_STATUS_OK; -} - /* Find a backend in the list of available backends */ static struct reg_init_function_entry *reg_find_backend_entry(const char *name) { diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 9c6ed24148..ec9dbec7db 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -68,7 +68,6 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start SUBSYSTEM REGISTRY [SUBSYSTEM::REGISTRY] -INIT_FUNCTION = registry_init INIT_OBJ_FILES = \ lib/registry/common/reg_interface.o ADD_OBJ_FILES = \ diff --git a/source4/lib/registry/reg_backend_dir/reg_backend_dir.c b/source4/lib/registry/reg_backend_dir/reg_backend_dir.c index 247d723252..8712e7ce7c 100644 --- a/source4/lib/registry/reg_backend_dir/reg_backend_dir.c +++ b/source4/lib/registry/reg_backend_dir/reg_backend_dir.c @@ -144,5 +144,5 @@ static struct registry_operations reg_backend_dir = { NTSTATUS registry_dir_init(void) { - return register_backend("registry", ®_backend_dir); + return registry_register(®_backend_dir); } diff --git a/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c b/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c index 382bc6dba5..fd258ca285 100644 --- a/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c +++ b/source4/lib/registry/reg_backend_gconf/reg_backend_gconf.c @@ -189,5 +189,5 @@ static struct registry_operations reg_backend_gconf = { NTSTATUS registry_gconf_init(void) { - return register_backend("registry", ®_backend_gconf); + return registry_register(®_backend_gconf); } diff --git a/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c index 22c81018c7..bdebe34ff4 100644 --- a/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb/reg_backend_ldb.c @@ -214,5 +214,5 @@ static struct registry_operations reg_backend_ldb = { NTSTATUS registry_ldb_init(void) { - return register_backend("registry", ®_backend_ldb); + return registry_register(®_backend_ldb); } diff --git a/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c b/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c index c1b9b43445..aac6e548a8 100644 --- a/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c +++ b/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c @@ -1743,5 +1743,5 @@ static struct registry_operations reg_backend_nt4 = { NTSTATUS registry_nt4_init(void) { - return register_backend("registry", ®_backend_nt4); + return registry_register(®_backend_nt4); } diff --git a/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c b/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c index 954e7684bb..47afc31d96 100644 --- a/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c +++ b/source4/lib/registry/reg_backend_rpc/reg_backend_rpc.c @@ -401,5 +401,5 @@ static struct registry_operations reg_backend_rpc = { NTSTATUS registry_rpc_init(void) { - return register_backend("registry", ®_backend_rpc); + return registry_register(®_backend_rpc); } diff --git a/source4/lib/registry/reg_backend_w95/reg_backend_w95.c b/source4/lib/registry/reg_backend_w95/reg_backend_w95.c index 72ec882b8a..fb73e9052c 100644 --- a/source4/lib/registry/reg_backend_w95/reg_backend_w95.c +++ b/source4/lib/registry/reg_backend_w95/reg_backend_w95.c @@ -352,5 +352,5 @@ static struct registry_operations reg_backend_w95 = { NTSTATUS registry_w95_init(void) { - return register_backend("registry", ®_backend_w95); + return registry_register(®_backend_w95); } diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk index bfcd462453..96c2c590cb 100644 --- a/source4/lib/tdb/config.mk +++ b/source4/lib/tdb/config.mk @@ -37,6 +37,7 @@ REQUIRED_SUBSYSTEMS = \ ################################################ # Start BINARY tdbtool [BINARY::tdbtool] +ENABLE = NO OBJ_FILES= \ lib/tdb/tools/tdbtool.o REQUIRED_SUBSYSTEMS = \ |