Fix bugs spotted in beta testing: Quarantine blocks not working or
[ircu2.10.12-pk.git] / ircd / ircd_parser.y
index a9876bf15e1235ff2dd851eb0b7e94be2b0785c7..4d0692c9dba392cc624eebe8954b678cccc57d61 100644 (file)
@@ -74,7 +74,6 @@
   struct ConnectionClass *c_class;
   struct DenyConf *dconf;
   struct ServerConf *sconf;
-  struct qline *qconf = NULL;
   struct s_map *smap;
   struct Privs privs;
   struct Privs privs_dirty;
@@ -659,6 +658,7 @@ clientblock: CLIENT
     MyFree(username);
     MyFree(host);
     MyFree(ip);
+    MyFree(pass);
   } else {
     struct ConfItem *aconf = make_conf(CONF_CLIENT);
     aconf->username = username;
@@ -671,11 +671,13 @@ clientblock: CLIENT
     aconf->name = ip;
     aconf->conn_class = c_class ? c_class : find_class("default");
     aconf->maximum = maxlinks;
+    aconf->passwd = pass;
   }
   host = NULL;
   username = NULL;
   c_class = NULL;
   ip = NULL;
+  pass = NULL;
 };
 clientitems: clientitem clientitems | clientitem;
 clientitem: clienthost | clientip | clientusername | clientclass | clientpass | clientmaxlinks | error;
@@ -761,7 +763,7 @@ killuhost: HOST '=' QSTRING ';'
   else
   {
     u = $3;
-    h++;
+    *h++ = '\0';
   }
   DupString(dconf->hostmask, h);
   DupString(dconf->usermask, u);
@@ -887,27 +889,15 @@ extrastring: QSTRING
     stringlist[stringno++] = $1;
 };
 
-quarantineblock: QUARANTINE '{'
-{
-  qconf = (struct qline*) MyCalloc(1, sizeof(*qconf));
-} quarantineitems '}' ';'
+quarantineblock: QUARANTINE '{' quarantineitems '}' ';';
+quarantineitems: quarantineitems quarantineitem | quarantineitem;
+quarantineitem: QSTRING '=' QSTRING ';'
 {
-  if (qconf->chname == NULL || qconf->reason == NULL)
-  {
-    parse_error("quarantine blocks need a channel name and a reason.");
-    return 0;
-  }
+  struct qline *qconf = MyCalloc(1, sizeof(*qconf));
+  DupString(qconf->chname, $1);
+  DupString(qconf->reason, $3);
   qconf->next = GlobalQuarantineList;
   GlobalQuarantineList = qconf;
-  qconf = NULL;
-};
-
-quarantineitems: CHANNEL NAME '=' QSTRING ';'
-{
-  DupString(qconf->chname, $4);
-} | REASON '=' QSTRING ';'
-{
-  DupString(qconf->reason, $3);
 };
 
 pseudoblock: PSEUDO QSTRING '{'