namedbname.c: Fixed *nasty* bug that caused nmbd to spin and eat memory
authorSamba Release Account <samba-bugs@samba.org>
Thu, 15 May 1997 23:47:34 +0000 (23:47 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Thu, 15 May 1997 23:47:34 +0000 (23:47 +0000)
              and CPU whilst trying to become a master browser. Don't ask,
              you don't want to know :-).
nameresp.c: Tidied formating of code.
nameservresp.c: Added debug value of IP address that is rejecting our
                registration.
jallison@whistle.com
(This used to be commit c0bae276a99211c0c7149a5e4e801706870074fd)

source3/namedbname.c
source3/nameresp.c
source3/nameservresp.c

index 5c514c263ffe1248d06ce4afe1c72d69216467b9..2e0afc1497baee4a0815a5895d1dba775dbfaf9c 100644 (file)
@@ -421,6 +421,12 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
 
   /* add the name to the WINS list if the name comes from a directed query */
   search |= wins ? FIND_WINS : FIND_LOCAL;
 
   /* add the name to the WINS list if the name comes from a directed query */
   search |= wins ? FIND_WINS : FIND_LOCAL;
+
+  /* If it's a local search then we need to set the subnet
+     we are looking at. */
+  if(search & FIND_LOCAL)
+    found_subnet = d;
+
   /* search for SELF names only */
   search |= self ? FIND_SELF : 0;
 
   /* search for SELF names only */
   search |= self ? FIND_SELF : 0;
 
index 3128b00ac58c45a1f38239b83207eff1383d1bfc..f2b3ba167aeec4044658584bbbf0e1a6b607b246 100644 (file)
@@ -210,33 +210,33 @@ void expire_netbios_response_entries(time_t t)
 
     for (n = d->responselist; n; n = nextn)
     {
 
     for (n = d->responselist; n; n = nextn)
     {
-         nextn = n->next;
+      nextn = n->next;
 
       if (n->repeat_time <= t)
 
       if (n->repeat_time <= t)
-         {
-                 if (n->repeat_count > 0)
-                 {
-                       /* resend the entry */
-                       initiate_netbios_packet(&n->response_id, n->fd, n->quest_type,
-                                               n->name.name, n->name.name_type,
-                                     n->nb_flags, n->bcast, n->recurse, n->send_ip);
-
-            n->repeat_time += n->repeat_interval; /* XXXX ms needed */
-            n->repeat_count--;
-
-                 }
-                 else
-                 {
-              DEBUG(4,("timeout response %d for %s %s\n",
-                                               n->response_id, namestr(&n->name),
-                        inet_ntoa(n->send_ip)));
-
-                         dead_netbios_entry    (d,n); /* process the non-response */
-              remove_response_record(d,n); /* remove the non-response */
-
-                         continue;
-                  }
-         }
+      {
+        if (n->repeat_count > 0)
+        {
+          /* resend the entry */
+          initiate_netbios_packet(&n->response_id, n->fd, n->quest_type,
+                         n->name.name, n->name.name_type,
+                         n->nb_flags, n->bcast, n->recurse, n->send_ip);
+
+          n->repeat_time += n->repeat_interval; /* XXXX ms needed */
+          n->repeat_count--;
+
+        }
+        else
+        {
+          DEBUG(4,("timeout response %d for %s %s\n",
+                   n->response_id, namestr(&n->name),
+                   inet_ntoa(n->send_ip)));
+
+          dead_netbios_entry(d,n); /* process the non-response */
+          remove_response_record(d,n); /* remove the non-response */
+
+          continue;
+        }
+      }
     }
   }
 }
     }
   }
 }
index 565a15656568a64a17ff9a03622d08a4f56adabc..27356d95e602f1186ce8766fbe8024839246da08 100644 (file)
@@ -113,7 +113,8 @@ static void response_name_reg(struct nmb_name *ans_name,
   }
   else
   {
   }
   else
   {
-    DEBUG(2,("name registration for %s rejected!\n", namestr(ans_name)));
+    DEBUG(2,("name registration for %s rejected by ip %s!\n", 
+              namestr(ans_name), inet_ntoa(p->ip)));
 
        /* oh dear. we have problems. possibly unbecome a master browser. */
     name_unregister_work(d,name,type);
 
        /* oh dear. we have problems. possibly unbecome a master browser. */
     name_unregister_work(d,name,type);