Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-01-03 23:49:42 UTC

Modified files:
     ChangeLog ircd/IPcheck.c ircd/ircd.c

Log message:

Fix an infinite loop in ircd.c and skip clone checking for 0.0.0.0 clients.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.528 ircu2.10/ChangeLog:1.529
--- ircu2.10/ChangeLog:1.528    Mon Jan  3 05:24:23 2005
+++ ircu2.10/ChangeLog  Mon Jan  3 15:49:31 2005
@@ -1,3 +1,11 @@
+2005-01-03  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/IPcheck.c (ip_registry_check_remote): Do not count clones
+       that have an invalid IP address.
+
+       * ircd/ircd.c (try_connections): Update Connect hold time before
+       skipping it, to prevent infinite loops.
+
 2005-01-03  Kevin L Mitchell  <[EMAIL PROTECTED]>
 
        * ircd/s_user.c (is_silenced): is_silenced() would core if sptr
Index: ircu2.10/ircd/IPcheck.c
diff -u ircu2.10/ircd/IPcheck.c:1.34 ircu2.10/ircd/IPcheck.c:1.35
--- ircu2.10/ircd/IPcheck.c:1.34        Wed Dec 15 20:37:14 2004
+++ ircu2.10/ircd/IPcheck.c     Mon Jan  3 15:49:32 2005
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Code to count users connected from particular IP addresses.
- * @version $Id: IPcheck.c,v 1.34 2004/12/16 04:37:14 entrope Exp $
+ * @version $Id: IPcheck.c,v 1.35 2005/01/03 23:49:32 entrope Exp $
  */
 #include "config.h"
 
@@ -326,12 +326,15 @@
  */
 int ip_registry_check_remote(struct Client* cptr, int is_burst)
 {
-  struct IPRegistryEntry* entry = ip_registry_find(&cli_ip(cptr));
+  struct IPRegistryEntry* entry;
 
   /*
    * Mark that we did add/update an IPregistry entry
    */
   SetIPChecked(cptr);
+  if (!irc_in_addr_valid(&cli_ip(cptr)))
+    return 1;
+  entry = ip_registry_find(&cli_ip(cptr));
   if (0 == entry) {
     entry = ip_registry_new_entry();
     ip_registry_canonicalize(&entry->addr, &cli_ip(cptr));
Index: ircu2.10/ircd/ircd.c
diff -u ircu2.10/ircd/ircd.c:1.77 ircu2.10/ircd/ircd.c:1.78
--- ircu2.10/ircd/ircd.c:1.77   Tue Dec 28 14:31:58 2004
+++ ircu2.10/ircd/ircd.c        Mon Jan  3 15:49:32 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Entry point and other initialization functions for the daemon.
- * @version $Id: ircd.c,v 1.77 2004/12/28 22:31:58 entrope Exp $
+ * @version $Id: ircd.c,v 1.78 2005/01/03 23:49:32 entrope Exp $
  */
 #include "config.h"
 
@@ -267,20 +267,20 @@
     if (next > aconf->hold || next == 0)
         next = aconf->hold;
 
-    /* Skip this entry if its use is still on hold until future, too
-     * many links in its connection class, it is already linked, or if
-     * connect rules forbid a link now.
-     */
+    /* Update the next time we can consider this entry. */
     cltmp = aconf->conn_class;
+    aconf->hold = ConFreq(cltmp) ? CurrentTime + ConFreq(cltmp) : 0;
+
+    /* Do not try to connect if its use is still on hold until future,
+     * too many links in its connection class, it is already linked,
+     * or if connect rules forbid a link now.
+     */
     if ((aconf->hold > CurrentTime)
         || (Links(cltmp) >= MaxLinks(cltmp))
         || FindServer(aconf->name)
         || conf_eval_crule(aconf->name, CRULE_MASK))
       continue;
 
-    /* We want to connect; update entry's hold time. */
-    aconf->hold = ConFreq(cltmp) ? CurrentTime + ConFreq(cltmp) : 0;
-
     /* Ensure it is at the end of the list for future checks. */
     if (aconf->next) {
       /* Find aconf's location in the list and splice it out. */
----------------------- End of diff -----------------------

Reply via email to