[cvslog] [CVS] Module eggdrop1.8: Change committed

cvs at eggheads.org cvs at eggheads.org
Tue Dec 11 07:28:20 CST 2012


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.8
Branch tags: gettext
Commit time: 2012-12-11 13:28:20 UTC
Committer  : Thomas Sader <thommey at gmail.com>

Modified files:
  Tag: gettext
     doc/Changes1.8 src/match.c

Log message:

Make sure match_cidr returns NOMATCH if address families mismatch.

---------------------- diff included ----------------------
Index: eggdrop1.8/doc/Changes1.8
diff -u eggdrop1.8/doc/Changes1.8:1.36.2.31 eggdrop1.8/doc/Changes1.8:1.36.2.32
--- eggdrop1.8/doc/Changes1.8:1.36.2.31	Mon Dec 10 16:54:15 2012
+++ eggdrop1.8/doc/Changes1.8	Tue Dec 11 07:28:10 2012
@@ -1,4 +1,4 @@
-$Id: Changes1.8,v 1.36.2.31 2012/12/10 22:54:15 thommey Exp $
+$Id: Changes1.8,v 1.36.2.32 2012/12/11 13:28:10 thommey Exp $
 
 Eggdrop Changes (since version 1.8.0)
 
@@ -6,6 +6,9 @@
 
 1.8.0 (CVS):
 
+  - Make sure match_cidr returns NOMATCH if address families mismatch.
+    Patch by: Robby
+
   - Fix match_cidr to always return MATCH if the prefix is 0.
     Patch by: thommey / Found by: Robby
 
Index: eggdrop1.8/src/match.c
diff -u eggdrop1.8/src/match.c:1.1.1.1.2.1 eggdrop1.8/src/match.c:1.1.1.1.2.2
--- eggdrop1.8/src/match.c:1.1.1.1.2.1	Mon Dec 10 16:54:15 2012
+++ eggdrop1.8/src/match.c	Tue Dec 11 07:28:10 2012
@@ -4,7 +4,7 @@
  *   hostmask matching
  *   cidr matching
  *
- * $Id: match.c,v 1.1.1.1.2.1 2012/12/10 22:54:15 thommey Exp $
+ * $Id: match.c,v 1.1.1.1.2.2 2012/12/11 13:28:10 thommey Exp $
  *
  * Once this code was working, I added support for % so that I could
  * use the same code both in Eggdrop and in my IrcII client.
@@ -331,8 +331,6 @@
   int c, af = AF_INET;
   u_8bit_t block[16], addr[16];
 
-  if (count < 1)
-    return 1;
   if (strchr(m, ':') || strchr(n, ':')) {
     af = AF_INET6;
     if (count > 128)
@@ -342,6 +340,8 @@
   if (inet_pton(af, m, &block) != 1 ||
       inet_pton(af, n, &addr) != 1)
     return NOMATCH;
+  if (count < 1)
+    return 1;
   for (c = 0; c < (count / 8); c++)
     if (block[c] != addr[c])
       return NOMATCH;
@@ -353,14 +353,14 @@
 #else
   IP block, addr;
 
-  if (count < 1)
-    return 1;
   if (count > 32)
     return NOMATCH;
   block = ntohl(inet_addr(m));
   addr = ntohl(inet_addr(n));
   if (block == INADDR_NONE || addr == INADDR_NONE)
     return NOMATCH;
+  if (count < 1)
+    return 1;
   count = 32 - count;
   return ((block >> count) == (addr >> count));
 #endif
----------------------- End of diff -----------------------


More information about the Changes mailing list