2011-04-27 10:39:42 +04:00
/*
2003-08-13 05:53:07 +04:00
Unix SMB / CIFS implementation .
Copyright ( C ) 2001 by Martin Pool < mbp @ samba . org >
2004-07-28 17:08:08 +04:00
Copyright ( C ) Jim McDonough ( jmcd @ us . ibm . com ) 2003.
2006-02-23 18:52:24 +03:00
Copyright ( C ) Stefan Metzmacher 2003
2011-04-27 10:39:42 +04:00
2003-08-13 05:53:07 +04:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2003-08-13 05:53:07 +04:00
( at your option ) any later version .
2011-04-27 10:39:42 +04:00
2003-08-13 05:53:07 +04:00
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
2011-04-27 10:39:42 +04:00
2003-08-13 05:53:07 +04:00
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2003-08-13 05:53:07 +04:00
*/
2006-02-23 18:52:24 +03:00
# include "includes.h"
2011-04-27 10:39:42 +04:00
# include "nsswitch/winbind_struct_protocol.h"
2006-02-23 18:52:24 +03:00
2003-08-13 05:53:07 +04:00
/**
* @ file dynconfig . c
*
* @ brief Global configurations , initialized to configured defaults .
*
* This file should be the only file that depends on path
* configuration ( - - prefix , etc ) , so that if . / configure is re - run ,
* all programs will be appropriately updated . Everything else in
* Samba should import extern variables from here , rather than relying
* on preprocessor macros .
*
* Eventually some of these may become even more variable , so that
* they can for example consistently be set across the whole of Samba
* by command - line parameters , config file entries , or environment
* variables .
*
* @ todo Perhaps eventually these should be merged into the parameter
* table ? There ' s kind of a chicken - and - egg situation there . . .
* */
2011-01-02 09:46:14 +03:00
# include "dynconfig.h"
2011-04-27 10:39:42 +04:00
# ifdef strdup
# undef strdup
# endif
2011-01-02 09:46:14 +03:00
2010-04-25 12:08:00 +04:00
# define DEFINE_DYN_CONFIG_PARAM(name) \
const char * dyn_ # # name = name ; \
\
2011-02-24 13:15:06 +03:00
bool is_default_dyn_ # # name ( void ) \
2010-04-25 12:08:00 +04:00
{ \
2011-02-24 13:15:06 +03:00
if ( strcmp ( name , dyn_ # # name ) = = 0 ) { \
return true ; \
} \
return false ; \
2010-04-25 12:08:00 +04:00
} \
\
2011-02-24 13:15:06 +03:00
const char * get_dyn_ # # name ( void ) \
2010-04-25 12:08:00 +04:00
{ \
return dyn_ # # name ; \
} \
2011-02-24 13:15:06 +03:00
\
const char * set_dyn_ # # name ( const char * newpath ) \
2010-04-25 12:08:00 +04:00
{ \
2011-02-24 13:15:06 +03:00
if ( newpath = = NULL ) { \
return NULL ; \
} \
if ( strcmp ( name , newpath ) = = 0 ) { \
return dyn_ # # name ; \
} \
newpath = strdup ( newpath ) ; \
if ( newpath = = NULL ) { \
return NULL ; \
} \
if ( is_default_dyn_ # # name ( ) ) { \
/* do not free a static string */ \
} else if ( dyn_ # # name ) { \
free ( discard_const ( dyn_ # # name ) ) ; \
} \
dyn_ # # name = newpath ; \
return dyn_ # # name ; \
2010-04-25 12:08:00 +04:00
}
/* these are in common with s3 */
DEFINE_DYN_CONFIG_PARAM ( SBINDIR )
DEFINE_DYN_CONFIG_PARAM ( BINDIR )
DEFINE_DYN_CONFIG_PARAM ( SWATDIR )
DEFINE_DYN_CONFIG_PARAM ( CONFIGFILE ) /**< Location of smb.conf file. **/
DEFINE_DYN_CONFIG_PARAM ( LOGFILEBASE ) /** Log file directory. **/
DEFINE_DYN_CONFIG_PARAM ( LMHOSTSFILE ) /** Statically configured LanMan hosts. **/
DEFINE_DYN_CONFIG_PARAM ( CODEPAGEDIR )
DEFINE_DYN_CONFIG_PARAM ( LIBDIR )
DEFINE_DYN_CONFIG_PARAM ( MODULESDIR )
DEFINE_DYN_CONFIG_PARAM ( SHLIBEXT )
DEFINE_DYN_CONFIG_PARAM ( LOCKDIR )
DEFINE_DYN_CONFIG_PARAM ( STATEDIR ) /** Persistent state files. Default LOCKDIR */
DEFINE_DYN_CONFIG_PARAM ( CACHEDIR ) /** Temporary cache files. Default LOCKDIR */
DEFINE_DYN_CONFIG_PARAM ( PIDDIR )
DEFINE_DYN_CONFIG_PARAM ( NCALRPCDIR )
DEFINE_DYN_CONFIG_PARAM ( SMB_PASSWD_FILE )
DEFINE_DYN_CONFIG_PARAM ( PRIVATE_DIR )
2011-02-09 07:56:56 +03:00
DEFINE_DYN_CONFIG_PARAM ( LOCALEDIR )
2011-02-15 08:28:05 +03:00
DEFINE_DYN_CONFIG_PARAM ( NMBDSOCKETDIR )
2010-04-25 12:08:00 +04:00
DEFINE_DYN_CONFIG_PARAM ( DATADIR )
DEFINE_DYN_CONFIG_PARAM ( SETUPDIR )
2011-04-27 10:39:42 +04:00
DEFINE_DYN_CONFIG_PARAM ( WINBINDD_SOCKET_DIR ) /* from winbind_struct_protocol.h in s3 autoconf */
2011-10-21 15:18:25 +04:00
/* these are not used in s3 */
# ifdef WINBINDD_PRIVILEGED_SOCKET_DIR
2010-04-25 12:08:00 +04:00
DEFINE_DYN_CONFIG_PARAM ( WINBINDD_PRIVILEGED_SOCKET_DIR )
2011-10-21 15:18:25 +04:00
# endif
# ifdef NTP_SIGND_SOCKET_DIR
2010-04-25 12:08:00 +04:00
DEFINE_DYN_CONFIG_PARAM ( NTP_SIGND_SOCKET_DIR )
2011-10-21 15:18:25 +04:00
# endif
# ifdef PYTHONDIR
2010-04-25 12:08:00 +04:00
DEFINE_DYN_CONFIG_PARAM ( PYTHONDIR )
2011-10-21 15:18:25 +04:00
# endif
# ifdef PYTHONARCHDIR
2011-01-14 09:20:01 +03:00
DEFINE_DYN_CONFIG_PARAM ( PYTHONARCHDIR )
2011-10-21 15:18:25 +04:00
# endif
# ifdef SCRIPTSBINDIR
2011-01-02 09:46:14 +03:00
DEFINE_DYN_CONFIG_PARAM ( SCRIPTSBINDIR )
2011-04-27 10:39:42 +04:00
# endif