summaryrefslogtreecommitdiff
path: root/source3/web
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2001-11-19 02:49:53 +0000
committerMartin Pool <mbp@samba.org>2001-11-19 02:49:53 +0000
commitf741f656737f4ec46cd318e986b6bf412ed309d2 (patch)
treefb2b1999441e25ae5db177631dd42abb051a9bce /source3/web
parenta1b9de0b9872b91574e75bb360d49b887a072389 (diff)
downloadsamba-f741f656737f4ec46cd318e986b6bf412ed309d2.tar.gz
samba-f741f656737f4ec46cd318e986b6bf412ed309d2.tar.bz2
samba-f741f656737f4ec46cd318e986b6bf412ed309d2.zip
Store some path names in global variables initialized to configure
default, rather than in preprocessor macros. (This used to be commit 79ec88f0da40faebe1e587f1b3e87b5f2b184f58)
Diffstat (limited to 'source3/web')
-rw-r--r--source3/web/startstop.c9
-rw-r--r--source3/web/swat.c37
2 files changed, 28 insertions, 18 deletions
diff --git a/source3/web/startstop.c b/source3/web/startstop.c
index 9eeac96cc0..80b5ce7444 100644
--- a/source3/web/startstop.c
+++ b/source3/web/startstop.c
@@ -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();
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 3deaafbc76..506a6263e9 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -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;
}
+
+/** @} **/