s3:libsmb: remove unused cli_readall*
[Samba.git] / dynconfig / dynconfig.c
blobaf9d7350a752d1011268ad4efb243a3aa9cb087c
1 /*
2 Unix SMB/CIFS implementation.
3 Copyright (C) 2001 by Martin Pool <mbp@samba.org>
4 Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
5 Copyright (C) Stefan Metzmacher 2003
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "nsswitch/winbind_struct_protocol.h"
24 /**
25 * @file dynconfig.c
27 * @brief Global configurations, initialized to configured defaults.
29 * This file should be the only file that depends on path
30 * configuration (--prefix, etc), so that if ./configure is re-run,
31 * all programs will be appropriately updated. Everything else in
32 * Samba should import extern variables from here, rather than relying
33 * on preprocessor macros.
35 * Eventually some of these may become even more variable, so that
36 * they can for example consistently be set across the whole of Samba
37 * by command-line parameters, config file entries, or environment
38 * variables.
40 * @todo Perhaps eventually these should be merged into the parameter
41 * table? There's kind of a chicken-and-egg situation there...
42 **/
44 #include "dynconfig.h"
45 #ifdef strdup
46 #undef strdup
47 #endif
49 #define DEFINE_DYN_CONFIG_PARAM(name) \
50 const char *dyn_##name = name; \
52 bool is_default_dyn_##name(void) \
54 if (strcmp(name, dyn_##name) == 0) { \
55 return true; \
56 } \
57 return false; \
60 const char *get_dyn_##name(void) \
62 return dyn_##name;\
65 const char *set_dyn_##name(const char *newpath) \
67 if (newpath == NULL) { \
68 return NULL; \
69 } \
70 if (strcmp(name, newpath) == 0) { \
71 return dyn_##name; \
72 } \
73 newpath = strdup(newpath);\
74 if (newpath == NULL) { \
75 return NULL; \
76 } \
77 if (is_default_dyn_##name()) { \
78 /* do not free a static string */ \
79 } else if (dyn_##name) {\
80 free(discard_const(dyn_##name)); \
82 dyn_##name = newpath; \
83 return dyn_##name;\
86 DEFINE_DYN_CONFIG_PARAM(SBINDIR)
87 DEFINE_DYN_CONFIG_PARAM(BINDIR)
88 DEFINE_DYN_CONFIG_PARAM(CONFIGFILE) /**< Location of smb.conf file. **/
89 DEFINE_DYN_CONFIG_PARAM(LOGFILEBASE) /** Log file directory. **/
90 DEFINE_DYN_CONFIG_PARAM(LMHOSTSFILE) /** Statically configured LanMan hosts. **/
91 DEFINE_DYN_CONFIG_PARAM(CODEPAGEDIR)
92 DEFINE_DYN_CONFIG_PARAM(LIBDIR)
93 DEFINE_DYN_CONFIG_PARAM(MODULESDIR)
94 DEFINE_DYN_CONFIG_PARAM(SHLIBEXT)
95 DEFINE_DYN_CONFIG_PARAM(LOCKDIR)
96 DEFINE_DYN_CONFIG_PARAM(STATEDIR) /** Persistent state files. Default LOCKDIR */
97 DEFINE_DYN_CONFIG_PARAM(CACHEDIR) /** Temporary cache files. Default LOCKDIR */
98 DEFINE_DYN_CONFIG_PARAM(PIDDIR)
99 DEFINE_DYN_CONFIG_PARAM(NCALRPCDIR)
100 DEFINE_DYN_CONFIG_PARAM(SMB_PASSWD_FILE)
101 DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR)
102 DEFINE_DYN_CONFIG_PARAM(LOCALEDIR)
103 DEFINE_DYN_CONFIG_PARAM(NMBDSOCKETDIR)
104 DEFINE_DYN_CONFIG_PARAM(DATADIR)
105 DEFINE_DYN_CONFIG_PARAM(SETUPDIR)
106 DEFINE_DYN_CONFIG_PARAM(WINBINDD_SOCKET_DIR) /* from winbind_struct_protocol.h in s3 autoconf */
107 DEFINE_DYN_CONFIG_PARAM(WINBINDD_PRIVILEGED_SOCKET_DIR)
108 DEFINE_DYN_CONFIG_PARAM(NTP_SIGND_SOCKET_DIR)
109 DEFINE_DYN_CONFIG_PARAM(PYTHONDIR)
110 DEFINE_DYN_CONFIG_PARAM(PYTHONARCHDIR)
111 DEFINE_DYN_CONFIG_PARAM(SCRIPTSBINDIR)