summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/param/loadparm.c6
-rw-r--r--source3/utils/testparm.c2
-rw-r--r--source3/web/statuspage.c33
-rw-r--r--source3/web/swat.c35
5 files changed, 68 insertions, 10 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 03fc3d6317..dfd9ca8be8 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1031,7 +1031,7 @@ BOOL lp_loaded(void);
void lp_killunused(BOOL (*snumused)(int ));
BOOL lp_load(char *pszFname,BOOL global_only, BOOL save_defaults, BOOL add_ipc);
int lp_numservices(void);
-void lp_dump(FILE *f);
+void lp_dump(FILE *f, BOOL show_defaults);
int lp_servicenumber(char *pszServiceName);
char *volume_label(int snum);
void lp_rename_service(int snum, char *new_name);
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 1d65030869..c67bdd3cf8 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -2303,10 +2303,14 @@ int lp_numservices(void)
/***************************************************************************
Display the contents of the services array in human-readable form.
***************************************************************************/
-void lp_dump(FILE *f)
+void lp_dump(FILE *f, BOOL show_defaults)
{
int iService;
+ if (!show_defaults) {
+ defaults_saved = False;
+ }
+
dump_globals(f);
dump_a_service(&sDefault, f);
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 0cc76066bb..83d4d7fbb5 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -89,7 +89,7 @@ extern pstring myhostname;
printf("Press enter to see a dump of your service definitions\n");
fflush(stdout);
getc(stdin);
- lp_dump(stdout);
+ lp_dump(stdout,False);
}
if (argc == 4)
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c
index 3ba46ff14f..41681c2228 100644
--- a/source3/web/statuspage.c
+++ b/source3/web/statuspage.c
@@ -75,6 +75,9 @@ void status_page(void)
struct connect_record crec;
pstring fname;
FILE *f;
+ char *v;
+ int autorefresh=0;
+ int refresh_interval=30;
if (cgi_variable("smbd_start")) {
start_smbd();
@@ -92,6 +95,23 @@ void status_page(void)
stop_nmbd();
}
+ if (cgi_variable("autorefresh")) {
+ autorefresh = 1;
+ } else if (cgi_variable("norefresh")) {
+ autorefresh = 0;
+ } else if (cgi_variable("refresh")) {
+ autorefresh = 1;
+ }
+
+ if ((v=cgi_variable("refresh_interval"))) {
+ refresh_interval = atoi(v);
+ }
+
+ if (autorefresh) {
+ printf("<META HTTP-EQUIV=refresh CONTENT=\"%d;URL=%s/status?refresh=1&refresh_interval=%d\">\n",
+ refresh_interval, cgi_baseurl(), refresh_interval);
+ }
+
pstrcpy(fname,lp_lockdir());
standard_sub_basic(fname);
trim_string(fname,"","/");
@@ -118,6 +138,19 @@ void status_page(void)
printf("<FORM method=post>\n");
+ if (!autorefresh) {
+ printf("<input type=submit value=\"Auto Refresh\" name=autorefresh>\n");
+ printf("<br>Refresh Interval: ");
+ printf("<input type=text size=2 name=\"refresh_interval\" value=%d>\n",
+ refresh_interval);
+ } else {
+ printf("<input type=submit value=\"Stop Refreshing\" name=norefresh>\n");
+ printf("<br>Refresh Interval: %d\n", refresh_interval);
+ printf("<input type=hidden name=refresh value=1>\n");
+ }
+
+ printf("<p>\n");
+
f = fopen(fname,"r");
if (!f) {
printf("Couldn't open status file %s\n",fname);
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 1a12d99ffd..a41249a9ee 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -168,6 +168,16 @@ static void show_parameters(int snum, int allparameters, int advanced, int print
}
+/* write a config file */
+static void write_config(FILE *f, BOOL show_defaults)
+{
+ fprintf(f, "# Samba config file created using SWAT\n");
+ fprintf(f, "# Date: %s\n\n", timestring());
+
+ lp_dump(f, show_defaults);
+}
+
+
/* save and reoad the smb.conf config file */
static int save_reload(void)
{
@@ -179,11 +189,7 @@ static int save_reload(void)
return 0;
}
- fprintf(f, "# Samba config file created using SWAT\n");
- fprintf(f, "# Date: %s\n\n", timestring());
-
- lp_dump(f);
-
+ write_config(f, False);
fclose(f);
lp_killunused(NULL);
@@ -282,10 +288,25 @@ static void welcome_page(void)
/* display the current smb.conf */
static void viewconfig_page(void)
{
+ int full_view=0;
+
+ if (cgi_variable("full_view")) {
+ full_view = 1;
+ }
+
printf("<H2>Current Config</H2>\n");
- printf("<pre>");
- include_html(servicesf);
+ printf("<form method=post>\n");
+
+ if (full_view) {
+ printf("<input type=submit name=\"normal_view\" value=\"Normal View\">\n");
+ } else {
+ printf("<input type=submit name=\"full_view\" value=\"Full View\">\n");
+ }
+
+ printf("<p><pre>");
+ write_config(stdout, !full_view);
printf("</pre>");
+ printf("</form>\n");
}