From 08a6e255fe8dec721b57aa15a4e606b11dc7f44d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 15 Mar 1998 02:47:22 +0000 Subject: safer killing of connections - it ensures the process is still a valid smbd when killing (This used to be commit 78675036e81e2cde7209d9e68956d71ef6661137) --- source3/web/statuspage.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'source3') 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
\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("

Server Status

\n"); printf("
\n"); -- cgit