Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-04-28 02:00:20 UTC

Modified files:
     ChangeLog ircd/ircd_parser.y

Log message:

Report non-existent class names as configuration errors earlier.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.616 ircu2.10/ChangeLog:1.617
--- ircu2.10/ChangeLog:1.616    Mon Apr 25 20:56:50 2005
+++ ircu2.10/ChangeLog  Wed Apr 27 19:00:05 2005
@@ -1,3 +1,8 @@
+2005-04-27  Michael Poole <[EMAIL PROTECTED]>
+
+       * ircd/ircd_parser.y: Report non-existent class names as errors
+       earlier, and do not fall back to "default" for Client blocks.
+
 2005-04-25  Reed Loden  <[EMAIL PROTECTED]>
 
        * ircd/ircd_lexer.l: Add missing header to squash a warning.
Index: ircu2.10/ircd/ircd_parser.y
diff -u ircu2.10/ircd/ircd_parser.y:1.52 ircu2.10/ircd/ircd_parser.y:1.53
--- ircu2.10/ircd/ircd_parser.y:1.52    Sun Apr 24 20:35:54 2005
+++ ircu2.10/ircd/ircd_parser.y Wed Apr 27 19:00:09 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.52 2005/04/25 03:35:54 entrope Exp $
+ * $Id: ircd_parser.y,v 1.53 2005/04/28 02:00:09 entrope Exp $
  */
 %{
 
@@ -409,7 +409,7 @@
  else if (strchr(host, '*') || strchr(host, '?'))
   parse_error("Invalid host '%s' in connect block", host);
  else if (c_class == NULL)
-  parse_error("Missing class in connect block");
+  parse_error("Missing or non-existent class in connect block");
  else {
    aconf = make_conf(CONF_SERVER);
    aconf->name = name;
@@ -451,6 +451,8 @@
 connectclass: CLASS '=' QSTRING ';'
 {
  c_class = find_class($3);
+ if (!c_class)
+  parse_error("No such connection class '%s' for Connect block", $3);
  MyFree($3);
 };
 connecthost: HOST '=' QSTRING ';'
@@ -506,7 +508,7 @@
   else if (host == NULL)
     parse_error("Missing host in operator block");
   else if (c_class == NULL)
-    parse_error("Missing class in operator block");
+    parse_error("Invalid or missing class in operator block");
   else {
     aconf = make_conf(CONF_OPERATOR);
     aconf->name = name;
@@ -557,6 +559,8 @@
 operclass: CLASS '=' QSTRING ';'
 {
  c_class = find_class($3);
+ if (!c_class)
+  parse_error("No such connection class '%s' for Operator block", $3);
  MyFree($3);
 };
 
@@ -657,17 +661,16 @@
 }
 '{' clientitems '}' ';'
 {
+  struct ConfItem *aconf = 0;
   struct irc_in_addr addr;
   unsigned char addrbits = 0;
 
-  if (ip && !ipmask_parse(ip, &addr, &addrbits)) {
-    parse_error("Invalid IP address %s in block", ip);
-    MyFree(username);
-    MyFree(host);
-    MyFree(ip);
-    MyFree(pass);
-  } else {
-    struct ConfItem *aconf = make_conf(CONF_CLIENT);
+  if (!c_class)
+    parse_error("Invalid or missing class in Client block");
+  else if (ip && !ipmask_parse(ip, &addr, &addrbits))
+    parse_error("Invalid IP address %s in Client block", ip);
+  else {
+    aconf = make_conf(CONF_CLIENT);
     aconf->username = username;
     aconf->host = host;
     if (ip)
@@ -676,10 +679,16 @@
       memset(&aconf->address.addr, 0, sizeof(aconf->address.addr));
     aconf->addrbits = addrbits;
     aconf->name = ip;
-    aconf->conn_class = c_class ? c_class : find_class("default");
+    aconf->conn_class = c_class;
     aconf->maximum = maxlinks;
     aconf->passwd = pass;
   }
+  if (!aconf) {
+    MyFree(username);
+    MyFree(host);
+    MyFree(ip);
+    MyFree(pass);
+  }
   host = NULL;
   username = NULL;
   c_class = NULL;
@@ -723,6 +732,8 @@
 clientclass: CLASS '=' QSTRING ';'
 {
   c_class = find_class($3);
+  if (!c_class)
+    parse_error("No such connection class '%s' for Class block", $3);
   MyFree($3);
 };
 clientpass: PASS '=' QSTRING ';'
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to