Allow more than one _functioning_ name= in a UWorld block.
[ircu2.10.12-pk.git] / ircd / ircd_parser.y
index b867f28d870ecff62f43ce5d9040a2675ede0e05..d2f37632723716f8852c22271b81fd4a974a85b2 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;
@@ -156,6 +155,7 @@ static void parse_error(char *pattern,...) {
 %token USERMODE
 %token IAUTH
 %token TIMEOUT
+%token FAST
 /* and now a lot of privileges... */
 %token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
 %token TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
@@ -342,6 +342,7 @@ classblock: CLASS {
     struct ConnectionClass *c_class;
     add_class(name, tping, tconn, maxlinks, sendq);
     c_class = find_class(name);
+    MyFree(c_class->default_umode);
     c_class->default_umode = pass;
     memcpy(&c_class->privs, &privs, sizeof(c_class->privs));
     memcpy(&c_class->privs_dirty, &privs_dirty, sizeof(c_class->privs_dirty));
@@ -470,26 +471,14 @@ connectmaxhops: MAXHOPS '=' expr ';'
   maxlinks = $3;
 };
 
-uworldblock: UWORLD '{' uworlditems '}' ';'
-{
- if (name)
- {
-  struct ConfItem *aconf = make_conf(CONF_UWORLD);
-  aconf->host = name;
- }
- else
- {
-  MyFree(name);
-  parse_error("Bad UWorld block");
- }
- name = NULL;
-};
+uworldblock: UWORLD '{' uworlditems '}' ';';
 uworlditems: uworlditem uworlditems | uworlditem;
 uworlditem: uworldname | error;
 uworldname: NAME '=' QSTRING ';'
 {
- MyFree(name);
- DupString(name, $3);
+ struct ConfItem *aconf;
+ aconf = make_conf(CONF_UWORLD);
+ DupString(aconf->host, $3);
 };
 
 operblock: OPER '{' operitems '}' ';'
@@ -658,6 +647,7 @@ clientblock: CLIENT
     MyFree(username);
     MyFree(host);
     MyFree(ip);
+    MyFree(pass);
   } else {
     struct ConfItem *aconf = make_conf(CONF_CLIENT);
     aconf->username = username;
@@ -670,11 +660,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;
@@ -728,16 +720,15 @@ killblock: KILL
   dconf = (struct DenyConf*) MyCalloc(1, sizeof(*dconf));
 } '{' killitems '}'
 {
-  if (dconf->hostmask != NULL)
-  {
-    if (dconf->usermask == NULL)
-      DupString(dconf->usermask, "*");
+  if (dconf->usermask || dconf->hostmask ||dconf->realmask) {
     dconf->next = denyConfList;
     denyConfList = dconf;
   }
   else
   {
+    MyFree(dconf->usermask);
     MyFree(dconf->hostmask);
+    MyFree(dconf->realmask);
     MyFree(dconf->message);
     MyFree(dconf);
     parse_error("Bad kill block");
@@ -745,11 +736,10 @@ killblock: KILL
   dconf = NULL;
 } ';';
 killitems: killitem killitems | killitem;
-killitem: killuhost | killreal | killreasonfile | killreason | error;
+killitem: killuhost | killreal | killusername | killreasonfile | killreason | error;
 killuhost: HOST '=' QSTRING ';'
 {
   char *u, *h;
-  dconf->flags &= ~DENY_FLAGS_REALNAME;
   MyFree(dconf->hostmask);
   MyFree(dconf->usermask);
   if ((h = strchr($3, '@')) == NULL)
@@ -760,20 +750,23 @@ killuhost: HOST '=' QSTRING ';'
   else
   {
     u = $3;
-    h++;
+    *h++ = '\0';
   }
   DupString(dconf->hostmask, h);
   DupString(dconf->usermask, u);
   ipmask_parse(dconf->hostmask, &dconf->address, &dconf->bits);
 };
 
+killusername: USERNAME '=' QSTRING ';'
+{
+  MyFree(dconf->usermask);
+  DupString(dconf->usermask, $3);
+};
+
 killreal: REAL '=' QSTRING ';'
 {
- dconf->flags &= ~DENY_FLAGS_IP;
- dconf->flags |= DENY_FLAGS_REALNAME;
- MyFree(dconf->hostmask);
- /* Leave usermask so you can specify user and real... */
- DupString(dconf->hostmask, $3);
+ MyFree(dconf->realmask);
+ DupString(dconf->realmask, $3);
 };
 
 killreason: REASON '=' QSTRING ';'
@@ -886,27 +879,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 '{'
@@ -943,7 +924,7 @@ pseudoitems '}' ';'
 };
 
 pseudoitems: pseudoitem pseudoitems | pseudoitem;
-pseudoitem: pseudoname | pseudoprepend | pseudonick | error;
+pseudoitem: pseudoname | pseudoprepend | pseudonick | pseudoflags | error;
 pseudoname: NAME '=' QSTRING ';'
 {
   DupString(smap->name, $3);
@@ -965,6 +946,10 @@ pseudonick: NICK '=' QSTRING ';'
     smap->services = nh;
   }
 };
+pseudoflags: FAST ';'
+{
+  smap->flags |= SMAP_FAST;
+};
 
 iauthblock: IAUTH '{'
 {