summaryrefslogtreecommitdiff
path: root/source3/web
diff options
context:
space:
mode:
Diffstat (limited to 'source3/web')
-rw-r--r--source3/web/diagnose.c17
-rw-r--r--source3/web/startstop.c33
-rw-r--r--source3/web/statuspage.c28
3 files changed, 78 insertions, 0 deletions
diff --git a/source3/web/diagnose.c b/source3/web/diagnose.c
index e822474aab..396499bcb9 100644
--- a/source3/web/diagnose.c
+++ b/source3/web/diagnose.c
@@ -21,6 +21,23 @@
#include "includes.h"
#include "../web/swat_proto.h"
+#ifdef WITH_WINBIND
+
+NSS_STATUS winbindd_request(int req_type,
+ struct winbindd_request *request,
+ struct winbindd_response *response);
+
+/* check to see if winbind is running by pinging it */
+
+BOOL winbindd_running(void)
+{
+
+ if (winbindd_request(WINBINDD_PING, NULL, NULL))
+ return False;
+
+ return True;
+}
+#endif
/* check to see if nmbd is running on localhost by looking for a __SAMBA__
response */
diff --git a/source3/web/startstop.c b/source3/web/startstop.c
index 893784dd55..e10dff4118 100644
--- a/source3/web/startstop.c
+++ b/source3/web/startstop.c
@@ -67,6 +67,27 @@ void start_nmbd(void)
exit(0);
}
+/** Startup winbindd from web interface. */
+void start_winbindd(void)
+{
+ pstring binfile;
+
+ if (geteuid() != 0) return;
+
+ if (fork()) {
+ sleep(SLEEP_TIME);
+ return;
+ }
+
+ slprintf(binfile, sizeof(pstring) - 1, "%s/winbindd", dyn_SBINDIR);
+
+ become_daemon();
+
+ execl(binfile, binfile, NULL);
+
+ exit(0);
+}
+
/* stop smbd */
void stop_smbd(void)
@@ -91,7 +112,19 @@ void stop_nmbd(void)
kill(pid, SIGTERM);
}
+#ifdef WITH_WINBIND
+/* stop winbindd */
+void stop_winbindd(void)
+{
+ pid_t pid = pidfile_pid("winbindd");
+ if (geteuid() != 0) return;
+
+ if (pid <= 0) return;
+
+ kill(pid, SIGTERM);
+}
+#endif
/* kill a specified process */
void kill_pid(pid_t pid)
{
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c
index 792e077a61..3b597d44c0 100644
--- a/source3/web/statuspage.c
+++ b/source3/web/statuspage.c
@@ -248,6 +248,20 @@ void status_page(void)
stop_nmbd();
}
+#ifdef WITH_WINBIND
+ if (cgi_variable("winbindd_restart")) {
+ stop_winbindd();
+ start_winbindd();
+ }
+
+ if (cgi_variable("winbindd_start")) {
+ start_winbindd();
+ }
+
+ if (cgi_variable("winbindd_stop")) {
+ stop_winbindd();
+ }
+#endif
if (cgi_variable("autorefresh")) {
autorefresh = 1;
} else if (cgi_variable("norefresh")) {
@@ -320,6 +334,20 @@ void status_page(void)
}
d_printf("</tr>\n");
+#ifdef WITH_WINBIND
+ fflush(stdout);
+ d_printf("<tr><td>%s</td><td>%s</td>\n", _("winbindd:"), winbindd_running()?_("running"):_("not running"));
+ if (geteuid() == 0) {
+ if (winbindd_running()) {
+ d_printf("<td><input type=submit name=\"winbindd_stop\" value=\"%s\"></td>\n", _("Stop winbindd"));
+ } else {
+ d_printf("<td><input type=submit name=\"winbindd_start\" value=\"%s\"></td>\n", _("Start winbindd"));
+ }
+ d_printf("<td><input type=submit name=\"winbindd_restart\" value=\"%s\"></td>\n", _("Restart winbindd"));
+ }
+ d_printf("</tr>\n");
+#endif
+
d_printf("</table>\n");
fflush(stdout);