lib/param: Remove special handling for 'state dir' and 'cache dir'
authorAndrew Bartlett <abartlet@samba.org>
Wed, 15 Jan 2014 02:59:54 +0000 (15:59 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 12 Feb 2014 00:17:13 +0000 (13:17 +1300)
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>
docs-xml/smbdotconf/misc/cachedirectory.xml
docs-xml/smbdotconf/misc/statedirectory.xml
lib/param/loadparm.c
lib/param/param_table.c
lib/param/util.c
source3/include/proto.h
source3/lib/util.c
source3/param/loadparm.c
source3/utils/testparm.c

index 03f4c622c620d20b903211ae5e7be8493e0a6523..e72d852db9bde4cae043668e34cca2f5e3c18b57 100644 (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
index 029797ea022caae2dc5a160ff9f0cbe7401d84fb..1079868678a805374cabc9bb0602e34cda0504ac 100644 (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
index 17ac2d5fda7cdeb509366f77eb3ef7485f12add2..f7b2a4528e58b431c5b8309dd7fa4c500e94e958 100644 (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)
index 713db9016ebf120442885322dd7203f5f223ddae..8dc6183e031f50d3caad74d3621f468e24502ff6 100644 (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,
index 35743ea18a97793181363f8ba583cf5843c98ae6..232e85b75c1786a7a02053b76755dd3647f7518d 100644 (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);
 }
 
 /**
index 3f5abd07a830bb193ba3e684234cd8023ab643dd..8f35937d13099c807e2fef9c8f6613a0e2c6fb86 100644 (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);
index 342db91c9b806afc747d47047bb44c8bb675e852..cddb53c3cb9f49e9fb5cc5e28d5573d068365609 100644 (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());
 }
 
 /*******************************************************************
index 0fce5399685f2214c482aa1d77722f5feac2337f..ac0a5dc2a971aafda04c46d808940bd68cc7336b 100644 (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)
 
index 57f619e456c095cd2750b0d3cf5c1ec4ed4fe5b6..50518c2f12f4bc3709c17430ceb24fcccd81c055 100644 (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)) {