~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to source3/dynconfig.c

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Unix SMB/CIFS implementation.
 
3
   Copyright (C) 2001 by Martin Pool <mbp@samba.org>
 
4
   Copyright (C) 2003 by Jim McDonough <jmcd@us.ibm.com>
 
5
   Copyright (C) 2007 by Jeremy Allison <jra@samba.org>
 
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
#define DEFINE_DYN_CONFIG_PARAM(name) \
 
44
static char *dyn_##name; \
 
45
\
 
46
 const char *get_dyn_##name(void) \
 
47
{\
 
48
        if (dyn_##name == NULL) {\
 
49
                return name;\
 
50
        }\
 
51
        return dyn_##name;\
 
52
}\
 
53
\
 
54
 const char *set_dyn_##name(const char *newpath) \
 
55
{\
 
56
        if (dyn_##name) {\
 
57
                SAFE_FREE(dyn_##name);\
 
58
        }\
 
59
        dyn_##name = SMB_STRDUP(newpath);\
 
60
        return dyn_##name;\
 
61
}\
 
62
\
 
63
 bool is_default_dyn_##name(void) \
 
64
{\
 
65
        return (dyn_##name == NULL);\
 
66
}
 
67
 
 
68
DEFINE_DYN_CONFIG_PARAM(SBINDIR)
 
69
DEFINE_DYN_CONFIG_PARAM(BINDIR)
 
70
DEFINE_DYN_CONFIG_PARAM(SWATDIR)
 
71
DEFINE_DYN_CONFIG_PARAM(CONFIGFILE) /**< Location of smb.conf file. **/
 
72
DEFINE_DYN_CONFIG_PARAM(LOGFILEBASE) /** Log file directory. **/
 
73
DEFINE_DYN_CONFIG_PARAM(LMHOSTSFILE) /** Statically configured LanMan hosts. **/
 
74
DEFINE_DYN_CONFIG_PARAM(CODEPAGEDIR)
 
75
DEFINE_DYN_CONFIG_PARAM(LIBDIR)
 
76
DEFINE_DYN_CONFIG_PARAM(MODULESDIR)
 
77
DEFINE_DYN_CONFIG_PARAM(SHLIBEXT)
 
78
DEFINE_DYN_CONFIG_PARAM(LOCKDIR)
 
79
DEFINE_DYN_CONFIG_PARAM(STATEDIR) /** Persistent state files. Default LOCKDIR */
 
80
DEFINE_DYN_CONFIG_PARAM(CACHEDIR) /** Temporary cache files. Default LOCKDIR */
 
81
DEFINE_DYN_CONFIG_PARAM(PIDDIR)
 
82
DEFINE_DYN_CONFIG_PARAM(NCALRPCDIR)
 
83
DEFINE_DYN_CONFIG_PARAM(SMB_PASSWD_FILE)
 
84
DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR)