1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +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
-
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 # 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 # /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@ BASEDIR= @prefix@
BINDIR = @bindir@ BINDIR = @bindir@
# sbindir is mapped to bindir when compiling SAMBA in 2.0.x compatibility mode. # sbindir is mapped to bindir when compiling SAMBA in 2.0.x compatibility mode.
@ -67,14 +70,16 @@ LOCKDIR = @lockdir@
man_langs = "@manlangs@" man_langs = "@manlangs@"
PASSWD_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATE_DIR)\" 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)\" FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DLOCKDIR=\"$(LOCKDIR)\"
FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DBINDIR=\"$(BINDIR)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\" -DLIBDIR=\"$(LIBDIR)\" FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\" -DLIBDIR=\"$(LIBDIR)\"
FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H
FLAGS = $(ISA) $(FLAGS5) $(PASSWD_FLAGS) FLAGS = $(ISA) $(FLAGS5) $(PASSWD_FLAGS)
FLAGS32 = $(ISA32) $(FLAGS5) $(PASSWD_FLAGS) FLAGS32 = $(ISA32) $(FLAGS5) $(PASSWD_FLAGS)
PATH_FLAGS = -DSBINDIR=\"$(SBINDIR)\" -DBINDIR=\"$(BINDIR)\" -DLOGFILEBASE=\"$(LOGFILEBASE)\"
WINBIND_PROGS = bin/wbinfo WINBIND_PROGS = bin/wbinfo
WINBIND_SPROGS = bin/winbindd WINBIND_SPROGS = bin/winbindd
WINBIND_PAM_PROGS = nsswitch/pam_winbind.so 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/ms_fnmatch.o lib/select.o lib/error.o lib/messages.o \
lib/md5.o lib/hmacmd5.o lib/iconv.o lib/smbpasswd.o \ lib/md5.o lib/hmacmd5.o lib/iconv.o lib/smbpasswd.o \
nsswitch/wb_client.o nsswitch/wb_common.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 READLINE_OBJ = lib/readline.o
UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.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 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_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \
libsmb/clikrb5.o libsmb/clispnego.o libsmb/asn1.o \ libsmb/clikrb5.o libsmb/clispnego.o libsmb/asn1.o \
@ -476,6 +481,24 @@ MAKEDIR = || exec false; \
-o $@ -o $@
@BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@ @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: .c.po:
@if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \ @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi

View File

@ -28,6 +28,8 @@
#define REGISTER 0 #define REGISTER 0
#endif #endif
const char prog_name[] = "smbclient";
struct cli_state *cli; struct cli_state *cli;
extern BOOL in_client; extern BOOL in_client;
static int port = 0; static int port = 0;
@ -2404,7 +2406,6 @@ static int do_message_op(void)
pstring query_host; pstring query_host;
BOOL message = False; BOOL message = False;
extern char tar_type; extern char tar_type;
static pstring servicesf = CONFIGFILE;
pstring term_code; pstring term_code;
pstring new_name_resolve_order; pstring new_name_resolve_order;
char *p; char *p;
@ -2436,12 +2437,12 @@ static int do_message_op(void)
dbf = x_stderr; dbf = x_stderr;
else if(strncmp(argv[opt], "-s", 2) == 0) { else if(strncmp(argv[opt], "-s", 2) == 0) {
if(argv[opt][2] != '\0') if(argv[opt][2] != '\0')
pstrcpy(servicesf, &argv[opt][2]); pstrcpy(dyn_CONFIGFILE, &argv[opt][2]);
else if(argv[opt+1] != NULL) { else if(argv[opt+1] != NULL) {
/* /*
* At least one more arg left. * At least one more arg left.
*/ */
pstrcpy(servicesf, argv[opt+1]); pstrcpy(dyn_CONFIGFILE, argv[opt+1]);
} else { } else {
usage(pname); usage(pname);
exit(1); exit(1);
@ -2454,8 +2455,9 @@ static int do_message_op(void)
in_client = True; /* Make sure that we tell lp_load we are */ in_client = True; /* Make sure that we tell lp_load we are */
old_debug = DEBUGLEVEL; old_debug = DEBUGLEVEL;
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, "%s: Can't load %s - run testparm to debug it\n",
prog_name, dyn_CONFIGFILE);
} }
DEBUGLEVEL = old_debug; 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) { 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) { switch (opt) {
case 's': case 's':
pstrcpy(servicesf, optarg); pstrcpy(dyn_CONFIGFILE, optarg);
break; break;
case 'O': case 'O':
pstrcpy(user_socket_options,optarg); 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) static void init_mount(void)
{ {
char mount_point[MAXPATHLEN+1]; char mount_point[MAXPATHLEN+1];
@ -475,13 +475,22 @@ static void init_mount(void)
} }
if (sys_fork() == 0) { if (sys_fork() == 0) {
if (file_exist(BINDIR "/smbmnt", NULL)) { char *smbmnt_path;
execv(BINDIR "/smbmnt", args);
fprintf(stderr,"execv of %s failed. Error was %s.", BINDIR "/smbmnt", strerror(errno)); 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 { } else {
execvp("smbmnt", args); 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); exit(1);
} }
@ -801,7 +810,7 @@ static void parse_mount_smb(int argc, char **argv)
{ {
extern char *optarg; extern char *optarg;
extern int optind; extern int optind;
static pstring servicesf = CONFIGFILE; static pstring servicesf = dyn_CONFIGFILE;
char *p; char *p;
DEBUGLEVEL = 1; 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 */ 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); 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 * @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 * This file should be the only file that depends on path
* configuration (--prefix, etc), so that if ./configure is re-run, * 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 "messages.h"
#include "util_list.h" #include "util_list.h"
#include "charset.h" #include "charset.h"
#include "dynconfig.h"
#include "util_getent.h" #include "util_getent.h"

View File

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

View File

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

View File

@ -23,8 +23,6 @@
#include "winbindd.h" #include "winbindd.h"
pstring servicesf = CONFIGFILE;
/* List of all connected clients */ /* List of all connected clients */
struct winbindd_cli_state *client_list; struct winbindd_cli_state *client_list;
@ -40,14 +38,14 @@ static BOOL reload_services_file(BOOL test)
pstring fname; pstring fname;
pstrcpy(fname,lp_configfile()); 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; test = False;
} }
} }
reopen_logs(); reopen_logs();
ret = lp_load(servicesf,False,False,True); ret = lp_load(dyn_CONFIGFILE,False,False,True);
reopen_logs(); reopen_logs();
load_interfaces(); load_interfaces();
@ -713,7 +711,7 @@ int main(int argc, char **argv)
/* Load a different smb.conf file */ /* Load a different smb.conf file */
case 's': case 's':
pstrcpy(servicesf,optarg); pstrcpy(dyn_CONFIGFILE,optarg);
break; break;
default: 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); setup_logging("winbindd", interactive);
reopen_logs(); reopen_logs();

View File

@ -75,7 +75,7 @@ struct in_addr *lookup_backend(const char *name, int *count)
DEBUGLEVEL = 0; DEBUGLEVEL = 0;
TimeInit(); TimeInit();
setup_logging("nss_wins",True); setup_logging("nss_wins",True);
lp_load(CONFIGFILE,True,False,False); lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces(); 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 set_ctrl( int flags, int argc, const char **argv )
{ {
int i = 0; int i = 0;
static pstring servicesf = CONFIGFILE; static pstring servicesf = dyn_CONFIGFILE;
const char *service_file = servicesf; const char *service_file = servicesf;
unsigned int ctrl; 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; return NT_STATUS_ACCESS_DENIED;
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"", 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 )); DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) { 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, '"', ' '); string_replace(comment, '"', ' ');
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"", 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 )); DEBUG(10,("_srv_net_share_add: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) { 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; return NT_STATUS_ACCESS_DENIED;
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"", 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 )); DEBUG(10,("_srv_net_share_del: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) { if ((ret = smbrun(command, NULL)) != 0) {

View File

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

View File

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

View File

@ -22,6 +22,7 @@
#include "includes.h" #include "includes.h"
#include "build_env.h" #include "build_env.h"
#include "dynconfig.h"
static void output(BOOL screen, char *format, ...) PRINTF_ATTRIBUTE(2,3); 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 various paths to files and directories */
output(screen,"\nPaths:\n"); output(screen,"\nPaths:\n");
#ifdef CONFIGFILE output(screen," CONFIGFILE: %s\n", dyn_CONFIGFILE);
output(screen," CONFIGFILE: %s\n",CONFIGFILE);
#endif
#ifdef PRIVATE_DIR #ifdef PRIVATE_DIR
output(screen," PRIVATE_DIR: %s\n",PRIVATE_DIR); output(screen," PRIVATE_DIR: %s\n",PRIVATE_DIR);
#endif #endif
#ifdef LMHOSTSFILE #ifdef LMHOSTSFILE
output(screen," LMHOSTSFILE: %s\n",LMHOSTSFILE); output(screen," LMHOSTSFILE: %s\n",LMHOSTSFILE);
#endif #endif
#ifdef SBINDIR output(screen," SBINDIR: %s\n", dyn_SBINDIR);
output(screen," SBINDIR: %s\n",SBINDIR); output(screen," BINDIR: %s\n", dyn_BINDIR);
#endif
#ifdef BINDIR
output(screen," BINDIR: %s\n",BINDIR);
#endif
#ifdef LOCKDIR #ifdef LOCKDIR
output(screen," LOCKDIR: %s\n",LOCKDIR); output(screen," LOCKDIR: %s\n",LOCKDIR);
#endif #endif
#ifdef DRIVERFILE #ifdef DRIVERFILE
output(screen," DRIVERFILE: %s\n",DRIVERFILE); output(screen," DRIVERFILE: %s\n",DRIVERFILE);
#endif #endif
#ifdef LOGFILEBASE output(screen," LOGFILEBASE: %s\n", dyn_LOGFILEBASE);
output(screen," LOGFILEBASE: %s\n",LOGFILEBASE);
#endif
#ifdef FORMSFILE #ifdef FORMSFILE
output(screen," FORMSFILE: %s\n",FORMSFILE); output(screen," FORMSFILE: %s\n",FORMSFILE);
#endif #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; if (!cmdname || *cmdname == '\0') return False;
asprintf(&command, "%s \"%s\" \"%s\" \"%s\" \"%s\"", 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) { if (command) {
DEBUG(10,("api_RNetShareAdd: Running [%s]\n", command )); DEBUG(10,("api_RNetShareAdd: Running [%s]\n", command ));

View File

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

View File

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

View File

@ -45,7 +45,6 @@ void smbw_init(void)
{ {
extern BOOL in_client; extern BOOL in_client;
static int initialised; static int initialised;
static pstring servicesf = CONFIGFILE;
char *p; char *p;
int eno; int eno;
pstring line; pstring line;
@ -76,10 +75,10 @@ void smbw_init(void)
load_interfaces(); load_interfaces();
if ((p=smbw_getshared("SERVICESF"))) { 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); get_myname(global_myname);

View File

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

View File

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

View File

@ -422,7 +422,6 @@ static void usage(void)
int opt; int opt;
char *p; char *p;
int seed; int seed;
static pstring servicesf = CONFIGFILE;
setlinebuf(stdout); setlinebuf(stdout);
@ -444,7 +443,7 @@ static void usage(void)
TimeInit(); TimeInit();
lp_load(servicesf,True,False,False); lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces(); load_interfaces();
if (getenv("USER")) { 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; pid_t pid;
int i, n; int i, n;
static pstring servicesf = CONFIGFILE;
char buf[12]; char buf[12];
TimeInit(); TimeInit();
setup_logging(argv[0],True); setup_logging(argv[0],True);
lp_load(servicesf,False,False,False); lp_load(dyn_CONFIGFILE,False,False,False);
message_init(); message_init();

View File

@ -225,7 +225,6 @@ enum client_action
int opt; int opt;
extern char *optarg; extern char *optarg;
extern int optind; extern int optind;
static pstring servicesf = CONFIGFILE;
pstring term_code; pstring term_code;
BOOL got_pass = False; BOOL got_pass = False;
char *cmd_str=""; char *cmd_str="";
@ -246,9 +245,9 @@ enum client_action
*term_code = 0; *term_code = 0;
#endif /* KANJI */ #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; DEBUGLEVEL = 0;
@ -469,7 +468,7 @@ enum client_action
case 's': case 's':
{ {
pstrcpy(servicesf, optarg); pstrcpy(dyn_CONFIGFILE, optarg);
break; break;
} }

View File

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

View File

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

View File

@ -193,7 +193,6 @@ int main(int argc,char *argv[])
extern char *optarg; extern char *optarg;
BOOL find_master=False; BOOL find_master=False;
int i; int i;
static pstring servicesf = CONFIGFILE;
BOOL lookup_by_ip = False; BOOL lookup_by_ip = False;
int commandline_debuglevel = -2; int commandline_debuglevel = -2;
@ -240,7 +239,7 @@ int main(int argc,char *argv[])
commandline_debuglevel = DEBUGLEVEL = atoi(optarg); commandline_debuglevel = DEBUGLEVEL = atoi(optarg);
break; break;
case 's': case 's':
pstrcpy(servicesf, optarg); pstrcpy(dyn_CONFIGFILE, optarg);
break; break;
case 'r': case 'r':
RootPort = True; RootPort = True;
@ -262,8 +261,8 @@ int main(int argc,char *argv[])
exit(1); 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); 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 main (int argc, char **argv)
{ {
int ch; int ch;
static pstring servicesf = CONFIGFILE;
BOOL list_users = False; BOOL list_users = False;
BOOL verbose = False; BOOL verbose = False;
BOOL spstyle = False; BOOL spstyle = False;
@ -567,9 +566,9 @@ int main (int argc, char **argv)
exit(1); 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", fprintf(stderr, "Can't load %s - run testparm to debug it\n",
servicesf); dyn_CONFIGFILE);
exit(1); exit(1);
} }

View File

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

View File

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

View File

@ -228,7 +228,7 @@ int main(int argc, char *argv[])
setup_logging(argv[0],True); setup_logging(argv[0],True);
pstrcpy(configfile,CONFIGFILE); pstrcpy(configfile,dyn_CONFIGFILE);
if (argc < 2) { if (argc < 2) {
fprintf(stderr,"smbfilter <desthost> <netbiosname>\n"); 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 main (int argc, char **argv)
{ {
int ch; int ch;
static pstring servicesf = CONFIGFILE; static pstring servicesf = dyn_CONFIGFILE;
BOOL add_group = False; BOOL add_group = False;
BOOL view_group = False; BOOL view_group = False;
BOOL change_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) int main(int argc, char **argv)
{ {
static pstring servicesf = CONFIGFILE;
#if defined(HAVE_SET_AUTH_PARAMETERS) #if defined(HAVE_SET_AUTH_PARAMETERS)
set_auth_parameters(argc, argv); set_auth_parameters(argc, argv);
#endif /* HAVE_SET_AUTH_PARAMETERS */ #endif /* HAVE_SET_AUTH_PARAMETERS */
@ -913,9 +911,9 @@ int main(int argc, char **argv)
exit(1); 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", fprintf(stderr, "Can't load %s - run testparm to debug it\n",
servicesf); dyn_CONFIGFILE);
exit(1); exit(1);
} }

View File

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

View File

@ -33,7 +33,7 @@ int main(int argc, char *argv[])
extern int optind; extern int optind;
char *path; char *path;
lp_load(CONFIGFILE,1,0,0); lp_load(dyn_CONFIGFILE,1,0,0);
smbw_setup_shared(); smbw_setup_shared();
while ((opt = getopt(argc, argv, "W:U:R:d:P:l:hL:")) != EOF) { 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; pstring fname;
int c; int c;
static pstring servicesf = CONFIGFILE;
extern char *optarg; extern char *optarg;
int profile_only = 0, new_debuglevel = -1; int profile_only = 0, new_debuglevel = -1;
TDB_CONTEXT *tdb; TDB_CONTEXT *tdb;
@ -588,7 +587,7 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
shares_only = 1; shares_only = 1;
break; break;
case 's': case 's':
pstrcpy(servicesf, optarg); pstrcpy(dyn_CONFIGFILE, optarg);
break; break;
case 'u': case 'u':
Ucrit_addUsername(optarg); 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)) { if (!lp_load(dyn_CONFIGFILE,False,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);
return (-1); return (-1);
} }
@ -609,7 +608,7 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
} }
if (verbose) { if (verbose) {
d_printf("using configfile = %s\n", servicesf); d_printf("using configfile = %s\n", dyn_CONFIGFILE);
} }
if (profile_only) { if (profile_only) {

View File

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

View File

@ -21,11 +21,12 @@
#include "includes.h" #include "includes.h"
#include "smb.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 #define SLEEP_TIME 3
/* startup smbd */ /** Startup smbd from web interface. */
void start_smbd(void) void start_smbd(void)
{ {
pstring binfile; pstring binfile;
@ -37,7 +38,7 @@ void start_smbd(void)
return; return;
} }
slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", SBINDIR); slprintf(binfile, sizeof(pstring) - 1, "%s/smbd", dyn_SBINDIR);
become_daemon(); become_daemon();
@ -58,7 +59,7 @@ void start_nmbd(void)
return; return;
} }
slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", SBINDIR); slprintf(binfile, sizeof(pstring) - 1, "%s/nmbd", dyn_SBINDIR);
become_daemon(); become_daemon();

View File

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