source: vendor/current/source4/dynconfig/dynconfig.c@ 740

Last change on this file since 740 was 740, checked in by Silvan Scherrer, 12 years ago

Samba Server: update vendor to 3.6.0

File size: 3.6 KB
Line 
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
6
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.
11
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.
16
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/>.
19*/
20
21#include "includes.h"
22
23/**
24 * @file dynconfig.c
25 *
26 * @brief Global configurations, initialized to configured defaults.
27 *
28 * This file should be the only file that depends on path
29 * configuration (--prefix, etc), so that if ./configure is re-run,
30 * all programs will be appropriately updated. Everything else in
31 * Samba should import extern variables from here, rather than relying
32 * on preprocessor macros.
33 *
34 * Eventually some of these may become even more variable, so that
35 * they can for example consistently be set across the whole of Samba
36 * by command-line parameters, config file entries, or environment
37 * variables.
38 *
39 * @todo Perhaps eventually these should be merged into the parameter
40 * table? There's kind of a chicken-and-egg situation there...
41 **/
42
43#include "dynconfig.h"
44
45#define DEFINE_DYN_CONFIG_PARAM(name) \
46const char *dyn_##name = name; \
47\
48bool is_default_dyn_##name(void) \
49{\
50 if (strcmp(name, dyn_##name) == 0) { \
51 return true; \
52 } \
53 return false; \
54}\
55\
56const char *get_dyn_##name(void) \
57{\
58 return dyn_##name;\
59}\
60\
61const char *set_dyn_##name(const char *newpath) \
62{\
63 if (newpath == NULL) { \
64 return NULL; \
65 } \
66 if (strcmp(name, newpath) == 0) { \
67 return dyn_##name; \
68 } \
69 newpath = strdup(newpath);\
70 if (newpath == NULL) { \
71 return NULL; \
72 } \
73 if (is_default_dyn_##name()) { \
74 /* do not free a static string */ \
75 } else if (dyn_##name) {\
76 free(discard_const(dyn_##name)); \
77 }\
78 dyn_##name = newpath; \
79 return dyn_##name;\
80}
81
82/* these are in common with s3 */
83DEFINE_DYN_CONFIG_PARAM(SBINDIR)
84DEFINE_DYN_CONFIG_PARAM(BINDIR)
85DEFINE_DYN_CONFIG_PARAM(SWATDIR)
86DEFINE_DYN_CONFIG_PARAM(CONFIGFILE) /**< Location of smb.conf file. **/
87DEFINE_DYN_CONFIG_PARAM(LOGFILEBASE) /** Log file directory. **/
88DEFINE_DYN_CONFIG_PARAM(LMHOSTSFILE) /** Statically configured LanMan hosts. **/
89DEFINE_DYN_CONFIG_PARAM(CODEPAGEDIR)
90DEFINE_DYN_CONFIG_PARAM(LIBDIR)
91DEFINE_DYN_CONFIG_PARAM(MODULESDIR)
92DEFINE_DYN_CONFIG_PARAM(SHLIBEXT)
93DEFINE_DYN_CONFIG_PARAM(LOCKDIR)
94DEFINE_DYN_CONFIG_PARAM(STATEDIR) /** Persistent state files. Default LOCKDIR */
95DEFINE_DYN_CONFIG_PARAM(CACHEDIR) /** Temporary cache files. Default LOCKDIR */
96DEFINE_DYN_CONFIG_PARAM(PIDDIR)
97DEFINE_DYN_CONFIG_PARAM(NCALRPCDIR)
98DEFINE_DYN_CONFIG_PARAM(SMB_PASSWD_FILE)
99DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR)
100DEFINE_DYN_CONFIG_PARAM(LOCALEDIR)
101DEFINE_DYN_CONFIG_PARAM(NMBDSOCKETDIR)
102
103/* these are not in s3 */
104DEFINE_DYN_CONFIG_PARAM(DATADIR)
105DEFINE_DYN_CONFIG_PARAM(SETUPDIR)
106DEFINE_DYN_CONFIG_PARAM(WINBINDD_SOCKET_DIR)
107DEFINE_DYN_CONFIG_PARAM(WINBINDD_PRIVILEGED_SOCKET_DIR)
108DEFINE_DYN_CONFIG_PARAM(NTP_SIGND_SOCKET_DIR)
109DEFINE_DYN_CONFIG_PARAM(PYTHONDIR)
110DEFINE_DYN_CONFIG_PARAM(PYTHONARCHDIR)
111DEFINE_DYN_CONFIG_PARAM(SCRIPTSBINDIR)
Note: See TracBrowser for help on using the repository browser.