Report non-existent class names as configuration errors earlier.
authorMichael Poole <mdpoole@troilus.org>
Thu, 28 Apr 2005 02:00:09 +0000 (02:00 +0000)
committerMichael Poole <mdpoole@troilus.org>
Thu, 28 Apr 2005 02:00:09 +0000 (02:00 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1390 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/ircd_parser.y

index 1f749808a525e502b23a2aa75f08e5dbe46cd5ce..94cbea43b248e512adcbb501bb3ec24a39751e3c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-27  Michael Poole <mdpoole@troilus.org>
+
+       * 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  <reed@reedloden.com>
 
        * ircd/ircd_lexer.l: Add missing header to squash a warning.
index c7d726dca9747375740641dfbd9d6b9c8b4c458f..13c881bd4d5191bf31d9f5bfe5a8725fee841f9e 100644 (file)
@@ -409,7 +409,7 @@ connectblock: CONNECT
  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 @@ connectpass: PASS '=' QSTRING ';'
 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 @@ operblock: OPER '{' operitems '}' ';'
   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 @@ operhost: HOST '=' QSTRING ';'
 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 @@ clientblock: CLIENT
 }
 '{' 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 @@ clientblock: CLIENT
       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 @@ clientusername: USERNAME '=' QSTRING ';'
 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 ';'