summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c494
1 files changed, 129 insertions, 365 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index dc45fd9f5b..807f8607f1 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -8,7 +8,6 @@
Copyright (C) Simo Sorce 2001
Copyright (C) Alexander Bokovoy 2002
Copyright (C) Stefan (metze) Metzmacher 2002
- Copyright (C) Anthony Liguori 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
@@ -82,13 +81,6 @@ extern int extra_time_offset;
static BOOL defaults_saved = False;
-typedef struct _param_opt_struct param_opt_struct;
-struct _param_opt_struct {
- param_opt_struct *prev, *next;
- char *key;
- char *value;
-};
-
/*
* This structure describes global (ie., server-wide) parameters.
*/
@@ -119,8 +111,6 @@ typedef struct
char *szSMBPasswdFile;
char *szPrivateDir;
char **szPassdbBackend;
- char **szSamBackend;
- char **szPreloadModules;
char *szPasswordServer;
char *szSocketOptions;
char *szRealm;
@@ -162,18 +152,16 @@ typedef struct
BOOL bUtmp;
#endif
char *szSourceEnv;
- char *szIdmapUID;
- char *szIdmapGID;
+ char *szWinbindUID;
+ char *szWinbindGID;
char *szNonUnixAccountRange;
- int AlgorithmicRidBase;
+ BOOL bAlgorithmicRidBase;
char *szTemplateHomedir;
char *szTemplateShell;
char *szWinbindSeparator;
BOOL bWinbindEnumUsers;
BOOL bWinbindEnumGroups;
BOOL bWinbindUseDefaultDomain;
- char *szWinbindBackend;
- char *szIdmapBackend;
char *szAddShareCommand;
char *szChangeShareCommand;
char *szDeleteShareCommand;
@@ -287,7 +275,6 @@ typedef struct
int restrict_anonymous;
int name_cache_timeout;
BOOL client_signing;
- param_opt_struct *param_opt;
}
global;
@@ -410,7 +397,6 @@ typedef struct
BOOL bNTAclSupport;
BOOL bUseSendfile;
BOOL bProfileAcls;
- param_opt_struct *param_opt;
char dummy[3]; /* for alignment */
}
@@ -531,8 +517,6 @@ static service sDefault = {
True, /* bNTAclSupport */
False, /* bUseSendfile */
False, /* bProfileAcls */
-
- NULL, /* Parametric options */
"" /* dummy */
};
@@ -551,10 +535,11 @@ static int default_server_announce;
/* prototypes for the special type handlers */
static BOOL handle_include(const char *pszParmValue, char **ptr);
static BOOL handle_copy(const char *pszParmValue, char **ptr);
+static BOOL handle_vfs_object(const char *pszParmValue, char **ptr);
static BOOL handle_source_env(const char *pszParmValue, char **ptr);
static BOOL handle_netbios_name(const char *pszParmValue, char **ptr);
-static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr);
-static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr);
+static BOOL handle_winbind_uid(const char *pszParmValue, char **ptr);
+static BOOL handle_winbind_gid(const char *pszParmValue, char **ptr);
static BOOL handle_non_unix_account_range(const char *pszParmValue, char **ptr);
static BOOL handle_debug_list( const char *pszParmValue, char **ptr );
static BOOL handle_workgroup( const char *pszParmValue, char **ptr );
@@ -754,7 +739,6 @@ static struct parm_struct parm_table[] = {
{"server schannel", P_ENUM, P_GLOBAL, &Globals.serverSchannel, NULL, enum_bool_auto, FLAG_BASIC},
{"allow trusted domains", P_BOOL, P_GLOBAL, &Globals.bAllowTrustedDomains, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"hosts equiv", P_STRING, P_GLOBAL, &Globals.szHostsEquiv, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"idmap backend", P_STRING, P_GLOBAL, &Globals.szIdmapBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"min passwd length", P_INTEGER, P_GLOBAL, &Globals.min_passwd_length, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"min password length", P_INTEGER, P_GLOBAL, &Globals.min_passwd_length, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"map to guest", P_ENUM, P_GLOBAL, &Globals.map_to_guest, NULL, enum_map_to_guest, FLAG_ADVANCED | FLAG_DEVELOPER},
@@ -763,10 +747,9 @@ static struct parm_struct parm_table[] = {
{"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"sam backend", P_LIST, P_GLOBAL, &Globals.szSamBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"non unix account range", P_STRING, P_GLOBAL, &Globals.szNonUnixAccountRange, handle_non_unix_account_range, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.AlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.bAlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"root", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE | FLAG_DEVELOPER},
@@ -776,7 +759,7 @@ static struct parm_struct parm_table[] = {
{"passwd program", P_STRING, P_GLOBAL, &Globals.szPasswdProgram, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"passwd chat debug", P_BOOL, P_GLOBAL, &Globals.bPasswdChatDebug, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER | FLAG_DEVELOPER},
{"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"username level", P_INTEGER, P_GLOBAL, &Globals.unamelevel, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"unix password sync", P_BOOL, P_GLOBAL, &Globals.bUnixPasswdSync, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
@@ -806,12 +789,12 @@ static struct parm_struct parm_table[] = {
{"writable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_HIDE},
{"create mask", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
- {"create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
+ {"create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, FLAG_GLOBAL},
{"force create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_force_mode, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
{"security mask", P_OCTAL, P_LOCAL, &sDefault.iSecurity_mask, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
{"force security mode", P_OCTAL, P_LOCAL, &sDefault.iSecurity_force_mode, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
{"directory mask", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
- {"directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
+ {"directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, FLAG_GLOBAL},
{"force directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_force_mode, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
{"directory security mask", P_OCTAL, P_LOCAL, &sDefault.iDir_Security_mask, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
{"force directory security mode", P_OCTAL, P_LOCAL, &sDefault.iDir_Security_force_mode, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
@@ -828,7 +811,6 @@ static struct parm_struct parm_table[] = {
{"allow hosts", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_HIDE},
{"hosts deny", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER},
{"deny hosts", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_HIDE},
- {"preload modules", P_LIST, P_GLOBAL, &Globals.szPreloadModules, NULL, NULL, FLAG_BASIC | FLAG_GLOBAL},
{"Logging Options", P_SEP, P_SEPARATOR},
@@ -1108,7 +1090,7 @@ static struct parm_struct parm_table[] = {
{"VFS module options", P_SEP, P_SEPARATOR},
- {"vfs object", P_LIST, P_LOCAL, &sDefault.szVfsObjectFile, NULL, NULL, FLAG_SHARE},
+ {"vfs object", P_STRING, P_LOCAL, &sDefault.szVfsObjectFile, handle_vfs_object, NULL, FLAG_SHARE},
{"vfs options", P_STRING, P_LOCAL, &sDefault.szVfsOptions, NULL, NULL, FLAG_SHARE},
{"vfs path", P_STRING, P_LOCAL, &sDefault.szVfsPath, NULL, NULL, FLAG_SHARE},
@@ -1119,10 +1101,8 @@ static struct parm_struct parm_table[] = {
{"Winbind options", P_SEP, P_SEPARATOR},
- {"idmap uid", P_STRING, P_GLOBAL, &Globals.szIdmapUID, handle_idmap_uid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"winbind uid", P_STRING, P_GLOBAL, &Globals.szIdmapUID, handle_idmap_uid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER | FLAG_HIDE},
- {"idmap gid", P_STRING, P_GLOBAL, &Globals.szIdmapGID, handle_idmap_gid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"winbind gid", P_STRING, P_GLOBAL, &Globals.szIdmapGID, handle_idmap_gid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER | FLAG_HIDE},
+ {"winbind uid", P_STRING, P_GLOBAL, &Globals.szWinbindUID, handle_winbind_uid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"winbind gid", P_STRING, P_GLOBAL, &Globals.szWinbindGID, handle_winbind_gid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"template homedir", P_STRING, P_GLOBAL, &Globals.szTemplateHomedir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"template shell", P_STRING, P_GLOBAL, &Globals.szTemplateShell, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind separator", P_STRING, P_GLOBAL, &Globals.szWinbindSeparator, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
@@ -1130,7 +1110,6 @@ static struct parm_struct parm_table[] = {
{"winbind enum users", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumUsers, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind enum groups", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumGroups, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind use default domain", P_BOOL, P_GLOBAL, &Globals.bWinbindUseDefaultDomain, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"winbind backend", P_STRING, P_GLOBAL, &Globals.szWinbindBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
};
@@ -1330,7 +1309,7 @@ static void init_globals(void)
string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
string_set(&Globals.szPasswordServer, "*");
- Globals.AlgorithmicRidBase = BASE_RID;
+ Globals.bAlgorithmicRidBase = BASE_RID;
Globals.bLoadPrinters = True;
Globals.mangled_stack = 50;
@@ -1476,8 +1455,6 @@ static void init_globals(void)
Globals.bWinbindEnumGroups = True;
Globals.bWinbindUseDefaultDomain = False;
- string_set(&Globals.szWinbindBackend, "tdb");
-
Globals.name_cache_timeout = 660; /* In seconds */
Globals.bUseSpnego = True;
@@ -1528,9 +1505,6 @@ static char *lp_string(const char *s)
if (!ret)
return NULL;
- /* Note: StrnCpy touches len+1 bytes, but we allocate 100
- * extra bytes so we're OK. */
-
if (!s)
*ret = 0;
else
@@ -1626,8 +1600,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_LIST(lp_sam_backend, &Globals.szSamBackend)
-FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
@@ -1653,9 +1625,6 @@ FN_GLOBAL_STRING(lp_acl_compatibility, &Globals.szAclCompat)
FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
-FN_GLOBAL_STRING(lp_winbind_backend, &Globals.szWinbindBackend)
-
-FN_GLOBAL_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
#ifdef WITH_LDAP_SAMCONFIG
FN_GLOBAL_STRING(lp_ldap_server, &Globals.szLdapServer)
@@ -1790,7 +1759,7 @@ FN_LOCAL_LIST(lp_readlist, readlist)
FN_LOCAL_LIST(lp_writelist, writelist)
FN_LOCAL_LIST(lp_printer_admin, printer_admin)
FN_LOCAL_STRING(lp_fstype, fstype)
-FN_LOCAL_LIST(lp_vfsobj, szVfsObjectFile)
+FN_LOCAL_STRING(lp_vfsobj, szVfsObjectFile)
FN_LOCAL_STRING(lp_vfs_options, szVfsOptions)
FN_LOCAL_STRING(lp_vfs_path, szVfsPath)
FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
@@ -1868,10 +1837,53 @@ FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
FN_LOCAL_CHAR(lp_magicchar, magic_char)
FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
FN_GLOBAL_BOOL(lp_hide_local_users, &Globals.bHideLocalUsers)
-FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
+FN_GLOBAL_BOOL(lp_algorithmic_rid_base, &Globals.bAlgorithmicRidBase)
FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
FN_GLOBAL_BOOL(lp_client_signing, &Globals.client_signing)
+typedef struct _param_opt_struct param_opt_struct;
+struct _param_opt_struct {
+ char *key;
+ char *value;
+ param_opt_struct *prev, *next;
+};
+
+static param_opt_struct *param_opt = NULL;
+
+/* Return parametric option from given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+/* Returned value is allocated in 'lp_talloc' context */
+
+char *lp_parm_string(const char *servicename, const char *type, const char *option)
+{
+ param_opt_struct *data;
+ pstring vfskey;
+
+ if (param_opt != NULL) {
+ ZERO_STRUCT(vfskey);
+ pstr_sprintf(vfskey, "%s:%s:%s", (servicename==NULL) ? "global" : servicename,
+ type, option);
+ data = param_opt;
+ while (data) {
+ if (strcmp(data->key, vfskey) == 0) {
+ return lp_string(data->value);
+ }
+ data = data->next;
+ }
+ /* Try to fetch the same option but from globals */
+ pstr_sprintf(vfskey, "global:%s:%s", type, option);
+ data = param_opt;
+ while (data) {
+ if (strcmp(data->key, vfskey) == 0) {
+ return lp_string(data->value);
+ }
+ data = data->next;
+ }
+
+ }
+ return NULL;
+}
+
/* local prototypes */
static int map_parameter(const char *pszParmName);
@@ -1885,198 +1897,6 @@ static BOOL do_parameter(const char *pszParmName, const char *pszParmValue);
static BOOL do_section(const char *pszSectionName);
static void init_copymap(service * pservice);
-/* This is a helper function for parametrical options support. */
-/* It returns a pointer to parametrical option value if it exists or NULL otherwise */
-/* Actual parametrical functions are quite simple */
-static const char *get_parametrics(int lookup_service, const char *type, const char *option)
-{
- char* vfskey;
- param_opt_struct *data;
-
- if (lookup_service >= iNumServices) return NULL;
-
- data = (lookup_service < 0) ?
- Globals.param_opt : ServicePtrs[lookup_service]->param_opt;
-
- asprintf(&vfskey, "%s:%s", type, option);
- while (data) {
- if (strcmp(data->key, vfskey) == 0) {
- string_free(&vfskey);
- return data->value;
- }
- data = data->next;
- }
-
- if (lookup_service >= 0) {
- /* Try to fetch the same option but from globals */
- /* but only if we are not already working with Globals */
- data = Globals.param_opt;
- while (data) {
- if (strcmp(data->key, vfskey) == 0) {
- string_free(&vfskey);
- return data->value;
- }
- data = data->next;
- }
- }
-
- string_free(&vfskey);
-
- return NULL;
-}
-
-
-/*******************************************************************
-convenience routine to return int parameters.
-********************************************************************/
-static int lp_int(const char *s)
-{
-
- if (!s) {
- DEBUG(0,("lp_int(%s): is called with NULL!\n",s));
- return (-1);
- }
-
- return atoi(s);
-}
-
-/*******************************************************************
-convenience routine to return unsigned long parameters.
-********************************************************************/
-static int lp_ulong(const char *s)
-{
-
- if (!s) {
- DEBUG(0,("lp_int(%s): is called with NULL!\n",s));
- return (-1);
- }
-
- return strtoul(s, NULL, 10);
-}
-
-/*******************************************************************
-convenience routine to return boolean parameters.
-********************************************************************/
-static BOOL lp_bool(const char *s)
-{
- BOOL ret = False;
-
- if (!s) {
- DEBUG(0,("lp_bool(%s): is called with NULL!\n",s));
- return False;
- }
-
- if (!set_boolean(&ret,s)) {
- DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
- return False;
- }
-
- return ret;
-}
-
-/*******************************************************************
-convenience routine to return enum parameters.
-********************************************************************/
-static int lp_enum(const char *s,const struct enum_list *_enum)
-{
- int i;
-
- if (!s || !_enum) {
- DEBUG(0,("lp_enum(%s,enum): is called with NULL!\n",s));
- return False;
- }
-
- for (i=0; _enum[i].name; i++) {
- if (strcasecmp(_enum[i].name,s)==0)
- return _enum[i].value;
- }
-
- DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
- return (-1);
-}
-
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-/* Returned value is allocated in 'lp_talloc' context */
-
-char *lp_parm_string(int lookup_service, const char *type, const char *option)
-{
- const char *value = get_parametrics(lookup_service, type, option);
-
- if (value)
- return lp_string(value);
-
- return NULL;
-}
-
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-/* Returned value is allocated in 'lp_talloc' context */
-
-char **lp_parm_string_list(int lookup_service, const char *type, const char *option,
- const char *separator)
-{
- const char *value = get_parametrics(lookup_service, type, option);
-
- if (value)
- return str_list_make(value, separator);
-
- return NULL;
-}
-
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-
-int lp_parm_int(int lookup_service, const char *type, const char *option)
-{
- const char *value = get_parametrics(lookup_service, type, option);
-
- if (value)
- return lp_int(value);
-
- return (-1);
-}
-
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-
-unsigned long lp_parm_ulong(int lookup_service, const char *type, const char *option)
-{
- const char *value = get_parametrics(lookup_service, type, option);
-
- if (value)
- return lp_ulong(value);
-
- return (0);
-}
-
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-
-BOOL lp_parm_bool(int lookup_service, const char *type, const char *option)
-{
- const char *value = get_parametrics(lookup_service, type, option);
-
- if (value)
- return lp_bool(value);
-
- return False;
-}
-
-/* Return parametric option from a given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-
-int lp_parm_enum(int lookup_service, const char *type, const char *option,
- const struct enum_list *_enum)
-{
- const char *value = get_parametrics(lookup_service, type, option);
-
- if (value)
- return lp_enum(value, _enum);
-
- return (-1);
-}
-
/***************************************************************************
Initialise a service to the defaults.
@@ -2095,7 +1915,6 @@ static void init_service(service * pservice)
static void free_service(service *pservice)
{
int i;
- param_opt_struct *data, *pdata;
if (!pservice)
return;
@@ -2120,16 +1939,6 @@ static void free_service(service *pservice)
PTR_DIFF(parm_table[i].ptr, &sDefault)));
}
- DEBUG(5,("Freeing parametrics:\n"));
- data = pservice->param_opt;
- while (data) {
- DEBUG(5,("[%s = %s]\n", data->key, data->value));
- string_free(&data->key);
- string_free(&data->value);
- pdata = data->next;
- SAFE_FREE(data);
- data = pdata;
- }
ZERO_STRUCTP(pservice);
}
@@ -2144,27 +1953,14 @@ static int add_a_service(const service *pservice, const char *name)
int i;
service tservice;
int num_to_alloc = iNumServices + 1;
- param_opt_struct *data, *pdata;
tservice = *pservice;
/* it might already exist */
if (name) {
i = getservicebyname(name, NULL);
- if (i >= 0) {
- /* Clean all parametric options for service */
- /* They will be added during parsing again */
- data = ServicePtrs[i]->param_opt;
- while (data) {
- string_free(&data->key);
- string_free(&data->value);
- pdata = data->next;
- SAFE_FREE(data);
- data = pdata;
- }
- ServicePtrs[i]->param_opt = NULL;
+ if (i >= 0)
return (i);
- }
}
/* find an invalid one */
@@ -2407,8 +2203,6 @@ static void copy_service(service * pserviceDest, service * pserviceSource, BOOL
{
int i;
BOOL bcopyall = (pcopymapDest == NULL);
- param_opt_struct *data, *pdata, *paramo;
- BOOL not_added;
for (i = 0; parm_table[i].label; i++)
if (parm_table[i].ptr && parm_table[i].class == P_LOCAL &&
@@ -2462,30 +2256,6 @@ static void copy_service(service * pserviceDest, service * pserviceSource, BOOL
(void *)pserviceSource->copymap,
sizeof(BOOL) * NUMPARAMETERS);
}
-
- data = pserviceSource->param_opt;
- while (data) {
- not_added = True;
- pdata = pserviceDest->param_opt;
- /* Traverse destination */
- while (pdata) {
- /* If we already have same option, override it */
- if (strcmp(pdata->key, data->key) == 0) {
- string_free(&pdata->value);
- pdata->value = strdup(data->value);
- not_added = False;
- break;
- }
- pdata = pdata->next;
- }
- if (not_added) {
- paramo = smb_xmalloc(sizeof(param_opt_struct));
- paramo->key = strdup(data->key);
- paramo->value = strdup(data->value);
- DLIST_ADD(pserviceDest->param_opt, paramo);
- }
- data = data->next;
- }
}
/***************************************************************************
@@ -2755,6 +2525,22 @@ static BOOL handle_source_env(const char *pszParmValue, char **ptr)
}
/***************************************************************************
+ Handle the interpretation of the vfs object parameter.
+*************************************************************************/
+
+static BOOL handle_vfs_object(const char *pszParmValue, char **ptr)
+{
+ /* Set string value */
+
+ string_set(ptr, pszParmValue);
+
+ /* Do any other initialisation required for vfs. Note that
+ anything done here may have linking repercussions in nmbd. */
+
+ return True;
+}
+
+/***************************************************************************
Handle the include operation.
***************************************************************************/
@@ -2814,49 +2600,49 @@ static BOOL handle_copy(const char *pszParmValue, char **ptr)
}
/***************************************************************************
- Handle idmap/non unix account uid and gid allocation parameters. The format of these
+ Handle winbind/non unix account uid and gid allocation parameters. The format of these
parameters is:
[global]
- idmap uid = 1000-1999
- idmap gid = 700-899
+ winbind uid = 1000-1999
+ winbind gid = 700-899
We only do simple parsing checks here. The strings are parsed into useful
- structures in the idmap daemon code.
+ structures in the winbind daemon code.
***************************************************************************/
-/* Some lp_ routines to return idmap [ug]id information */
+/* Some lp_ routines to return winbind [ug]id information */
-static uid_t idmap_uid_low, idmap_uid_high;
-static gid_t idmap_gid_low, idmap_gid_high;
+static uid_t winbind_uid_low, winbind_uid_high;
+static gid_t winbind_gid_low, winbind_gid_high;
static uint32 non_unix_account_low, non_unix_account_high;
-BOOL lp_idmap_uid(uid_t *low, uid_t *high)
+BOOL lp_winbind_uid(uid_t *low, uid_t *high)
{
- if (idmap_uid_low == 0 || idmap_uid_high == 0)
+ if (winbind_uid_low == 0 || winbind_uid_high == 0)
return False;
if (low)
- *low = idmap_uid_low;
+ *low = winbind_uid_low;
if (high)
- *high = idmap_uid_high;
+ *high = winbind_uid_high;
return True;
}
-BOOL lp_idmap_gid(gid_t *low, gid_t *high)
+BOOL lp_winbind_gid(gid_t *low, gid_t *high)
{
- if (idmap_gid_low == 0 || idmap_gid_high == 0)
+ if (winbind_gid_low == 0 || winbind_gid_high == 0)
return False;
if (low)
- *low = idmap_gid_low;
+ *low = winbind_gid_low;
if (high)
- *high = idmap_gid_high;
+ *high = winbind_gid_high;
return True;
}
@@ -2875,9 +2661,9 @@ BOOL lp_non_unix_account_range(uint32 *low, uint32 *high)
return True;
}
-/* Do some simple checks on "idmap [ug]id" parameter values */
+/* Do some simple checks on "winbind [ug]id" parameter values */
-static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr)
+static BOOL handle_winbind_uid(const char *pszParmValue, char **ptr)
{
uint32 low, high;
@@ -2888,13 +2674,13 @@ static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr)
string_set(ptr, pszParmValue);
- idmap_uid_low = low;
- idmap_uid_high = high;
+ winbind_uid_low = low;
+ winbind_uid_high = high;
return True;
}
-static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr)
+static BOOL handle_winbind_gid(const char *pszParmValue, char **ptr)
{
uint32 low, high;
@@ -2905,8 +2691,8 @@ static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr)
string_set(ptr, pszParmValue);
- idmap_gid_low = low;
- idmap_gid_high = high;
+ winbind_gid_low = low;
+ winbind_gid_high = high;
return True;
}
@@ -3084,8 +2870,7 @@ BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
void *def_ptr = NULL;
pstring vfskey;
char *sep;
- param_opt_struct *paramo, *data;
- BOOL not_added;
+ param_opt_struct *paramo;
parmnum = map_parameter(pszParmName);
@@ -3093,35 +2878,15 @@ BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
if ((sep=strchr(pszParmName, ':')) != NULL) {
*sep = 0;
ZERO_STRUCT(vfskey);
- pstr_sprintf(vfskey, "%s:", pszParmName);
+ pstr_sprintf(vfskey, "%s:%s:",
+ (snum >= 0) ? lp_servicename(snum) : "global", pszParmName);
slen = strlen(vfskey);
pstrcat(vfskey, sep+1);
trim_string(vfskey+slen, " ", " ");
- not_added = True;
- data = (snum < 0) ? Globals.param_opt :
- ServicePtrs[snum]->param_opt;
- /* Traverse destination */
- while (data) {
- /* If we already have same option, override it */
- if (strcmp(data->key, vfskey) == 0) {
- string_free(&data->value);
- data->value = strdup(pszParmValue);
- not_added = False;
- break;
- }
- data = data->next;
- }
- if (not_added) {
- paramo = smb_xmalloc(sizeof(param_opt_struct));
- paramo->key = strdup(vfskey);
- paramo->value = strdup(pszParmValue);
- if (snum < 0) {
- DLIST_ADD(Globals.param_opt, paramo);
- } else {
- DLIST_ADD(ServicePtrs[snum]->param_opt, paramo);
- }
- }
-
+ paramo = smb_xmalloc(sizeof(param_opt_struct));
+ paramo->key = strdup(vfskey);
+ paramo->value = strdup(pszParmValue);
+ DLIST_ADD(param_opt, paramo);
*sep = ':';
return (True);
}
@@ -3471,6 +3236,7 @@ static void dump_globals(FILE *f)
{
int i;
param_opt_struct *data;
+ char *s;
fprintf(f, "# Global parameters\n[global]\n");
@@ -3484,11 +3250,14 @@ static void dump_globals(FILE *f)
print_parameter(&parm_table[i], parm_table[i].ptr, f);
fprintf(f, "\n");
}
- if (Globals.param_opt != NULL) {
- data = Globals.param_opt;
+ if (param_opt != NULL) {
+ data = param_opt;
while(data) {
- fprintf(f, "\t%s = %s\n", data->key, data->value);
- data = data->next;
+ if (((s=strstr(data->key, "global")) == data->key) &&
+ (*(s+strlen("global")) == ':')) {
+ fprintf(f, "\t%s = %s\n", s+strlen("global")+1, data->value);
+ }
+ data = data->next;
}
}
@@ -3515,6 +3284,8 @@ static void dump_a_service(service * pService, FILE * f)
{
int i;
param_opt_struct *data;
+ const char *sn;
+ char *s;
if (pService != &sDefault)
fprintf(f, "\n[%s]\n", pService->szService);
@@ -3543,11 +3314,15 @@ static void dump_a_service(service * pService, FILE * f)
((char *)pService) + pdiff, f);
fprintf(f, "\n");
}
- if (pService->param_opt != NULL) {
- data = pService->param_opt;
+ if (param_opt != NULL) {
+ data = param_opt;
+ sn = (pService == &sDefault) ? "global" : pService->szService;
while(data) {
- fprintf(f, "\t%s = %s\n", data->key, data->value);
- data = data->next;
+ if (((s=strstr(data->key, sn)) == data->key) &&
+ (*(s+strlen(sn)) == ':')) {
+ fprintf(f, "\t%s = %s\n", s+strlen(sn)+1, data->value);
+ }
+ data = data->next;
}
}
}
@@ -3809,18 +3584,7 @@ static void set_server_role(void)
DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
break;
case SEC_SERVER:
- if (lp_domain_logons())
- DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
- server_role = ROLE_DOMAIN_MEMBER;
- break;
case SEC_DOMAIN:
- if (lp_domain_logons()) {
- DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
- server_role = ROLE_DOMAIN_BDC;
- break;
- }
- server_role = ROLE_DOMAIN_MEMBER;
- break;
case SEC_ADS:
if (lp_domain_logons()) {
server_role = ROLE_DOMAIN_PDC;
@@ -3893,16 +3657,16 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
lp_save_defaults();
}
- if (Globals.param_opt != NULL) {
- data = Globals.param_opt;
+ if (param_opt != NULL) {
+ data = param_opt;
while (data) {
- string_free(&data->key);
- string_free(&data->value);
+ SAFE_FREE(data->key);
+ SAFE_FREE(data->value);
pdata = data->next;
SAFE_FREE(data);
data = pdata;
}
- Globals.param_opt = NULL;
+ param_opt = NULL;
}
/* We get sections first, so have to start 'behind' to make up */