1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

as per user request added windbind start/stop/restart in swat

almost working, seem it does not yet properly detect if windbind is running or not in all situations testing is welcome.
(This used to be commit e0988e9186)
This commit is contained in:
Simo Sorce 2002-07-27 01:37:33 +00:00
parent 2a03547b61
commit 2ff0939301
6 changed files with 774 additions and 694 deletions

1387
source3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2695,6 +2695,7 @@ WINBIND_PAM_PROGS=""
if test x"$HAVE_WINBIND" = x"yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(WITH_WINBIND)
WINBIND_TARGETS="bin/wbinfo"
WINBIND_STARGETS="bin/winbindd"

View File

@ -1,4 +1,4 @@
/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if on AIX 3.
System headers sometimes define this.

View File

@ -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 */

View File

@ -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)
{

View File

@ -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);