2 Unix SMB/CIFS implementation.
3 Configuration Modules Support
4 Copyright (C) Simo Sorce 2003
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/
23 #define DBGC_CLASS DBGC_IDMAP
25 struct modconf_struct {
27 struct config_functions *fns;
30 static struct modconf_struct module;
32 NTSTATUS smb_register_config(int version, const char *name, struct config_functions *fns)
34 if ((version != SAMBA_CONFIG_INTERFACE_VERSION)) {
35 DEBUG(0, ("smb_register_config: Failed to register config module.\n"
36 "The module has been compiled with a different interface version (%d).\n"
37 "The supported version is: %d\n",
38 version, SAMBA_CONFIG_INTERFACE_VERSION));
39 return NT_STATUS_OBJECT_TYPE_MISMATCH;
42 if (!name || !name[0]) {
43 DEBUG(0,("smb_register_config: Name missing!\n"));
44 return NT_STATUS_INVALID_PARAMETER;
47 module.name = smb_xstrdup(name);
49 DEBUG(5, ("smb_register_config: Successfully registeres config backend '%s'\n", name));
53 /**********************************************************************
54 * Init the configuration module
55 *********************************************************************/
57 BOOL modconf_init(const char *config_backend)
68 name = smb_xstrdup(config_backend);
69 if ((params = strchr(name, ':')) != NULL ) {
74 ret = smb_probe_module("config", name);
76 if (NT_STATUS_IS_OK(ret) && NT_STATUS_IS_OK(module.fns->init(params)))
83 BOOL modconf_load(BOOL (*sfunc)(const char *),BOOL (*pfunc)(const char *, const char *))
86 if (NT_STATUS_IS_OK(module.fns->load(sfunc, pfunc))) {
93 NTSTATUS modconf_close(void)
95 return module.fns->close();