diff options
author | CVS Import User <samba-bugs@samba.org> | 2004-04-04 11:27:30 +0000 |
---|---|---|
committer | CVS Import User <samba-bugs@samba.org> | 2004-04-04 11:27:30 +0000 |
commit | f8db8e0ae8fa16894a5eb6367ca325e530ff506b (patch) | |
tree | 753894e0b091990464ef5ce274cb149e4fd9cf0d /source/param | |
parent | 139b1658ca30692835c1a7203c7cd003e587ac12 (diff) | |
download | samba-f8db8e0ae8fa16894a5eb6367ca325e530ff506b.tar.gz samba-f8db8e0ae8fa16894a5eb6367ca325e530ff506b.tar.xz samba-f8db8e0ae8fa16894a5eb6367ca325e530ff506b.zip |
r4: merge in the SAMBA_3_0 branch from cvs
to checkout try this:
svn co svn+ssh://svn.samba.org/home/svn/samba/branches/SAMBA_3_0 samba-3_0-work
metze
Diffstat (limited to 'source/param')
-rw-r--r-- | source/param/config_ldap.c | 351 | ||||
-rw-r--r-- | source/param/loadparm.c | 31 | ||||
-rw-r--r-- | source/param/modconf.c | 96 |
3 files changed, 1 insertions, 477 deletions
diff --git a/source/param/config_ldap.c b/source/param/config_ldap.c deleted file mode 100644 index fe4693fb583..00000000000 --- a/source/param/config_ldap.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - ModConfig LDAP backend - - Copyright (C) Simo Sorce 2003 - Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 - Copyright (C) Gerald Carter 2003 - - 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" - -/*#undef DBGC_CLASS -#define DBGC_CLASS DBGC_CONFIG -*/ - -#include <lber.h> -#include <ldap.h> - -#include "smbldap.h" - -#define LDAP_OBJ_SAMBA_CONFIG "sambaConfig" -#define LDAP_OBJ_SAMBA_SHARE "sambaShare" -#define LDAP_OBJ_SAMBA_OPTION "sambaConfigOption" - -#define LDAP_ATTR_LIST_END 0 -#define LDAP_ATTR_BOOL 1 -#define LDAP_ATTR_INTEGER 2 -#define LDAP_ATTR_STRING 3 -#define LDAP_ATTR_LIST 4 -#define LDAP_ATTR_NAME 5 - - -struct ldap_config_state { - struct smbldap_state *smbldap_state; - TALLOC_CTX *mem_ctx; -}; - -ATTRIB_MAP_ENTRY option_attr_list[] = { - { LDAP_ATTR_NAME, "sambaOptionName" }, - { LDAP_ATTR_LIST, "sambaListOption" }, - { LDAP_ATTR_STRING, "sambaStringOption" }, - { LDAP_ATTR_INTEGER, "sambaIntegerOption" }, - { LDAP_ATTR_BOOL, "sambaBoolOption" }, - { LDAP_ATTR_LIST_END, NULL } -}; - -static struct ldap_config_state ldap_state; -static char *config_base_dn; - -static NTSTATUS ldap_config_close(void); - -/* -TODO: - search each section - start with global, then with others - for each section parse all options -*/ - -static NTSTATUS parse_section( - const char *dn, - BOOL (*pfunc)(const char *, const char *)) -{ - TALLOC_CTX *mem_ctx; - NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; - LDAPMessage *result = NULL; - LDAPMessage *entry = NULL; - pstring filter; - pstring option_name; - pstring option_value; - char **attr_list = NULL; - int rc; - int count; - - mem_ctx = talloc_init("parse_section"); - - /* search for the options */ - pstr_sprintf(filter, "objectClass=%s", - LDAP_OBJ_SAMBA_OPTION); - - DEBUG(0, ("Searching for:[%s]\n", filter)); - - attr_list = get_attr_list(option_attr_list); - rc = smbldap_search(ldap_state.smbldap_state, - dn, LDAP_SCOPE_ONELEVEL, - filter, attr_list, 0, &result); - - if (rc != LDAP_SUCCESS) { - DEBUG(0,("parse_section: %s object not found\n", LDAP_OBJ_SAMBA_CONFIG)); - goto done; - } - - count = ldap_count_entries(ldap_state.smbldap_state->ldap_struct, result); - entry = ldap_first_entry(ldap_state.smbldap_state->ldap_struct, result); - while (entry) { - int o; - - if (!smbldap_get_single_pstring(ldap_state.smbldap_state->ldap_struct, entry, "sambaOptionName", option_name)) { - goto done; - } - - option_value[0] = '\0'; - for (o = 1; option_attr_list[o].name != NULL; o++) { - if (smbldap_get_single_pstring(ldap_state.smbldap_state->ldap_struct, entry, option_attr_list[o].name, option_value)) { - break; - } - } - if (option_value[0] != '\0') { - if (!pfunc(option_name, option_value)) { - goto done; - } - } else { - DEBUG(0,("parse_section: Missing value for option: %s\n", option_name)); - goto done; - } - - entry = ldap_next_entry(ldap_state.smbldap_state->ldap_struct, entry); - } - - ret = NT_STATUS_OK; - -done: - talloc_destroy(mem_ctx); - free_attr_list(attr_list); - if (result) ldap_msgfree(result); - - return ret; -} - -/***************************************************************************** - load configuration from ldap -*****************************************************************************/ - -static NTSTATUS ldap_config_load( - BOOL (*sfunc)(const char *), - BOOL (*pfunc)(const char *, const char *)) -{ - TALLOC_CTX *mem_ctx; - NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; - LDAPMessage *result = NULL; - LDAPMessage *entry = NULL; - pstring filter; - pstring attr_text; - char *config_dn = NULL; - char *temp; - int rc; - int count; - const char *config_attr_list[] = {"description", NULL}; - const char *share_attr_list[] = {"sambaShareName", "description", NULL}; - char **share_dn; - char **share_name; - - mem_ctx = talloc_init("ldap_config_load"); - - /* search for the base config dn */ - pstr_sprintf(filter, "objectClass=%s", - LDAP_OBJ_SAMBA_CONFIG); - - DEBUG(0, ("Searching for:[%s]\n", filter)); - - rc = smbldap_search(ldap_state.smbldap_state, - config_base_dn, LDAP_SCOPE_SUBTREE, - filter, config_attr_list, 0, &result); - - if (rc != LDAP_SUCCESS) { - DEBUG(0,("ldap_config_load: %s object not found\n", LDAP_OBJ_SAMBA_CONFIG)); - goto done; - } - - count = ldap_count_entries(ldap_state.smbldap_state->ldap_struct, result); - if (count != 1) { - DEBUG(0,("ldap_config_load: single %s object not found\n", LDAP_OBJ_SAMBA_CONFIG)); - goto done; - } - - if (!(temp = smbldap_get_dn(ldap_state.smbldap_state->ldap_struct, result))) { - goto done; - } - config_dn = talloc_strdup(mem_ctx, temp); - SAFE_FREE(temp); - if (!config_dn) { - goto done; - } - - entry = ldap_first_entry(ldap_state.smbldap_state->ldap_struct, result); - - if (!smbldap_get_single_pstring(ldap_state.smbldap_state->ldap_struct, entry, "description", attr_text)) { - DEBUG(0, ("ldap_config_load: no description field in %s object\n", LDAP_OBJ_SAMBA_CONFIG)); - } - - if (result) ldap_msgfree(result); -/* TODO: finish up the last section, see loadparm's lp_load()*/ - - /* retrive the section list */ - pstr_sprintf(filter, "objectClass=%s", - LDAP_OBJ_SAMBA_SHARE); - - DEBUG(0, ("Searching for:[%s]\n", filter)); - - rc = smbldap_search(ldap_state.smbldap_state, - config_dn, LDAP_SCOPE_SUBTREE, - filter, share_attr_list, 0, &result); - - if (rc != LDAP_SUCCESS) { - DEBUG(0,("ldap_config_load: %s object not found\n", LDAP_OBJ_SAMBA_CONFIG)); - goto done; - } - - count = ldap_count_entries(ldap_state.smbldap_state->ldap_struct, result); - DEBUG(0, ("config_ldap: Found %d shares\n", count)); - if (count) { - int i; - - share_dn = talloc(mem_ctx, (count + 1) * sizeof(char *)); - share_name = talloc(mem_ctx, (count) * sizeof(char *)); - if (!share_dn || !share_name) { - DEBUG(0,("config_ldap: Out of memory!\n")); - goto done; - } - entry = ldap_first_entry(ldap_state.smbldap_state->ldap_struct, result); - i = 0; - while (entry) { - if (!(temp = smbldap_get_dn(ldap_state.smbldap_state->ldap_struct, entry))) { - goto done; - } - if (!smbldap_get_single_pstring(ldap_state.smbldap_state->ldap_struct, entry, "sambaShareName", attr_text)) { - goto done; - } - share_dn[i] = talloc_strdup(mem_ctx, temp); - share_name[i] = talloc_strdup(mem_ctx, attr_text); - if (!share_dn[i] || !share_name[i]) { - DEBUG(0,("config_ldap: Out of memory!\n")); - goto done; - } - - DEBUG(0, ("config_ldap: Found share [%s] (%s)\n", attr_text, temp)); - SAFE_FREE(temp); - - entry = ldap_next_entry(ldap_state.smbldap_state->ldap_struct, entry); - i++; - if (entry && (count == i)) { - DEBUG(0, ("Error too many entryes in ldap result\n")); - goto done; - } - } - share_dn[i] = NULL; - } - - /* parse global section*/ - if (!sfunc("global")) { - goto done; - } - if (!NT_STATUS_IS_OK(parse_section(config_dn, pfunc))) { - goto done; - } else { /* parse shares */ - int i; - - for (i = 0; share_dn[i] != NULL; i++) { - if (!sfunc(share_name[i])) { - goto done; - } - if (!NT_STATUS_IS_OK(parse_section(share_dn[i], pfunc))) { - goto done; - } - } - } - -done: - talloc_destroy(mem_ctx); - if (result) ldap_msgfree(result); - - return ret; -} - -/***************************************************************************** - Initialise config_ldap module -*****************************************************************************/ - -static NTSTATUS ldap_config_init(char *params) -{ - NTSTATUS nt_status; - const char *location; - const char *basedn; - - ldap_state.mem_ctx = talloc_init("config_ldap"); - if (!ldap_state.mem_ctx) { - return NT_STATUS_NO_MEMORY; - } - - /* we assume only location is passed through an inline parameter - * other options go via parametrical options */ - if (params) { - location = params; - } else { - location = lp_parm_const_string(GLOBAL_SECTION_SNUM, "config_ldap", "url", "ldap://localhost"); - } - DEBUG(0,("config_ldap: location=%s\n", location)); - basedn = lp_parm_const_string(GLOBAL_SECTION_SNUM, "config_ldap", "basedn", NULL); - if (basedn) config_base_dn = smb_xstrdup(basedn); - - if (!NT_STATUS_IS_OK(nt_status = - smbldap_init(ldap_state.mem_ctx, location, - &ldap_state.smbldap_state))) { - talloc_destroy(ldap_state.mem_ctx); - DEBUG(0,("config_ldap: smbldap_init failed!\n")); - return nt_status; - } - - return NT_STATUS_OK; -} - -/***************************************************************************** - End the LDAP session -*****************************************************************************/ - -static NTSTATUS ldap_config_close(void) -{ - - smbldap_free_struct(&(ldap_state).smbldap_state); - talloc_destroy(ldap_state.mem_ctx); - - DEBUG(5,("The connection to the LDAP server was closed\n")); - /* maybe free the results here --metze */ - - return NT_STATUS_OK; -} - -static struct config_functions functions = { - ldap_config_init, - ldap_config_load, - ldap_config_close -}; - -NTSTATUS config_ldap_init(void) -{ - return smb_register_config(SAMBA_CONFIG_INTERFACE_VERSION, "ldap", &functions); -} diff --git a/source/param/loadparm.c b/source/param/loadparm.c index b92fa64ee0c..6b09faf7bf9 100644 --- a/source/param/loadparm.c +++ b/source/param/loadparm.c @@ -95,7 +95,6 @@ struct _param_opt_struct { */ typedef struct { - char *szConfigBackend; char *smb_ports; char *dos_charset; char *unix_charset; @@ -123,7 +122,6 @@ typedef struct char *szSMBPasswdFile; char *szPrivateDir; char **szPassdbBackend; - char *szGumsBackend; char **szPreloadModules; char *szPasswordServer; char *szSocketOptions; @@ -224,7 +222,6 @@ typedef struct char *szLdapUserSuffix; char *szLdapIdmapSuffix; char *szLdapGroupSuffix; - char *szLdapPrivilegeSuffix; #ifdef WITH_LDAP_SAMCONFIG int ldap_port; char *szLdapServer; @@ -283,7 +280,6 @@ typedef struct BOOL bDebugPid; BOOL bDebugUid; BOOL bHostMSDfs; - BOOL bUnicode; BOOL bUseMmap; BOOL bHostnameLookups; BOOL bUnixExtensions; @@ -762,7 +758,6 @@ static const struct enum_list enum_map_to_guest[] = { static struct parm_struct parm_table[] = { {N_("Base Options"), P_SEP, P_SEPARATOR}, - {"config backend", P_STRING, P_GLOBAL, &Globals.szConfigBackend, NULL, NULL, FLAG_ADVANCED}, {"dos charset", P_STRING, P_GLOBAL, &Globals.dos_charset, handle_charset, NULL, FLAG_ADVANCED}, {"unix charset", P_STRING, P_GLOBAL, &Globals.unix_charset, handle_charset, NULL, FLAG_ADVANCED}, {"display charset", P_STRING, P_GLOBAL, &Globals.display_charset, handle_charset, NULL, FLAG_ADVANCED}, @@ -800,7 +795,6 @@ static struct parm_struct parm_table[] = { {"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, FLAG_ADVANCED}, {"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, FLAG_ADVANCED}, {"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD}, - {"gums backend", P_STRING, P_GLOBAL, &Globals.szGumsBackend, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD}, {"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.AlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED}, {"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED}, {"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE}, @@ -889,7 +883,6 @@ static struct parm_struct parm_table[] = { {"large readwrite", P_BOOL, P_GLOBAL, &Globals.bLargeReadwrite, NULL, NULL, FLAG_ADVANCED}, {"max protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_ADVANCED}, {"min protocol", P_ENUM, P_GLOBAL, &Globals.minprotocol, NULL, enum_protocol, FLAG_ADVANCED}, - {"unicode", P_BOOL, P_GLOBAL, &Globals.bUnicode, NULL, NULL, FLAG_ADVANCED}, {"read bmpx", P_BOOL, P_GLOBAL, &Globals.bReadbmpx, NULL, NULL, FLAG_ADVANCED}, {"read raw", P_BOOL, P_GLOBAL, &Globals.bReadRaw, NULL, NULL, FLAG_ADVANCED}, {"write raw", P_BOOL, P_GLOBAL, &Globals.bWriteRaw, NULL, NULL, FLAG_ADVANCED}, @@ -1081,7 +1074,6 @@ static struct parm_struct parm_table[] = { {"ldap user suffix", P_STRING, P_GLOBAL, &Globals.szLdapUserSuffix, NULL, NULL, FLAG_ADVANCED}, {"ldap group suffix", P_STRING, P_GLOBAL, &Globals.szLdapGroupSuffix, NULL, NULL, FLAG_ADVANCED}, {"ldap idmap suffix", P_STRING, P_GLOBAL, &Globals.szLdapIdmapSuffix, NULL, NULL, FLAG_ADVANCED}, - {"ldap privilege suffix", P_STRING, P_GLOBAL, &Globals.szLdapPrivilegeSuffix, NULL, NULL, FLAG_ADVANCED}, {"ldap filter", P_STRING, P_GLOBAL, &Globals.szLdapFilter, NULL, NULL, FLAG_ADVANCED}, {"ldap admin dn", P_STRING, P_GLOBAL, &Globals.szLdapAdminDn, NULL, NULL, FLAG_ADVANCED}, {"ldap ssl", P_ENUM, P_GLOBAL, &Globals.ldap_ssl, NULL, enum_ldap_ssl, FLAG_ADVANCED}, @@ -1316,8 +1308,6 @@ static void init_globals(void) DEBUG(3, ("Initialising global parameters\n")); - string_set(&Globals.szConfigBackend, NULL); - string_set(&Globals.szSMBPasswdFile, dyn_SMB_PASSWD_FILE); string_set(&Globals.szPrivateDir, dyn_PRIVATE_DIR); @@ -1434,7 +1424,6 @@ static void init_globals(void) Globals.bPamPasswordChange = False; Globals.bPasswdChatDebug = False; Globals.iPasswdChatTimeout = 2; /* 2 second default. */ - Globals.bUnicode = True; /* Do unicode on the wire by default */ Globals.bNTPipeSupport = True; /* Do NT pipes by default. */ Globals.bNTStatusSupport = True; /* Use NT status by default. */ Globals.bStatCache = True; /* use stat cache by default */ @@ -1471,7 +1460,6 @@ static void init_globals(void) #else Globals.szPassdbBackend = str_list_make("smbpasswd", NULL); #endif /* WITH_LDAP_SAMCONFIG */ - string_set(&Globals.szGumsBackend, "tdbsam2"); string_set(&Globals.szLdapSuffix, ""); string_set(&Globals.szLdapFilter, "(uid=%u)"); @@ -1479,7 +1467,6 @@ static void init_globals(void) string_set(&Globals.szLdapUserSuffix, ""); string_set(&Globals.szLdapGroupSuffix, ""); string_set(&Globals.szLdapIdmapSuffix, ""); - string_set(&Globals.szLdapPrivilegeSuffix, ""); string_set(&Globals.szLdapAdminDn, ""); Globals.ldap_ssl = LDAP_SSL_ON; @@ -1622,7 +1609,6 @@ static char *lp_string(const char *s) #define FN_LOCAL_INTEGER(fn_name,val) \ int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);} -FN_GLOBAL_STRING(lp_config_backend, &Globals.szConfigBackend) FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports) FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset) FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset) @@ -1657,7 +1643,7 @@ FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat) FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer) FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder) FN_GLOBAL_STRING(lp_realm, &Globals.szRealm) -FN_GLOBAL_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap) +FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap) FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap) FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript) FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath) @@ -1672,7 +1658,6 @@ FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName) static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion) FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases) FN_GLOBAL_LIST(lp_passdb_backend, &Globals.szPassdbBackend) -FN_GLOBAL_STRING(lp_gums_backend, &Globals.szGumsBackend) FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules) FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction) FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript) @@ -1753,7 +1738,6 @@ FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange) FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync) FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug) FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout) -FN_GLOBAL_BOOL(lp_unicode, &Globals.bUnicode) FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport) FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport) FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache) @@ -2981,14 +2965,6 @@ char *lp_ldap_idmap_suffix(void) return lp_string(Globals.szLdapSuffix); } -char *lp_ldap_privilege_suffix(void) -{ - if (Globals.szLdapPrivilegeSuffix[0]) - return append_ldap_suffix(Globals.szLdapPrivilegeSuffix); - - return lp_string(Globals.szLdapSuffix); -} - /*************************************************************************** ***************************************************************************/ @@ -3897,11 +3873,6 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults, if (iServiceIndex >= 0) bRetval = service_ok(iServiceIndex); - if (*(lp_config_backend())) { - modconf_init(lp_config_backend()); - modconf_load(do_section, do_parameter); - } - lp_add_auto_services(lp_auto_services()); if (add_ipc) { diff --git a/source/param/modconf.c b/source/param/modconf.c deleted file mode 100644 index a9ab6f9b4a2..00000000000 --- a/source/param/modconf.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Configuration Modules Support - Copyright (C) Simo Sorce 2003 - - 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" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_IDMAP - -struct modconf_struct { - char *name; - struct config_functions *fns; -}; - -static struct modconf_struct module; - -NTSTATUS smb_register_config(int version, const char *name, struct config_functions *fns) -{ - if ((version != SAMBA_CONFIG_INTERFACE_VERSION)) { - DEBUG(0, ("smb_register_config: Failed to register config module.\n" - "The module has been compiled with a different interface version (%d).\n" - "The supported version is: %d\n", - version, SAMBA_CONFIG_INTERFACE_VERSION)); - return NT_STATUS_OBJECT_TYPE_MISMATCH; - } - - if (!name || !name[0]) { - DEBUG(0,("smb_register_config: Name missing!\n")); - return NT_STATUS_INVALID_PARAMETER; - } - - module.name = smb_xstrdup(name); - module.fns = fns; - DEBUG(5, ("smb_register_config: Successfully registeres config backend '%s'\n", name)); - return NT_STATUS_OK; -} - -/********************************************************************** - * Init the configuration module - *********************************************************************/ - -BOOL modconf_init(const char *config_backend) -{ - NTSTATUS ret; - BOOL bret = False; - char *name; - char *params; - - /* nothing to do */ - if (!config_backend) - return True; - - name = smb_xstrdup(config_backend); - if ((params = strchr(name, ':')) != NULL ) { - *params = '\0'; - params++; - } - - ret = smb_probe_module("config", name); - - if (NT_STATUS_IS_OK(ret) && NT_STATUS_IS_OK(module.fns->init(params))) - bret = True; - - SAFE_FREE(name); - return bret; -} - -BOOL modconf_load(BOOL (*sfunc)(const char *),BOOL (*pfunc)(const char *, const char *)) -{ - if (module.fns) { - if (NT_STATUS_IS_OK(module.fns->load(sfunc, pfunc))) { - return True; - } - } - return False; -} - -NTSTATUS modconf_close(void) -{ - return module.fns->close(); -} |