1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

Store some path names in global variables initialized to configure

default, rather than in preprocessor macros.
This commit is contained in:
Martin Pool 0001-01-01 00:00:00 +00:00
parent 91e07a7fdc
commit 79ec88f0da
41 changed files with 825 additions and 773 deletions

View File

@ -33,6 +33,9 @@ SHELL=/bin/sh
# will search for a POSIX-compliant shell, and that might not be
# /bin/sh on some platforms. I guess it's not a big problem -- mbp
# See the autoconf manual "Installation Directory Variables" for a
# discussion of thesubtle use of these variables.
BASEDIR= @prefix@
BINDIR = @bindir@
# sbindir is mapped to bindir when compiling SAMBA in 2.0.x compatibility mode.
@ -67,14 +70,16 @@ LOCKDIR = @lockdir@
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) -DLOGFILEBASE=\"$(LOGFILEBASE)\"
FLAGS1 = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper $(CPPFLAGS) -I. -I$(srcdir)
FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\"
FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DBINDIR=\"$(BINDIR)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\" -DLIBDIR=\"$(LIBDIR)\"
FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\"
FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\" -DLIBDIR=\"$(LIBDIR)\"
FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H
FLAGS = $(ISA) $(FLAGS5) $(PASSWD_FLAGS)
FLAGS32 = $(ISA32) $(FLAGS5) $(PASSWD_FLAGS)
PATH_FLAGS = -DSBINDIR=\"$(SBINDIR)\" -DBINDIR=\"$(BINDIR)\" -DLOGFILEBASE=\"$(LOGFILEBASE)\"
WINBIND_PROGS = bin/wbinfo
WINBIND_SPROGS = bin/winbindd
WINBIND_PAM_PROGS = nsswitch/pam_winbind.so
@ -113,14 +118,14 @@ LIB_OBJ = lib/charcnv.o lib/debug.o lib/fault.o \
lib/ms_fnmatch.o lib/select.o lib/error.o lib/messages.o \
lib/md5.o lib/hmacmd5.o lib/iconv.o lib/smbpasswd.o \
nsswitch/wb_client.o nsswitch/wb_common.o \
intl/lang_tdb.o $(TDB_OBJ)
intl/lang_tdb.o $(TDB_OBJ)
READLINE_OBJ = lib/readline.o
UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \
ubiqx/ubi_dLinkList.o ubiqx/ubi_sLinkList.o ubiqx/debugparse.o
PARAM_OBJ = param/loadparm.o param/params.o
PARAM_OBJ = param/loadparm.o param/params.o dynconfig.o
LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
libsmb/clikrb5.o libsmb/clispnego.o libsmb/asn1.o \
@ -476,6 +481,24 @@ MAKEDIR = || exec false; \
-o $@
@BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
# These dependencies are only approximately correct: we want to make
# sure Samba's paths are updated if ./configure is re-run. Really it
# would be nice if "make prefix=/opt/samba all" also rebuilt things,
# but since we also require "make install prefix=/opt/samba" *not* to
# rebuild it's a bit hard.
dynconfig.o: dynconfig.c Makefile
@echo Compiling $*.c
@$(CC) $(FLAGS) $(PATH_FLAGS) -c $< -o $@
dynconfig.po: dynconfig.c Makefile
@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
@echo Compiling $*.c with @PICFLAG@
@$(CC) -I. -I$(srcdir) $(FLAGS) $(PATH_FLAGS) @PICFLAG@ -c $< -o $*.@PICSUFFIX@
@BROKEN_CC@ -mv `echo $@ | sed -e 's%^.*/%%g' -e 's%\.po$$%.o%'` $@
@POBAD_CC@ @mv $*.po.o $@
.c.po:
@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi

View File

@ -28,6 +28,8 @@
#define REGISTER 0
#endif
const char prog_name[] = "smbclient";
struct cli_state *cli;
extern BOOL in_client;
static int port = 0;
@ -2404,7 +2406,6 @@ static int do_message_op(void)
pstring query_host;
BOOL message = False;
extern char tar_type;
static pstring servicesf = CONFIGFILE;
pstring term_code;
pstring new_name_resolve_order;
char *p;
@ -2436,12 +2437,12 @@ static int do_message_op(void)
dbf = x_stderr;
else if(strncmp(argv[opt], "-s", 2) == 0) {
if(argv[opt][2] != '\0')
pstrcpy(servicesf, &argv[opt][2]);
pstrcpy(dyn_CONFIGFILE, &argv[opt][2]);
else if(argv[opt+1] != NULL) {
/*
* At least one more arg left.
*/
pstrcpy(servicesf, argv[opt+1]);
pstrcpy(dyn_CONFIGFILE, argv[opt+1]);
} else {
usage(pname);
exit(1);
@ -2454,8 +2455,9 @@ static int do_message_op(void)
in_client = True; /* Make sure that we tell lp_load we are */
old_debug = DEBUGLEVEL;
if (!lp_load(servicesf,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf);
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "%s: Can't load %s - run testparm to debug it\n",
prog_name, dyn_CONFIGFILE);
}
DEBUGLEVEL = old_debug;
@ -2536,7 +2538,7 @@ static int do_message_op(void)
getopt(argc, argv,"s:O:R:M:i:Nn:d:Pp:l:hI:EU:L:t:m:W:T:D:c:b:A:k")) != EOF) {
switch (opt) {
case 's':
pstrcpy(servicesf, optarg);
pstrcpy(dyn_CONFIGFILE, optarg);
break;
case 'O':
pstrcpy(user_socket_options,optarg);

View File

@ -403,9 +403,9 @@ static void send_fs_socket(char *service, char *mount_point, struct cli_state *c
}
/****************************************************************************
mount smbfs
****************************************************************************/
/**
* Mount a smbfs
**/
static void init_mount(void)
{
char mount_point[MAXPATHLEN+1];
@ -475,13 +475,22 @@ static void init_mount(void)
}
if (sys_fork() == 0) {
if (file_exist(BINDIR "/smbmnt", NULL)) {
execv(BINDIR "/smbmnt", args);
fprintf(stderr,"execv of %s failed. Error was %s.", BINDIR "/smbmnt", strerror(errno));
char *smbmnt_path;
smbmnt_path = asprintf("%s/smbmnt", dyn_BINDIR);
if (file_exist(smbmnt_path, NULL)) {
execv(smbmnt_path, args);
fprintf(stderr,
"smbfs/init_mount: execv of %s failed. Error was %s.",
smbmnt_path, strerror(errno));
} else {
execvp("smbmnt", args);
fprintf(stderr,"execvp of smbmnt failed. Error was %s.", strerror(errno) );
fprintf(stderr,
"smbfs/init_mount: execv of %s failed. Error was %s.",
"smbmnt", strerror(errno));
}
free(smbmnt_path);
exit(1);
}
@ -801,7 +810,7 @@ static void parse_mount_smb(int argc, char **argv)
{
extern char *optarg;
extern int optind;
static pstring servicesf = CONFIGFILE;
static pstring servicesf = dyn_CONFIGFILE;
char *p;
DEBUGLEVEL = 1;

View File

@ -191,9 +191,9 @@ static int smb_print(struct cli_state *, char *, FILE *);
in_client = True; /* Make sure that we tell lp_load we are */
if (!lp_load(CONFIGFILE, True, False, False))
if (!lp_load(dyn_CONFIGFILE, True, False, False))
{
fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", CONFIGFILE);
fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
return (1);
}

1283
source/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@
/**
* @file dynconfig.c
*
* @brief Compile-time configured constants.
* @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,

View File

@ -0,0 +1,31 @@
/*
Unix SMB/Netbios implementation.
Copyright (C) 2001 by Martin Pool <mbp@samba.org>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* @file dynconfig.h
*
* @brief Exported global configurations.
**/
extern char const *dyn_SBINDIR,
*dyn_BINDIR,
*dyn_SWATDIR;
extern pstring dyn_CONFIGFILE;
extern pstring dyn_LOGFILEBASE;

View File

@ -658,6 +658,7 @@ extern int errno;
#include "messages.h"
#include "util_list.h"
#include "charset.h"
#include "dynconfig.h"
#include "util_getent.h"

View File

@ -1,6 +1,5 @@
/*
Unix SMB/Netbios implementation.
Version 1.9.
NBT netbios routines and daemon - version 2
Copyright (C) Andrew Tridgell 1994-1998
@ -28,7 +27,6 @@
#include "includes.h"
extern pstring debugf;
pstring servicesf = CONFIGFILE;
int ClientNMB = -1;
int ClientDGRAM = -1;
@ -276,9 +274,9 @@ static BOOL reload_nmbd_services(BOOL test)
{
pstring fname;
pstrcpy( fname,lp_configfile());
if (file_exist(fname,NULL) && !strcsequal(fname,servicesf))
if (file_exist(fname,NULL) && !strcsequal(fname,dyn_CONFIGFILE))
{
pstrcpy(servicesf,fname);
pstrcpy(dyn_CONFIGFILE,fname);
test = False;
}
}
@ -286,7 +284,7 @@ static BOOL reload_nmbd_services(BOOL test)
if ( test && !lp_file_list_changed() )
return(True);
ret = lp_load( servicesf, True , False, False);
ret = lp_load( dyn_CONFIGFILE, True , False, False);
/* perhaps the config filename is now set */
if ( !test )
@ -679,7 +677,7 @@ static void usage(char *pname)
TimeInit();
slprintf(debugf, sizeof(debugf)-1, "%s/log.nmbd", LOGFILEBASE);
slprintf(debugf, sizeof(debugf)-1, "%s/log.nmbd", dyn_LOGFILEBASE);
setup_logging( argv[0], False );
#ifdef LMHOSTSFILE
@ -720,7 +718,7 @@ static void usage(char *pname)
switch (opt)
{
case 's':
pstrcpy(servicesf,optarg);
pstrcpy(dyn_CONFIGFILE, optarg);
break;
case 'N':
case 'B':

View File

@ -461,7 +461,7 @@ int main(int argc, char **argv)
TimeInit();
if (!lp_load(CONFIGFILE, True, False, False)) {
if (!lp_load(dyn_CONFIGFILE, True, False, False)) {
DEBUG(0, ("error opening config file\n"));
exit(1);
}

View File

@ -23,8 +23,6 @@
#include "winbindd.h"
pstring servicesf = CONFIGFILE;
/* List of all connected clients */
struct winbindd_cli_state *client_list;
@ -40,14 +38,14 @@ static BOOL reload_services_file(BOOL test)
pstring fname;
pstrcpy(fname,lp_configfile());
if (file_exist(fname,NULL) && !strcsequal(fname,servicesf)) {
pstrcpy(servicesf,fname);
if (file_exist(fname,NULL) && !strcsequal(fname,dyn_CONFIGFILE)) {
pstrcpy(dyn_CONFIGFILE,fname);
test = False;
}
}
reopen_logs();
ret = lp_load(servicesf,False,False,True);
ret = lp_load(dyn_CONFIGFILE,False,False,True);
reopen_logs();
load_interfaces();
@ -713,7 +711,7 @@ int main(int argc, char **argv)
/* Load a different smb.conf file */
case 's':
pstrcpy(servicesf,optarg);
pstrcpy(dyn_CONFIGFILE,optarg);
break;
default:
@ -722,7 +720,7 @@ int main(int argc, char **argv)
}
}
snprintf(debugf, sizeof(debugf), "%s/log.winbindd", LOGFILEBASE);
snprintf(debugf, sizeof(debugf), "%s/log.winbindd", dyn_LOGFILEBASE);
setup_logging("winbindd", interactive);
reopen_logs();

View File

@ -75,7 +75,7 @@ struct in_addr *lookup_backend(const char *name, int *count)
DEBUGLEVEL = 0;
TimeInit();
setup_logging("nss_wins",True);
lp_load(CONFIGFILE,True,False,False);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
}

View File

@ -125,7 +125,7 @@ int make_remark( pam_handle_t * pamh, unsigned int ctrl
int set_ctrl( int flags, int argc, const char **argv )
{
int i = 0;
static pstring servicesf = CONFIGFILE;
static pstring servicesf = dyn_CONFIGFILE;
const char *service_file = servicesf;
unsigned int ctrl;

View File

@ -1320,7 +1320,7 @@ NTSTATUS _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u,
return NT_STATUS_ACCESS_DENIED;
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
lp_change_share_cmd(), CONFIGFILE, share_name, ptr, comment);
lp_change_share_cmd(), dyn_CONFIGFILE, share_name, ptr, comment);
DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) {
@ -1436,7 +1436,7 @@ NTSTATUS _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET
string_replace(comment, '"', ' ');
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
lp_add_share_cmd(), CONFIGFILE, share_name, ptr, comment);
lp_add_share_cmd(), dyn_CONFIGFILE, share_name, ptr, comment);
DEBUG(10,("_srv_net_share_add: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) {
@ -1502,7 +1502,7 @@ NTSTATUS _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET
return NT_STATUS_ACCESS_DENIED;
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"",
lp_delete_share_cmd(), CONFIGFILE, lp_servicename(snum));
lp_delete_share_cmd(), dyn_CONFIGFILE, lp_servicename(snum));
DEBUG(10,("_srv_net_share_del: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) {

View File

@ -620,8 +620,7 @@ static void usage(void)
BOOL interactive = True;
int opt;
int olddebug;
pstring cmdstr = "",
servicesf = CONFIGFILE;
pstring cmdstr = "";
struct ntuser_creds creds;
struct cli_state cli;
fstring password,
@ -661,7 +660,7 @@ static void usage(void)
break;
case 's':
pstrcpy(servicesf, optarg);
pstrcpy(dyn_CONFIGFILE, optarg);
break;
case 'U': {
@ -710,8 +709,8 @@ static void usage(void)
/* Load smb.conf file */
/* FIXME! How to get this DEBUGLEVEL to last over lp_load()? */
olddebug = DEBUGLEVEL;
if (!lp_load(servicesf,True,False,False)) {
fprintf(stderr, "Can't load %s\n", servicesf);
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s\n", dyn_CONFIGFILE);
}
DEBUGLEVEL = olddebug;

View File

@ -222,7 +222,7 @@ static struct cli_state *init_connection(struct cli_state *cli,
int main(int argc, char **argv)
{
BOOL do_sam_sync = False, do_sam_repl = False;
pstring servicesf = CONFIGFILE;
pstring servicesf = dyn_CONFIGFILE;
struct cli_state cli;
NTSTATUS result;
int opt;
@ -295,7 +295,7 @@ static struct cli_state *init_connection(struct cli_state *cli,
/* Initialise samba */
slprintf(debugf, sizeof(debugf) - 1, "%s/log.%s", LOGFILEBASE,
slprintf(debugf, sizeof(debugf) - 1, "%s/log.%s", dyn_LOGFILEBASE,
"samsync");
setup_logging("samsync", interactive);

View File

@ -22,6 +22,7 @@
#include "includes.h"
#include "build_env.h"
#include "dynconfig.h"
static void output(BOOL screen, char *format, ...) PRINTF_ATTRIBUTE(2,3);
@ -184,30 +185,22 @@ void build_options(BOOL screen)
/* Output various paths to files and directories */
output(screen,"\nPaths:\n");
#ifdef CONFIGFILE
output(screen," CONFIGFILE: %s\n",CONFIGFILE);
#endif
output(screen," CONFIGFILE: %s\n", dyn_CONFIGFILE);
#ifdef PRIVATE_DIR
output(screen," PRIVATE_DIR: %s\n",PRIVATE_DIR);
#endif
#ifdef LMHOSTSFILE
output(screen," LMHOSTSFILE: %s\n",LMHOSTSFILE);
#endif
#ifdef SBINDIR
output(screen," SBINDIR: %s\n",SBINDIR);
#endif
#ifdef BINDIR
output(screen," BINDIR: %s\n",BINDIR);
#endif
output(screen," SBINDIR: %s\n", dyn_SBINDIR);
output(screen," BINDIR: %s\n", dyn_BINDIR);
#ifdef LOCKDIR
output(screen," LOCKDIR: %s\n",LOCKDIR);
#endif
#ifdef DRIVERFILE
output(screen," DRIVERFILE: %s\n",DRIVERFILE);
#endif
#ifdef LOGFILEBASE
output(screen," LOGFILEBASE: %s\n",LOGFILEBASE);
#endif
output(screen," LOGFILEBASE: %s\n", dyn_LOGFILEBASE);
#ifdef FORMSFILE
output(screen," FORMSFILE: %s\n",FORMSFILE);
#endif

View File

@ -1713,7 +1713,7 @@ static BOOL api_RNetShareAdd(connection_struct *conn,uint16 vuid, char *param,ch
if (!cmdname || *cmdname == '\0') return False;
asprintf(&command, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
lp_add_share_cmd(), CONFIGFILE, sharename, pathname, comment);
lp_add_share_cmd(), dyn_CONFIGFILE, sharename, pathname, comment);
if (command) {
DEBUG(10,("api_RNetShareAdd: Running [%s]\n", command ));

View File

@ -21,7 +21,6 @@
#include "includes.h"
pstring servicesf = CONFIGFILE;
extern pstring debugf;
extern fstring global_myworkgroup;
extern pstring global_myname;
@ -357,8 +356,8 @@ BOOL reload_services(BOOL test)
if (lp_loaded()) {
pstring fname;
pstrcpy(fname,lp_configfile());
if (file_exist(fname,NULL) && !strcsequal(fname,servicesf)) {
pstrcpy(servicesf,fname);
if (file_exist(fname,NULL) && !strcsequal(fname,dyn_CONFIGFILE)) {
pstrcpy(dyn_CONFIGFILE,fname);
test = False;
}
}
@ -370,7 +369,7 @@ BOOL reload_services(BOOL test)
lp_killunused(conn_snum_used);
ret = lp_load(servicesf,False,False,True);
ret = lp_load(dyn_CONFIGFILE,False,False,True);
load_printers();
@ -588,7 +587,7 @@ static void usage(char *pname)
int port = SMB_PORT;
int opt;
extern char *optarg;
#ifdef HAVE_SET_AUTH_PARAMETERS
set_auth_parameters(argc,argv);
#endif
@ -606,7 +605,7 @@ static void usage(char *pname)
break;
case 's':
pstrcpy(servicesf,optarg);
pstrcpy(dyn_CONFIGFILE,optarg);
break;
case 'l':
@ -671,7 +670,8 @@ static void usage(char *pname)
TimeInit();
if(!specified_logfile) {
slprintf(debugf, sizeof(debugf)-1, "%s/log.smbd", LOGFILEBASE);
slprintf(debugf, sizeof(debugf)-1, "%s/log.smbd",
dyn_LOGFILEBASE);
}
pstrcpy(remote_machine, "smbd");

View File

@ -37,7 +37,7 @@ static void smbsh_usage(void)
int main(int argc, char *argv[])
{
char *p, *u;
char *libd = BINDIR;
char *libd = dyn_BINDIR;
pstring line, wd;
int opt;
extern char *optarg;

View File

@ -45,7 +45,6 @@ void smbw_init(void)
{
extern BOOL in_client;
static int initialised;
static pstring servicesf = CONFIGFILE;
char *p;
int eno;
pstring line;
@ -76,10 +75,10 @@ void smbw_init(void)
load_interfaces();
if ((p=smbw_getshared("SERVICESF"))) {
pstrcpy(servicesf, p);
pstrcpy(dyn_CONFIGFILE, p);
}
lp_load(servicesf,True,False,False);
lp_load(dyn_CONFIGFILE,True,False,False);
get_myname(global_myname);

View File

@ -547,7 +547,6 @@ static void usage(void)
int opt;
char *p;
int seed, server;
static pstring servicesf = CONFIGFILE;
setlinebuf(stdout);
@ -570,7 +569,7 @@ static void usage(void)
TimeInit();
lp_load(servicesf,True,False,False);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
if (getenv("USER")) {

View File

@ -535,7 +535,6 @@ static void usage(void)
int opt;
char *p;
int seed;
static pstring servicesf = CONFIGFILE;
setlinebuf(stdout);
@ -561,7 +560,7 @@ static void usage(void)
TimeInit();
lp_load(servicesf,True,False,False);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
if (getenv("USER")) {

View File

@ -422,7 +422,6 @@ static void usage(void)
int opt;
char *p;
int seed;
static pstring servicesf = CONFIGFILE;
setlinebuf(stdout);
@ -444,7 +443,7 @@ static void usage(void)
TimeInit();
lp_load(servicesf,True,False,False);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
if (getenv("USER")) {

View File

@ -40,13 +40,12 @@ void pong_message(int msg_type, pid_t src, void *buf, size_t len)
{
pid_t pid;
int i, n;
static pstring servicesf = CONFIGFILE;
char buf[12];
TimeInit();
setup_logging(argv[0],True);
lp_load(servicesf,False,False,False);
lp_load(dyn_CONFIGFILE,False,False,False);
message_init();

View File

@ -225,7 +225,6 @@ enum client_action
int opt;
extern char *optarg;
extern int optind;
static pstring servicesf = CONFIGFILE;
pstring term_code;
BOOL got_pass = False;
char *cmd_str="";
@ -246,9 +245,9 @@ enum client_action
*term_code = 0;
#endif /* KANJI */
if (!lp_load(servicesf,True, False, False))
if (!lp_load(dyn_CONFIGFILE,True, False, False))
{
fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf);
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
}
DEBUGLEVEL = 0;
@ -469,7 +468,7 @@ enum client_action
case 's':
{
pstrcpy(servicesf, optarg);
pstrcpy(dyn_CONFIGFILE, optarg);
break;
}

View File

@ -3081,7 +3081,6 @@ static void usage(void)
int gotpass = 0;
extern char *optarg;
extern int optind;
static pstring servicesf = CONFIGFILE;
BOOL correct = True;
dbf = x_stdout;
@ -3090,7 +3089,7 @@ static void usage(void)
setbuffer(stdout, NULL, 0);
#endif
lp_load(servicesf,True,False,False);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
if (argc < 2) {

View File

@ -1379,7 +1379,7 @@ int main(int argc,char *argv[])
int argc_new = 0;
const char ** argv_new;
poptContext pc;
static char *servicesf = CONFIGFILE;
static char *servicesf = dyn_CONFIGFILE;
static char *target_workgroup = NULL;
static char *comment = "";
static char *user_name = NULL;

View File

@ -193,7 +193,6 @@ int main(int argc,char *argv[])
extern char *optarg;
BOOL find_master=False;
int i;
static pstring servicesf = CONFIGFILE;
BOOL lookup_by_ip = False;
int commandline_debuglevel = -2;
@ -240,7 +239,7 @@ int main(int argc,char *argv[])
commandline_debuglevel = DEBUGLEVEL = atoi(optarg);
break;
case 's':
pstrcpy(servicesf, optarg);
pstrcpy(dyn_CONFIGFILE, optarg);
break;
case 'r':
RootPort = True;
@ -262,8 +261,8 @@ int main(int argc,char *argv[])
exit(1);
}
if (!lp_load(servicesf,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf);
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
}
/*

View File

@ -536,7 +536,6 @@ account without a valid local system user.\n", user_name);
int main (int argc, char **argv)
{
int ch;
static pstring servicesf = CONFIGFILE;
BOOL list_users = False;
BOOL verbose = False;
BOOL spstyle = False;
@ -567,9 +566,9 @@ int main (int argc, char **argv)
exit(1);
}
if (!lp_load(servicesf,True,False,False)) {
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
servicesf);
dyn_CONFIGFILE);
exit(1);
}

View File

@ -802,7 +802,6 @@ You can string acls together with spaces, commas or newlines\n\
extern int optind;
int opt;
char *p;
static pstring servicesf = CONFIGFILE;
struct cli_state *cli=NULL;
enum acl_mode mode = SMB_ACL_SET;
char *the_acl = NULL;
@ -832,7 +831,7 @@ You can string acls together with spaces, commas or newlines\n\
TimeInit();
lp_load(servicesf,True,False,False);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
if (getenv("USER")) {

View File

@ -374,7 +374,6 @@ static BOOL do_command(char *dest, char *msg_name, char **params)
int opt;
char temp[255];
extern int optind;
pstring servicesf = CONFIGFILE;
BOOL interactive = False;
TimeInit();
@ -388,7 +387,7 @@ static BOOL do_command(char *dest, char *msg_name, char **params)
interactive = True;
break;
case 's':
pstrcpy(servicesf, optarg);
pstrcpy(dyn_CONFIGFILE, optarg);
break;
default:
printf("Unknown option %c (%d)\n", (char)opt, opt);
@ -396,7 +395,7 @@ static BOOL do_command(char *dest, char *msg_name, char **params)
}
}
lp_load(servicesf,False,False,False);
lp_load(dyn_CONFIGFILE,False,False,False);
if (!message_init()) exit(1);

View File

@ -228,7 +228,7 @@ int main(int argc, char *argv[])
setup_logging(argv[0],True);
pstrcpy(configfile,CONFIGFILE);
pstrcpy(configfile,dyn_CONFIGFILE);
if (argc < 2) {
fprintf(stderr,"smbfilter <desthost> <netbiosname>\n");

View File

@ -200,7 +200,7 @@ int listgroup(enum SID_NAME_USE sid_type)
int main (int argc, char **argv)
{
int ch;
static pstring servicesf = CONFIGFILE;
static pstring servicesf = dyn_CONFIGFILE;
BOOL add_group = False;
BOOL view_group = False;
BOOL change_group = False;

View File

@ -898,8 +898,6 @@ static int process_nonroot(int argc, char *argv[])
**********************************************************/
int main(int argc, char **argv)
{
static pstring servicesf = CONFIGFILE;
#if defined(HAVE_SET_AUTH_PARAMETERS)
set_auth_parameters(argc, argv);
#endif /* HAVE_SET_AUTH_PARAMETERS */
@ -913,9 +911,9 @@ int main(int argc, char **argv)
exit(1);
}
if (!lp_load(servicesf,True,False,False)) {
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
servicesf);
dyn_CONFIGFILE);
exit(1);
}

View File

@ -327,7 +327,6 @@ static BOOL print_tree(struct user_auth_info *user_info)
extern int optind;
int opt;
char *p;
pstring servicesf = CONFIGFILE;
struct user_auth_info user_info;
BOOL got_pass = False;
@ -341,7 +340,7 @@ static BOOL print_tree(struct user_auth_info *user_info)
TimeInit();
lp_load(servicesf,True,False,False);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
if (getenv("USER")) {

View File

@ -33,7 +33,7 @@ int main(int argc, char *argv[])
extern int optind;
char *path;
lp_load(CONFIGFILE,1,0,0);
lp_load(dyn_CONFIGFILE,1,0,0);
smbw_setup_shared();
while ((opt = getopt(argc, argv, "W:U:R:d:P:l:hL:")) != EOF) {

View File

@ -544,7 +544,6 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
{
pstring fname;
int c;
static pstring servicesf = CONFIGFILE;
extern char *optarg;
int profile_only = 0, new_debuglevel = -1;
TDB_CONTEXT *tdb;
@ -588,7 +587,7 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
shares_only = 1;
break;
case 's':
pstrcpy(servicesf, optarg);
pstrcpy(dyn_CONFIGFILE, optarg);
break;
case 'u':
Ucrit_addUsername(optarg);
@ -599,8 +598,8 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
}
}
if (!lp_load(servicesf,False,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf);
if (!lp_load(dyn_CONFIGFILE,False,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
return (-1);
}
@ -609,7 +608,7 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
}
if (verbose) {
d_printf("using configfile = %s\n", servicesf);
d_printf("using configfile = %s\n", dyn_CONFIGFILE);
}
if (profile_only) {

View File

@ -218,7 +218,7 @@ int main(int argc, char *argv[])
argc += (1 - optind);
if ((argc == 1) || (argc == 3))
pstrcpy(configfile,CONFIGFILE);
pstrcpy(configfile, dyn_CONFIGFILE);
else if ((argc == 2) || (argc == 4))
pstrcpy(configfile,argv[optind]);

View File

@ -21,11 +21,12 @@
#include "includes.h"
#include "smb.h"
#include "dynconfig.h"
/* need to wait for daemons to startup */
/** Need to wait for daemons to startup */
#define SLEEP_TIME 3
/* startup smbd */
/** Startup smbd from web interface. */
void start_smbd(void)
{
pstring binfile;
@ -37,7 +38,7 @@ void start_smbd(void)
return;
}
slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", SBINDIR);
slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", dyn_SBINDIR);
become_daemon();
@ -58,7 +59,7 @@ void start_nmbd(void)
return;
}
slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", SBINDIR);
slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", dyn_SBINDIR);
become_daemon();

View File

@ -1,6 +1,5 @@
/*
Unix SMB/Netbios implementation.
Version 1.9.
Samba Web Administration Tool
Copyright (C) Andrew Tridgell 1997-1998
@ -19,11 +18,18 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* @group swat SWAT
* @{
* @file swat.c
*
* @brief Samba Web Administration Tool.
**/
#include "includes.h"
#define GLOBALS_SNUM -1
static pstring servicesf = CONFIGFILE;
static BOOL demo_mode = False;
static BOOL have_write_access = False;
static BOOL have_read_access = False;
@ -370,7 +376,7 @@ static void show_parameters(int snum, int allparameters, int advanced, int print
static BOOL load_config(BOOL save_def)
{
lp_resetnumservices();
return lp_load(servicesf,False,save_def,False);
return lp_load(dyn_CONFIGFILE,False,save_def,False);
}
/****************************************************************************
@ -393,9 +399,9 @@ static int save_reload(int snum)
FILE *f;
struct stat st;
f = sys_fopen(servicesf,"w");
f = sys_fopen(dyn_CONFIGFILE,"w");
if (!f) {
d_printf("failed to open %s for writing\n", servicesf);
d_printf("failed to open %s for writing\n", dyn_CONFIGFILE);
return 0;
}
@ -413,7 +419,7 @@ static int save_reload(int snum)
lp_killunused(NULL);
if (!load_config(False)) {
d_printf("Can't reload %s\n", servicesf);
d_printf("Can't reload %s\n", dyn_CONFIGFILE);
return 0;
}
iNumNonAutoPrintServices = lp_numservices();
@ -1017,9 +1023,10 @@ static void printers_page(void)
d_printf("</FORM>\n");
}
/****************************************************************************
MAIN()
****************************************************************************/
/**
* main function for SWAT.
**/
int main(int argc, char *argv[])
{
extern char *optarg;
@ -1052,7 +1059,7 @@ static void printers_page(void)
while ((opt = getopt(argc, argv,"s:a")) != EOF) {
switch (opt) {
case 's':
pstrcpy(servicesf,optarg);
pstrcpy(dyn_CONFIGFILE,optarg);
break;
case 'a':
demo_mode = True;
@ -1065,23 +1072,23 @@ static void printers_page(void)
iNumNonAutoPrintServices = lp_numservices();
load_printers();
cgi_setup(SWATDIR, !demo_mode);
cgi_setup(dyn_SWATDIR, !demo_mode);
print_header();
cgi_load_variables();
if (!file_exist(servicesf, NULL)) {
if (!file_exist(dyn_CONFIGFILE, NULL)) {
have_read_access = True;
have_write_access = True;
} else {
/* check if the authenticated user has write access - if not then
don't show write options */
have_write_access = (access(servicesf,W_OK) == 0);
have_write_access = (access(dyn_CONFIGFILE,W_OK) == 0);
/* if the user doesn't have read access to smb.conf then
don't let them view it */
have_read_access = (access(servicesf,R_OK) == 0);
have_read_access = (access(dyn_CONFIGFILE,R_OK) == 0);
}
show_main_buttons();
@ -1108,3 +1115,5 @@ static void printers_page(void)
print_footer();
return 0;
}
/** @} **/