summaryrefslogtreecommitdiff
path: root/source3/web/swat.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-03-14 12:57:58 +0000
committerAndrew Tridgell <tridge@samba.org>1998-03-14 12:57:58 +0000
commitc063e9ec3e90508e846dd51e22a643c74c02f7c1 (patch)
treeacc4717e33dfdf1a6492e00b5737da1a3a708be0 /source3/web/swat.c
parente2b50d04ad5eb5fa7c10b59cf5ba0cfe374ab240 (diff)
downloadsamba-c063e9ec3e90508e846dd51e22a643c74c02f7c1.tar.gz
samba-c063e9ec3e90508e846dd51e22a643c74c02f7c1.tar.bz2
samba-c063e9ec3e90508e846dd51e22a643c74c02f7c1.zip
added the ability to start/stop the server from SWAT.
I needed to modify the way the pidfile is handled in nmbd and smbd to do this. Jeremy, you may wish to look at what I've done as it probably breaks the Whistle use of pidfiles. In particular I've removed the -f option and instead smbd and nmbd always create a pidfile in the lock directory. (This used to be commit 20bb22d61b986d2036c681fc33db60f2b2b3c1c7)
Diffstat (limited to 'source3/web/swat.c')
-rw-r--r--source3/web/swat.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 650740428f..422259a05a 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -1,7 +1,7 @@
/*
Unix SMB/Netbios implementation.
Version 1.9.
- html smb.conf editing - prototype only
+ Samba Web Administration Tool
Copyright (C) Andrew Tridgell 1997-1998
This program is free software; you can redistribute it and/or modify
@@ -537,8 +537,26 @@ static void status_page(void)
pstring fname;
FILE *f;
+ if (cgi_variable("smbd_start")) {
+ start_smbd();
+ }
+
+ if (cgi_variable("smbd_stop")) {
+ stop_smbd();
+ }
+
+ if (cgi_variable("nmbd_start")) {
+ start_nmbd();
+ }
+
+ if (cgi_variable("nmbd_stop")) {
+ stop_nmbd();
+ }
+
printf("<H2>Server Status</H2>\n");
+ printf("<FORM method=post>\n");
+
pstrcpy(fname,lp_lockdir());
standard_sub_basic(fname);
trim_string(fname,"","/");
@@ -553,9 +571,32 @@ static void status_page(void)
}
- printf("\nSamba version %s\n<p>",VERSION);
+ printf("<table>\n");
+
+ printf("<tr><td>version:</td><td>%s</td></tr>",VERSION);
+
+ fflush(stdout);
+ if (smbd_running()) {
+ printf("<tr><td>smbd:</td><td>running</td><td><input type=submit name=\"smbd_stop\" value=\"Stop smbd\"></td></tr>\n");
+ } else {
+ printf("<tr><td>smbd:</td><td>not running</td><td><input type=submit name=\"smbd_start\" value=\"Start smbd\"></td></tr>\n");
+ }
+
+ fflush(stdout);
+ if (nmbd_running()) {
+ printf("<tr><td>nmbd:</td><td>running</td><td><input type=submit name=\"nmbd_stop\" value=\"Stop nmbd\"></td></tr>\n");
+ } else {
+ printf("<tr><td>nmbd:</td><td>not running</td><td><input type=submit name=\"nmbd_start\" value=\"Start nmbd\"></td></tr>\n");
+ }
+
+ printf("</table>\n");
+ fflush(stdout);
+
- printf("<h3>Active Connections</h3>\n");
+ if (geteuid() != 0)
+ printf("<b>NOTE: You are not logged in as root and won't be able to start/stop the server</b><p>\n");
+
+ printf("<p><h3>Active Connections</h3>\n");
printf("<table border=1>\n");
printf("<tr><th>Share</th><th>User</th><th>Group</th><th>PID</th><th>Client</th><th>Date</th></tr>\n\n");
@@ -583,6 +624,8 @@ static void status_page(void)
printf("</table>\n");
fclose(f);
+
+ printf("</FORM>\n");
}