| 1 | /*
|
|---|
| 2 | Unix SMB/CIFS implementation.
|
|---|
| 3 | Copyright (C) 2001 by Martin Pool <[email protected]>
|
|---|
| 4 | Copyright (C) 2003 by Jim McDonough <[email protected]>
|
|---|
| 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 2 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, write to the Free Software
|
|---|
| 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|---|
| 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 | char const *dyn_SBINDIR = SBINDIR,
|
|---|
| 44 | *dyn_BINDIR = BINDIR,
|
|---|
| 45 | *dyn_SWATDIR = SWATDIR;
|
|---|
| 46 |
|
|---|
| 47 | #ifdef __OS2__
|
|---|
| 48 | const char * getconfigfile()
|
|---|
| 49 | {
|
|---|
| 50 | static pstring buffer = "";
|
|---|
| 51 | if (!*buffer)
|
|---|
| 52 | {
|
|---|
| 53 | snprintf(buffer, 260, "%s/samba/smb.conf", getenv("ETC"));
|
|---|
| 54 |
|
|---|
| 55 | /* Set UNIXROOT to x:\MPTN if UNIXROOT is undefined */
|
|---|
| 56 | if (getenv("UNIXROOT") == NULL) {
|
|---|
| 57 | static pstring unixroot = "";
|
|---|
| 58 | strncpy(unixroot,getenv("ETC"),strlen(getenv("ETC"))-4);
|
|---|
| 59 | setenv("UNIXROOT",unixroot,0);
|
|---|
| 60 | }
|
|---|
| 61 | /* Make sure TMPIR points to a proper value */
|
|---|
| 62 | static pstring tmpdir = "";
|
|---|
| 63 | if (getenv("TMPDIR") == NULL && getenv("TEMP") != NULL) {
|
|---|
| 64 | strncpy(tmpdir,getenv("TEMP"),strlen(getenv("TEMP")));
|
|---|
| 65 | setenv("TMPDIR",tmpdir,0);
|
|---|
| 66 | }
|
|---|
| 67 | if (getenv("TMPDIR") == NULL) {
|
|---|
| 68 | strncpy(tmpdir,getenv("ETC"),2);
|
|---|
| 69 | stpcpy(tmpdir,"/OS2/SYSTEM");
|
|---|
| 70 | setenv("TMPDIR",tmpdir,0);
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|
| 73 | return buffer;
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | const char * getlogbase()
|
|---|
| 77 | {
|
|---|
| 78 | static pstring buffer = "";
|
|---|
| 79 | if (!*buffer)
|
|---|
| 80 | {
|
|---|
| 81 | snprintf(buffer, 260, "%s/samba/log", getenv("ETC"));
|
|---|
| 82 | }
|
|---|
| 83 | return buffer;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | const char * getlockdir()
|
|---|
| 87 | {
|
|---|
| 88 | static pstring buffer = "";
|
|---|
| 89 | if (!*buffer)
|
|---|
| 90 | {
|
|---|
| 91 | snprintf(buffer, 260, "%s/samba/lock", getenv("ETC"));
|
|---|
| 92 | }
|
|---|
| 93 | return buffer;
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | const char * getpiddir()
|
|---|
| 97 | {
|
|---|
| 98 | static pstring buffer = "";
|
|---|
| 99 | if (!*buffer)
|
|---|
| 100 | {
|
|---|
| 101 | snprintf(buffer, 260, "%s/samba/pid", getenv("ETC"));
|
|---|
| 102 | }
|
|---|
| 103 | return buffer;
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | const char * getprivatedir()
|
|---|
| 107 | {
|
|---|
| 108 | static pstring buffer = "";
|
|---|
| 109 | if (!*buffer)
|
|---|
| 110 | {
|
|---|
| 111 | snprintf(buffer, 260, "%s/samba/private", getenv("ETC"));
|
|---|
| 112 | }
|
|---|
| 113 | return buffer;
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | const char * getsmbpasswd()
|
|---|
| 117 | {
|
|---|
| 118 | static pstring buffer = "";
|
|---|
| 119 | if (!*buffer)
|
|---|
| 120 | {
|
|---|
| 121 | snprintf(buffer, 260, "%s/samba/private/smbpasswd", getenv("ETC"));
|
|---|
| 122 | }
|
|---|
| 123 | return buffer;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | const char * getlmhosts()
|
|---|
| 127 | {
|
|---|
| 128 | static pstring buffer = "";
|
|---|
| 129 | if (!*buffer)
|
|---|
| 130 | {
|
|---|
| 131 | snprintf(buffer, 260, "%s/samba/lmhosts", getenv("ETC"));
|
|---|
| 132 | }
|
|---|
| 133 | return buffer;
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | /**
|
|---|
| 137 | * @brief Samba library directory.
|
|---|
| 138 | *
|
|---|
| 139 | * @sa lib_path() to get the path to a file inside the LIBDIR.
|
|---|
| 140 | **/
|
|---|
| 141 | pstring dyn_LIBDIR = LIBDIR;
|
|---|
| 142 | fstring dyn_SHLIBEXT = SHLIBEXT;
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 | #else
|
|---|
| 146 |
|
|---|
| 147 | pstring dyn_CONFIGFILE = CONFIGFILE; /**< Location of smb.conf file. **/
|
|---|
| 148 |
|
|---|
| 149 | /** Log file directory. **/
|
|---|
| 150 | pstring dyn_LOGFILEBASE = LOGFILEBASE;
|
|---|
| 151 |
|
|---|
| 152 | /** Statically configured LanMan hosts. **/
|
|---|
| 153 | pstring dyn_LMHOSTSFILE = LMHOSTSFILE;
|
|---|
| 154 |
|
|---|
| 155 | /**
|
|---|
| 156 | * @brief Samba library directory.
|
|---|
| 157 | *
|
|---|
| 158 | * @sa lib_path() to get the path to a file inside the LIBDIR.
|
|---|
| 159 | **/
|
|---|
| 160 | pstring dyn_LIBDIR = LIBDIR;
|
|---|
| 161 | fstring dyn_SHLIBEXT = SHLIBEXT;
|
|---|
| 162 |
|
|---|
| 163 | /**
|
|---|
| 164 | * @brief Directory holding lock files.
|
|---|
| 165 | *
|
|---|
| 166 | * Not writable, but used to set a default in the parameter table.
|
|---|
| 167 | **/
|
|---|
| 168 | pstring dyn_LOCKDIR = LOCKDIR;
|
|---|
| 169 | pstring dyn_PIDDIR = PIDDIR;
|
|---|
| 170 |
|
|---|
| 171 | pstring dyn_SMB_PASSWD_FILE = SMB_PASSWD_FILE;
|
|---|
| 172 | pstring dyn_PRIVATE_DIR = PRIVATE_DIR;
|
|---|
| 173 | #endif /* __OS2__ */
|
|---|