safer killing of connections - it ensures the process is still a valid
authorAndrew Tridgell <tridge@samba.org>
Sun, 15 Mar 1998 02:47:22 +0000 (02:47 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 15 Mar 1998 02:47:22 +0000 (02:47 +0000)
smbd when killing
(This used to be commit 78675036e81e2cde7209d9e68956d71ef6661137)

source3/web/statuspage.c

index 3a95d99d374f127d2deaf45f5c873ace87ec317c..0031adde9f06575d443c890bf2256abd876b2da4 100644 (file)
@@ -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");