diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-03-15 02:47:22 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-03-15 02:47:22 +0000 |
commit | 08a6e255fe8dec721b57aa15a4e606b11dc7f44d (patch) | |
tree | 4495b3d0209fd01083e15a5cf4475c5319bd0369 /source3/web | |
parent | d360320618fe3a7f53ac1f05ee3ac54323a03c82 (diff) | |
download | samba-08a6e255fe8dec721b57aa15a4e606b11dc7f44d.tar.gz samba-08a6e255fe8dec721b57aa15a4e606b11dc7f44d.tar.bz2 samba-08a6e255fe8dec721b57aa15a4e606b11dc7f44d.zip |
safer killing of connections - it ensures the process is still a valid
smbd when killing
(This used to be commit 78675036e81e2cde7209d9e68956d71ef6661137)
Diffstat (limited to 'source3/web')
-rw-r--r-- | source3/web/statuspage.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c index 3a95d99d37..0031adde9f 100644 --- a/source3/web/statuspage.c +++ b/source3/web/statuspage.c @@ -86,16 +86,22 @@ void status_page(void) stop_nmbd(); } - for (i=0;cgi_vnum(i, &v); i++) { - if (strncmp(v, "kill_", 5) != 0) continue; - pid = atoi(v+5); - if (pid > 0) { - printf("killing %d<br>\n", pid); - kill_pid(pid); + f = fopen(fname,"r"); + if (f) { + while (!feof(f)) { + if (fread(&crec,sizeof(crec),1,f) != 1) break; + if (crec.magic == 0x280267 && crec.cnum == -1 && + process_exists(crec.pid)) { + char buf[30]; + sprintf(buf,"kill_%d", crec.pid); + if (cgi_variable(buf)) { + kill_pid(pid); + } + } } + fclose(f); } - printf("<H2>Server Status</H2>\n"); printf("<FORM method=post>\n"); |