From 4ea7318e562f21eaf913555b5e85dc556305346f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 15 Jan 2014 15:59:54 +1300 Subject: [PATCH] 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 Signed-off-by: Andrew Bartlett Reviewed-by: Andrew Bartlett Reviewed-by: Michael Adam --- docs-xml/smbdotconf/misc/cachedirectory.xml | 2 +- docs-xml/smbdotconf/misc/statedirectory.xml | 2 +- lib/param/loadparm.c | 4 ---- lib/param/param_table.c | 4 ++-- lib/param/util.c | 4 ++-- source3/include/proto.h | 2 -- source3/lib/util.c | 4 ++-- source3/param/loadparm.c | 28 ++-------------------------- source3/utils/testparm.c | 12 ++++++------ 9 files changed, 16 insertions(+), 46 deletions(-) diff --git a/docs-xml/smbdotconf/misc/cachedirectory.xml b/docs-xml/smbdotconf/misc/cachedirectory.xml index 03f4c622c62..e72d852db9b 100644 --- a/docs-xml/smbdotconf/misc/cachedirectory.xml +++ b/docs-xml/smbdotconf/misc/cachedirectory.xml @@ -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"> Usually, most of the TDB files are stored in the Usually, most of the TDB files are stored in the diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 17ac2d5fda7..f7b2a4528e5 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -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) diff --git a/lib/param/param_table.c b/lib/param/param_table.c index 713db9016eb..8dc6183e031 100644 --- a/lib/param/param_table.c +++ b/lib/param/param_table.c @@ -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, diff --git a/lib/param/util.c b/lib/param/util.c index 35743ea18a9..232e85b75c1 100644 --- a/lib/param/util.c +++ b/lib/param/util.c @@ -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); } /** diff --git a/source3/include/proto.h b/source3/include/proto.h index 3f5abd07a83..8f35937d130 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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); diff --git a/source3/lib/util.c b/source3/lib/util.c index 342db91c9b8..cddb53c3cb9 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -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()); } /******************************************************************* diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 0fce5399685..ac0a5dc2a97 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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) diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 57f619e456c..50518c2f12f 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -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)) { -- 2.11.4.GIT