From caef2d2884fb202bd6184f9a676ecff94c7ab600 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 19 Nov 2001 03:35:27 +0000 Subject: LIBDIR and LOCKDIR are dynamically configured too. (This used to be commit 868999ad3c82ad72f11d5b3208b0e42b1ed95096) --- source3/Makefile.in | 12 +++++++----- source3/dynconfig.c | 17 +++++++++++++++++ source3/include/dynconfig.h | 1 + source3/include/local.h | 5 ----- source3/lib/util.c | 13 +++++++++---- source3/param/loadparm.c | 2 +- source3/smbd/build_options.c | 4 +--- 7 files changed, 36 insertions(+), 18 deletions(-) (limited to 'source3') diff --git a/source3/Makefile.in b/source3/Makefile.in index 5716ac0826..a122226d0c 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -72,15 +72,17 @@ man_langs = "@manlangs@" PASSWD_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATE_DIR)\" FLAGS1 = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper $(CPPFLAGS) -I. -I$(srcdir) FLAGS2 = -FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\" -DLIBDIR=\"$(LIBDIR)\" -FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H +FLAGS3 = +FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\" +FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) FLAGS = $(ISA) $(FLAGS5) $(PASSWD_FLAGS) FLAGS32 = $(ISA32) $(FLAGS5) $(PASSWD_FLAGS) PATH_FLAGS1 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\" -PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\" -DLOGFILEBASE=\"$(LOGFILEBASE)\" -PATH_FLAGS = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" +PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\" +PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" +PATH_FLAGS4 = $(PATH_FLAGS3) -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" +PATH_FLAGS = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" -DLOGFILEBASE=\"$(LOGFILEBASE)\" WINBIND_PROGS = bin/wbinfo WINBIND_SPROGS = bin/winbindd diff --git a/source3/dynconfig.c b/source3/dynconfig.c index fd77e88309..34603fee86 100644 --- a/source3/dynconfig.c +++ b/source3/dynconfig.c @@ -34,6 +34,9 @@ * 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... **/ char const *dyn_SBINDIR = SBINDIR, @@ -45,3 +48,17 @@ pstring dyn_CONFIGFILE = CONFIGFILE; /**< Location of smb.conf file. **/ pstring dyn_LOGFILEBASE; /**< Log file directory. **/ pstring dyn_LMHOSTSFILE; /**< Statically configured LanMan hosts. **/ + +/** + * @brief Samba library directory. + * + * @sa lib_path() to get the path to a file inside the LIBDIR. + **/ +pstring dyn_LIBDIR; + +/** + * @brief Directory holding lock files. + * + * Not writable, but used to set a default in the parameter table. + **/ +const pstring dyn_LOCKDIR; diff --git a/source3/include/dynconfig.h b/source3/include/dynconfig.h index c02ee86abf..3aba194ab2 100644 --- a/source3/include/dynconfig.h +++ b/source3/include/dynconfig.h @@ -29,3 +29,4 @@ extern char const *dyn_SBINDIR, extern pstring dyn_CONFIGFILE; extern pstring dyn_LOGFILEBASE, dyn_LMHOSTSFILE; +extern pstring dyn_LIBDIR, dyn_LOCKDIR; diff --git a/source3/include/local.h b/source3/include/local.h index 84f5a3d1df..cec48850a9 100644 --- a/source3/include/local.h +++ b/source3/include/local.h @@ -72,11 +72,6 @@ /* wchar separators for lists */ #define LIST_SEP_W wchar_list_sep -#ifndef LOCKDIR -/* this should have been set in the Makefile */ -#define LOCKDIR "/tmp/samba" -#endif - /* this is where browse lists are kept in the lock dir */ #define SERVER_LIST "browse.dat" diff --git a/source3/lib/util.c b/source3/lib/util.c index 81e30aa8e3..ea39d8a05b 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1782,13 +1782,18 @@ char *lock_path(char *name) return fname; } -/***************************************************************** -a useful function for returning a path in the Samba lib directory - *****************************************************************/ + +/** + * @brief Returns an absolute path to a file in the Samba lib directory. + * + * @param name File to find, relative to LIBDIR. + * + * @retval Pointer to a static #pstring containing the full path. + **/ char *lib_path(char *name) { static pstring fname; - snprintf(fname, sizeof(fname), "%s/%s", LIBDIR, name); + snprintf(fname, sizeof(fname), "%s/%s", dyn_LIBDIR, name); return fname; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index f1ee1803f3..931e07b37c 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1199,7 +1199,7 @@ static void init_globals(void) string_set(&Globals.szWorkGroup, WORKGROUP); string_set(&Globals.szPasswdProgram, ""); string_set(&Globals.szPrintcapname, PRINTCAP_NAME); - string_set(&Globals.szLockDir, LOCKDIR); + string_set(&Globals.szLockDir, dyn_LOCKDIR); string_set(&Globals.szSocketAddress, "0.0.0.0"); pstrcpy(s, "Samba "); pstrcat(s, VERSION); diff --git a/source3/smbd/build_options.c b/source3/smbd/build_options.c index 8c22e95451..7ddbd2433a 100644 --- a/source3/smbd/build_options.c +++ b/source3/smbd/build_options.c @@ -194,9 +194,7 @@ void build_options(BOOL screen) #endif output(screen," SBINDIR: %s\n", dyn_SBINDIR); output(screen," BINDIR: %s\n", dyn_BINDIR); -#ifdef LOCKDIR - output(screen," LOCKDIR: %s\n",LOCKDIR); -#endif + output(screen," LOCKDIR: %s\n",dyn_LOCKDIR); #ifdef DRIVERFILE output(screen," DRIVERFILE: %s\n",DRIVERFILE); #endif -- cgit