Make Client blocks more forgiving and fix a bug in Kill reason parsing.
authorMichael Poole <mdpoole@troilus.org>
Sat, 19 Feb 2005 04:45:53 +0000 (04:45 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sat, 19 Feb 2005 04:45:53 +0000 (04:45 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1314 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/ircd_parser.y

index 7cb6af267cd083f6a1e23da90619f99221086376..be50080c7ec1d91bc86df46a67d913826ecb588e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
        * ircd/IPcheck.c (ip_registry_find): Use canonical form of IP
        address to look up and compare against hash entries.
 
+       * ircd/ircd_parser.y (clientblock): Stash IP string in aconf->name.
+       (clienthost): Split hosts that contain '@' into username and host.
+       (clientip): Split IPs that contain '@' into username and IP.
+       (killreason): Add missing ~ to mask off DENY_FLAGS_FILE.
+
        * ircd/m_silence.c (forward_silences): When we reject a silence,
        splice it out of the ban list.  Warn the user if he is local.
 
index 2ae4a1b96effbb787b5e6de185382c31493bf696..0fb55730763d3b2e216b5540fd9461c2f3d8c2b1 100644 (file)
@@ -654,28 +654,48 @@ clientblock: CLIENT
   unsigned char addrbits;
   aconf->username = username;
   aconf->host = host;
-  if (ip && ipmask_parse(ip, &aconf->address.addr, &addrbits))
+  if (ip && ipmask_parse(ip, &aconf->address.addr, &addrbits)) {
     aconf->addrbits = addrbits;
-  else
+    aconf->name = ip;
+  } else {
+    MyFree(ip);
     aconf->addrbits = -1;
+    DupString(aconf->name, "*");
+  }
   aconf->conn_class = c_class ? c_class : find_class("default");
   aconf->maximum = maxlinks;
   host = NULL;
   username = NULL;
   c_class = NULL;
-  MyFree(ip);
+  ip = NULL;
 };
 clientitems: clientitem clientitems | clientitem;
 clientitem: clienthost | clientip | clientusername | clientclass | clientpass | clientmaxlinks | error;
 clienthost: HOST '=' QSTRING ';'
 {
+  char *sep = strchr($3, '@');
   MyFree(host);
-  DupString(host, $3);
+  if (sep) {
+    *sep++ = '\0';
+    MyFree(username);
+    DupString(username, $3);
+    DupString(host, sep);
+  } else {
+    DupString(host, $3);
+  }
 };
 clientip: IP '=' QSTRING ';'
 {
+  char *sep = strchr($3, '@');
   MyFree(ip);
-  DupString(ip, $3);
+  if (sep) {
+    *sep++ = '\0';
+    MyFree(username);
+    DupString(username, $3);
+    DupString(ip, sep);
+  } else {
+    DupString(ip, $3);
+  }
 };
 clientusername: USERNAME '=' QSTRING ';'
 {
@@ -751,7 +771,7 @@ killreal: REAL '=' QSTRING ';'
 
 killreason: REASON '=' QSTRING ';'
 {
- dconf->flags &= DENY_FLAGS_FILE;
+ dconf->flags &= ~DENY_FLAGS_FILE;
  MyFree(dconf->message);
  DupString(dconf->message, $3);
 };