diff options
-rw-r--r-- | source3/include/proto.h | 12 | ||||
-rw-r--r-- | source3/smbd/reply.c | 4 | ||||
-rw-r--r-- | source3/smbd/server.c | 4 | ||||
-rw-r--r-- | source3/web/statuspage.c | 19 |
4 files changed, 24 insertions, 15 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 88b340319e..9046fc2886 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -123,6 +123,11 @@ int process_tar(char *inbuf, char *outbuf); int clipfind(char **aret, int ret, char *tok); int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind); +/*The following definitions come from connection.c */ + +BOOL yield_connection(int cnum,char *name,int max_connections); +BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear); + /*The following definitions come from credentials.c */ char *credstr(uchar *cred); @@ -1631,8 +1636,6 @@ int reply_lanman1(char *outbuf); int reply_lanman2(char *outbuf); int reply_nt1(char *outbuf); void close_cnum(int cnum, uint16 vuid); -BOOL yield_connection(int cnum,char *name,int max_connections); -BOOL claim_connection(int cnum,char *name,int max_connections,BOOL Clear); void exit_server(char *reason); void standard_sub(int cnum,char *str); char *smb_fn_name(int type); @@ -1929,6 +1932,11 @@ void start_smbd(void); void start_nmbd(void); void stop_smbd(void); void stop_nmbd(void); +void kill_pid(int pid); + +/*The following definitions come from web/statuspage.c */ + +void status_page(void); /*The following definitions come from web/swat.c */ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 83a4293fad..b0550bba57 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -120,6 +120,10 @@ int reply_special(char *inbuf,char *outbuf) reload_services(True); reopen_logs(); + if (lp_status(-1)) { + claim_connection(-1,"STATUS.",MAXSTATUS,True); + } + break; case 0x89: /* session keepalive request diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 64b293336b..248a2cee5f 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -5167,10 +5167,6 @@ static void usage(char *pname) if(!open_oplock_ipc()) exit(1); - if (lp_status(-1)) { - claim_connection(-1,"STATUS.",MAXSTATUS,True); - } - process(); close_sockets(); diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c index 0031adde9f..25a45928f2 100644 --- a/source3/web/statuspage.c +++ b/source3/web/statuspage.c @@ -67,8 +67,6 @@ void status_page(void) struct connect_record crec; pstring fname; FILE *f; - int i, pid; - char *v; if (cgi_variable("smbd_start")) { start_smbd(); @@ -86,6 +84,12 @@ void status_page(void) stop_nmbd(); } + pstrcpy(fname,lp_lockdir()); + standard_sub_basic(fname); + trim_string(fname,"","/"); + strcat(fname,"/STATUS..LCK"); + + f = fopen(fname,"r"); if (f) { while (!feof(f)) { @@ -95,7 +99,7 @@ void status_page(void) char buf[30]; sprintf(buf,"kill_%d", crec.pid); if (cgi_variable(buf)) { - kill_pid(pid); + kill_pid(crec.pid); } } } @@ -106,11 +110,6 @@ void status_page(void) printf("<FORM method=post>\n"); - pstrcpy(fname,lp_lockdir()); - standard_sub_basic(fname); - trim_string(fname,"","/"); - strcat(fname,"/STATUS..LCK"); - f = fopen(fname,"r"); if (!f) { printf("Couldn't open status file %s\n",fname); @@ -152,7 +151,9 @@ void status_page(void) while (!feof(f)) { if (fread(&crec,sizeof(crec),1,f) != 1) break; - if (crec.magic == 0x280267 && process_exists(crec.pid)) { + if (crec.magic == 0x280267 && + crec.cnum == -1 && + process_exists(crec.pid)) { printf("<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td><input type=submit value=\"X\" name=\"kill_%d\"></td></tr>\n", crec.pid, crec.machine,crec.addr, |