Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2005-10-06 00:37:41 UTC

Modified files:
  Tag: u2_10_12_branch
     ChangeLog ircd/class.c ircd/ircd_parser.y ircd/s_conf.c

Log message:

Fix setting of FLAG_DOID and buglet from last commit.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.5 ircu2.10/ChangeLog:1.710.2.6
--- ircu2.10/ChangeLog:1.710.2.5        Tue Oct  4 18:51:34 2005
+++ ircu2.10/ChangeLog  Wed Oct  5 17:37:31 2005
@@ -1,3 +1,13 @@
+2005-10-05  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/class.c (do_find_class): Fix bug from previous commit.
+
+       * ircd/ircd_parser.y (clientblock): Allow setting Client port.
+
+       * ircd/s_conf.c (check_limit_and_attach): Merge into attach_iline.
+       (attach_iline): Only set FLAG_DOID when we are sure we will attach
+       this Client block to the client. [Credit: Jukka Ollila and others]
+
 2005-10-04  Michael Poole <[EMAIL PROTECTED]>
        [Based on a patch by Jukka Ollila]
 
Index: ircu2.10/ircd/class.c
diff -u ircu2.10/ircd/class.c:1.34.2.2 ircu2.10/ircd/class.c:1.34.2.3
--- ircu2.10/ircd/class.c:1.34.2.2      Tue Oct  4 18:51:34 2005
+++ ircu2.10/ircd/class.c       Wed Oct  5 17:37:31 2005
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Implementation of connection class handling functions.
- * @version $Id: class.c,v 1.34.2.2 2005/10/05 01:51:34 entrope Exp $
+ * @version $Id: class.c,v 1.34.2.3 2005/10/06 00:37:31 entrope Exp $
  */
 #include "config.h"
 
@@ -238,7 +238,7 @@
   struct ConnectionClass *cltmp;
 
   for (cltmp = connClassList; cltmp; cltmp = cltmp->next) {
-    if (!cltmp->valid || !extras)
+    if (!cltmp->valid && !extras)
       continue;
     if (!ircd_strcmp(ConClass(cltmp), name))
       return cltmp;
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.56 ircu2.10/ircd/ircd_parser.y:1.56.2.1
--- ircu2.10/ircd/ircd_parser.y:1.56    Sun Aug 21 06:46:07 2005
+++ ircu2.10/ircd/ircd_parser.y Wed Oct  5 17:37:31 2005
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  *  USA.
- * $Id: ircd_parser.y,v 1.56 2005/08/21 13:46:07 entrope Exp $
+ * $Id: ircd_parser.y,v 1.56.2.1 2005/10/06 00:37:31 entrope Exp $
  */
 %{
 
@@ -665,6 +665,7 @@
 clientblock: CLIENT
 {
   maxlinks = 65535;
+  port = 0;
 }
 '{' clientitems '}' ';'
 {
@@ -684,6 +685,7 @@
       memcpy(&aconf->address.addr, &addr, sizeof(aconf->address.addr));
     else
       memset(&aconf->address.addr, 0, sizeof(aconf->address.addr));
+    aconf->address.port = port;
     aconf->addrbits = addrbits;
     aconf->name = ip;
     aconf->conn_class = c_class;
@@ -701,9 +703,10 @@
   c_class = NULL;
   ip = NULL;
   pass = NULL;
+  port = 0;
 };
 clientitems: clientitem clientitems | clientitem;
-clientitem: clienthost | clientip | clientusername | clientclass | clientpass 
| clientmaxlinks;
+clientitem: clienthost | clientip | clientusername | clientclass | clientpass 
| clientmaxlinks | clientport;
 clienthost: HOST '=' QSTRING ';'
 {
   char *sep = strchr($3, '@');
@@ -752,6 +755,10 @@
 {
   maxlinks = $3;
 };
+clientport: PORT '=' expr ';'
+{
+  port = $3;
+};
 
 killblock: KILL
 {
Index: ircu2.10/ircd/s_conf.c
diff -u ircu2.10/ircd/s_conf.c:1.81 ircu2.10/ircd/s_conf.c:1.81.2.1
--- ircu2.10/ircd/s_conf.c:1.81 Mon Sep 12 14:22:44 2005
+++ ircu2.10/ircd/s_conf.c      Wed Oct  5 17:37:31 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief ircd configuration file driver
- * @version $Id: s_conf.c,v 1.81 2005/09/12 21:22:44 decampos Exp $
+ * @version $Id: s_conf.c,v 1.81.2.1 2005/10/06 00:37:31 entrope Exp $
  */
 #include "config.h"
 
@@ -345,22 +345,6 @@
   }
 }
 
-/** Check client limits and attach Client block.
- * If there are more connections from the IP than \a aconf->maximum
- * allows, return ACR_TOO_MANY_FROM_IP.  Otherwise, attach \a aconf to
- * \a cptr.
- * @param cptr Client getting \a aconf.
- * @param aconf Configuration item to attach.
- * @return Authorization check result.
- */
-static enum AuthorizationCheckResult
-check_limit_and_attach(struct Client* cptr, struct ConfItem* aconf)
-{
-  if (IPcheck_nr(cptr) > aconf->maximum)
-    return ACR_TOO_MANY_FROM_IP;
-  return attach_conf(cptr, aconf);
-}
-
 /** Find the first (best) Client block to attach.
  * @param cptr Client for whom to check rules.
  * @return Authorization check result.
@@ -379,17 +363,18 @@
      */
     if (aconf->address.port && aconf->address.port != 
cli_listener(cptr)->addr.port)
       continue;
-    if (aconf->username) {
-      SetFlag(cptr, FLAG_DOID);
-      if (match(aconf->username, cli_username(cptr)))
-        continue;
-    }
+    if (aconf->username && match(aconf->username, cli_username(cptr)))
+      continue;
     if (aconf->host && match(aconf->host, cli_sockhost(cptr)))
       continue;
     if ((aconf->addrbits >= 0)
         && !ipmask_check(&cli_ip(cptr), &aconf->address.addr, aconf->addrbits))
       continue;
-    return check_limit_and_attach(cptr, aconf);
+    if (IPcheck_nr(cptr) > aconf->maximum)
+      return ACR_TOO_MANY_FROM_IP;
+    if (aconf->username)
+      SetFlag(cptr, FLAG_DOID);
+    return attach_conf(cptr, aconf);
   }
   return ACR_NO_AUTHORIZATION;
 }
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to