- claim the null connection after the session request to mak sure we
authorAndrew Tridgell <tridge@samba.org>
Sun, 15 Mar 1998 03:06:50 +0000 (03:06 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 15 Mar 1998 03:06:50 +0000 (03:06 +0000)
  have the netbios name

- fix another kill connection bug
(This used to be commit c634b799874795d42dae28fb4440ea452dc89b1b)

source3/include/proto.h
source3/smbd/reply.c
source3/smbd/server.c
source3/web/statuspage.c

index 88b340319e193db45cf0dd59b03b3aaa07d81258..9046fc2886d211524d917e3cad4c9476ed9b64cb 100644 (file)
@@ -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  */
 
index 83a4293fad427d028c96bd355ed9a0dd31ad78ad..b0550bba570f1b6cae844dc134a527cf3fd271cf 100644 (file)
@@ -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 
index 64b293336b12d69816084a197671c6f37f281afc..248a2cee5f4f5e6cd5f6c556eec88b5319f1fa16 100644 (file)
@@ -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();
 
index 0031adde9f06575d443c890bf2256abd876b2da4..25a45928f2f45e1adbf77ebdaad346eb55debd75 100644 (file)
@@ -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,