From: Michael Poole Date: Sat, 19 Feb 2005 04:45:53 +0000 (+0000) Subject: Make Client blocks more forgiving and fix a bug in Kill reason parsing. X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;h=e1472ead25f7651b9b2d6f6dd051e143647dba0f;p=ircu2.10.12-pk.git Make Client blocks more forgiving and fix a bug in Kill reason parsing. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1314 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 7cb6af2..be50080 100644 --- 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. diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index 2ae4a1b..0fb5573 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -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); };