1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

lib/param: Remove special handling for 'state dir' and 'cache dir'

The build system gives these two parameters different defaults
(compared with lock dir) in both the --enable-fhs and default mode, so
the logic to use lock dir no longer applies unless the build has been
very specially constructed.

Therefore, remove the special case handling and make these normal
parameters again.

Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Andrew Bartlett 2014-01-15 15:59:54 +13:00
parent 86850860f8
commit 4ea7318e56
9 changed files with 16 additions and 46 deletions

View File

@ -2,7 +2,7 @@
context="G"
advanced="1" developer="1"
type="string"
generated_function="0"
constant="1"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>Usually, most of the TDB files are stored in the <parameter

View File

@ -2,7 +2,7 @@
context="G"
advanced="1" developer="1"
type="string"
generated_function="0"
constant="1"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>Usually, most of the TDB files are stored in the

View File

@ -318,10 +318,6 @@ static struct loadparm_context *global_loadparm_context;
#include "lib/param/param_functions.c"
/* These functions remain only in lib/param for now */
FN_GLOBAL_CONST_STRING(cachedir, szCacheDir)
FN_GLOBAL_CONST_STRING(statedir, szStateDir)
/* These functions cannot be auto-generated */
FN_LOCAL_BOOL(autoloaded, autoloaded)
FN_GLOBAL_CONST_STRING(dnsdomain, dnsdomain)

View File

@ -3316,7 +3316,7 @@ static struct parm_struct parm_table[] = {
.label = "state directory",
.type = P_STRING,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(szStateDir),
.offset = GLOBAL_VAR(state_directory),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,
@ -3325,7 +3325,7 @@ static struct parm_struct parm_table[] = {
.label = "cache directory",
.type = P_STRING,
.p_class = P_GLOBAL,
.offset = GLOBAL_VAR(szCacheDir),
.offset = GLOBAL_VAR(cache_directory),
.special = NULL,
.enum_list = NULL,
.flags = FLAG_ADVANCED,

View File

@ -123,7 +123,7 @@ char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
char *lpcfg_state_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
const char *name)
{
return lpcfg_common_path(mem_ctx, lpcfg_statedir(lp_ctx), name);
return lpcfg_common_path(mem_ctx, lpcfg_state_directory(lp_ctx), name);
}
/**
@ -132,7 +132,7 @@ char *lpcfg_state_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
char *lpcfg_cache_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
const char *name)
{
return lpcfg_common_path(mem_ctx, lpcfg_cachedir(lp_ctx), name);
return lpcfg_common_path(mem_ctx, lpcfg_cache_directory(lp_ctx), name);
}
/**

View File

@ -987,8 +987,6 @@ NTSTATUS trust_pw_change(struct netlogon_creds_cli_context *context,
#include "source3/param/param_proto.h"
const char *lp_statedir(void);
const char *lp_cachedir(void);
int lp_winbind_max_domain_connections(void);
bool lp_idmap_range(const char *domain_name, uint32_t *low, uint32_t *high);
bool lp_idmap_default_range(uint32_t *low, uint32_t *high);

View File

@ -1530,7 +1530,7 @@ char *lock_path(const char *name)
char *state_path(const char *name)
{
return xx_path(name, lp_statedir());
return xx_path(name, lp_state_directory());
}
/**
@ -1543,7 +1543,7 @@ char *state_path(const char *name)
char *cache_path(const char *name)
{
return xx_path(name, lp_cachedir());
return xx_path(name, lp_cache_directory());
}
/*******************************************************************

View File

@ -119,8 +119,6 @@ static bool defaults_saved = false;
char *szLdapUserSuffix; \
char *szLdapIdmapSuffix; \
char *szLdapGroupSuffix; \
char *szStateDir; \
char *szCacheDir; \
char *szIdmapUID; \
char *szIdmapGID; \
char *szIdmapBackend; \
@ -767,8 +765,8 @@ static void init_globals(bool reinit_globals)
string_set(&Globals.passwd_program, "");
string_set(&Globals.lock_directory, get_dyn_LOCKDIR());
string_set(&Globals.szStateDir, get_dyn_STATEDIR());
string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
string_set(&Globals.state_directory, get_dyn_STATEDIR());
string_set(&Globals.cache_directory, get_dyn_CACHEDIR());
string_set(&Globals.pid_directory, get_dyn_PIDDIR());
string_set(&Globals.nbt_client_socket_address, "0.0.0.0");
/*
@ -1164,28 +1162,6 @@ char *lp_ ## fn_name(TALLOC_CTX *ctx,int i) {return(lp_string((ctx), (LP_SNUM_OK
#define FN_LOCAL_PARM_CHAR(fn_name,val) \
char lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
/* If lp_statedir() and lp_cachedir() are explicitely set during the
* build process or in smb.conf, we use that value. Otherwise they
* default to the value of lp_lock_directory(). */
const char *lp_statedir(void) {
if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
(strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
return(*(char **)(&Globals.szStateDir) ?
*(char **)(&Globals.szStateDir) : "");
else
return(*(char **)(&Globals.lock_directory) ?
*(char **)(&Globals.lock_directory) : "");
}
const char *lp_cachedir(void) {
if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
(strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
return(*(char **)(&Globals.szCacheDir) ?
*(char **)(&Globals.szCacheDir) : "");
else
return(*(char **)(&Globals.lock_directory) ?
*(char **)(&Globals.lock_directory) : "");
}
static FN_GLOBAL_INTEGER(winbind_max_domain_connections_int,
winbindMaxDomainConnections)

View File

@ -98,24 +98,24 @@ static int do_global_checks(void)
lp_lock_directory());
}
if (!directory_exist_stat(lp_statedir(), &st)) {
if (!directory_exist_stat(lp_state_directory(), &st)) {
fprintf(stderr, "ERROR: state directory %s does not exist\n\n",
lp_statedir());
lp_state_directory());
ret = 1;
} else if ((st.st_ex_mode & 0777) != 0755) {
fprintf(stderr, "WARNING: state directory %s should have "
"permissions 0755 for browsing to work\n\n",
lp_statedir());
lp_state_directory());
}
if (!directory_exist_stat(lp_cachedir(), &st)) {
if (!directory_exist_stat(lp_cache_directory(), &st)) {
fprintf(stderr, "ERROR: cache directory %s does not exist\n\n",
lp_cachedir());
lp_cache_directory());
ret = 1;
} else if ((st.st_ex_mode & 0777) != 0755) {
fprintf(stderr, "WARNING: cache directory %s should have "
"permissions 0755 for browsing to work\n\n",
lp_cachedir());
lp_cache_directory());
}
if (!directory_exist_stat(lp_pid_directory(), &st)) {