Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test
[samba.git] / source3 / dynconfig.c
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    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "includes.h"
21
22 /**
23  * @file dynconfig.c
24  *
25  * @brief Global configurations, initialized to configured defaults.
26  *
27  * This file should be the only file that depends on path
28  * configuration (--prefix, etc), so that if ./configure is re-run,
29  * all programs will be appropriately updated.  Everything else in
30  * Samba should import extern variables from here, rather than relying
31  * on preprocessor macros.
32  *
33  * Eventually some of these may become even more variable, so that
34  * they can for example consistently be set across the whole of Samba
35  * by command-line parameters, config file entries, or environment
36  * variables.
37  *
38  * @todo Perhaps eventually these should be merged into the parameter
39  * table?  There's kind of a chicken-and-egg situation there...
40  **/
41
42 char const *dyn_SBINDIR = SBINDIR,
43         *dyn_BINDIR = BINDIR,
44         *dyn_SWATDIR = SWATDIR;
45
46 /* JRA - FIXME - these should be dynamic char * */
47 char dyn_CONFIGFILE[1024] = CONFIGFILE; /**< Location of smb.conf file. **/
48
49 /** Log file directory. **/
50 char dyn_LOGFILEBASE[1024] = LOGFILEBASE;
51
52 /** Statically configured LanMan hosts. **/
53 char dyn_LMHOSTSFILE[1024] = LMHOSTSFILE;
54
55 /**
56  * @brief Samba data directory.
57  *
58  * @sa data_path() to get the path to a file inside the CODEPAGEDIR.
59  **/
60 char dyn_CODEPAGEDIR[1024] = CODEPAGEDIR;
61
62 /**
63  * @brief Samba library directory.
64  *
65  * @sa lib_path() to get the path to a file inside the LIBDIR.
66  **/
67 char dyn_LIBDIR[1024] = LIBDIR;
68 fstring dyn_SHLIBEXT = SHLIBEXT;
69
70 /**
71  * @brief Directory holding lock files.
72  *
73  * Not writable, but used to set a default in the parameter table.
74  **/
75 char dyn_LOCKDIR[1024] = LOCKDIR;
76 char dyn_PIDDIR[1024]  = PIDDIR;
77
78 char dyn_SMB_PASSWD_FILE[1024] = SMB_PASSWD_FILE;
79 char dyn_PRIVATE_DIR[1024] = PRIVATE_DIR;
80
81
82 /* In non-FHS mode, these should be configurable using 'lock dir =';
83    but in FHS mode, they are their own directory.  Implement as wrapper
84    functions so that everything can still be kept in dynconfig.c.
85  */
86
87 char *dyn_STATEDIR(void)
88 {
89 #ifdef FHS_COMPATIBLE
90         return STATEDIR;
91 #else
92         return lp_lockdir();
93 #endif
94 }
95
96 char *dyn_CACHEDIR(void)
97 {
98 #ifdef FHS_COMPATIBLE
99         return CACHEDIR;
100 #else
101         return lp_lockdir();
102 #endif
103 }