git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1319
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c
2005-02-19 Michael Poole <mdpoole@troilus.org>
2005-02-19 Michael Poole <mdpoole@troilus.org>
+ * ircd/ircd_parser.y (clientblock): Parse IP address before
+ allocating ConfItem; if the parse fails, generate an error.
+
* ircd/s_err.c (RPL_STATSCLINE): Add format field to prefix IPv6
addresses starting with ':'.
(RPL_STATSILINE): Likewise.
* ircd/s_err.c (RPL_STATSCLINE): Add format field to prefix IPv6
addresses starting with ':'.
(RPL_STATSILINE): Likewise.
* ircd/s_stats.c (stats_configured_links): Pass the appropriate
argument for the RPL_STATSxLINE changes.
* ircd/s_stats.c (stats_configured_links): Pass the appropriate
argument for the RPL_STATSxLINE changes.
+ Change RPL_STATSILINE to use * instead of <NULL> when IP or host
+ is null.
2005-02-18 Michael Poole <mdpoole@troilus.org>
2005-02-18 Michael Poole <mdpoole@troilus.org>
}
'{' clientitems '}' ';'
{
}
'{' clientitems '}' ';'
{
- struct ConfItem *aconf = make_conf(CONF_CLIENT);
+ struct irc_in_addr addr;
- aconf->username = username;
- aconf->host = host;
- if (ip && ipmask_parse(ip, &aconf->address.addr, &addrbits)) {
+
+ if (ip && !ipmask_parse(ip, &addr, &addrbits)) {
+ parse_error("Invalid IP address in block");
+ MyFree(username);
+ MyFree(host);
+ MyFree(ip);
+ } else {
+ struct ConfItem *aconf = make_conf(CONF_CLIENT);
+ aconf->username = username;
+ aconf->host = host;
+ memcpy(&aconf->address.addr, &addr, sizeof(aconf->address.addr));
aconf->addrbits = addrbits;
aconf->name = ip;
aconf->addrbits = addrbits;
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;
- aconf->conn_class = c_class ? c_class : find_class("default");
- aconf->maximum = maxlinks;
host = NULL;
username = NULL;
c_class = NULL;
host = NULL;
username = NULL;
c_class = NULL;
hub_limit = BadPtr(tmp->hub_limit) ? null : tmp->hub_limit;
maximum = tmp->maximum;
port = tmp->address.port;
hub_limit = BadPtr(tmp->hub_limit) ? null : tmp->hub_limit;
maximum = tmp->maximum;
port = tmp->address.port;
if (tmp->status & CONF_UWORLD)
send_reply(sptr, RPL_STATSULINE, host);
else if (tmp->status & CONF_SERVER)
send_reply(sptr, RPL_STATSCLINE, name, (host[0] == ':' ? "0" : ""), host, port, maximum, hub_limit, get_conf_class(tmp));
else if (tmp->status & CONF_CLIENT)
if (tmp->status & CONF_UWORLD)
send_reply(sptr, RPL_STATSULINE, host);
else if (tmp->status & CONF_SERVER)
send_reply(sptr, RPL_STATSCLINE, name, (host[0] == ':' ? "0" : ""), host, port, maximum, hub_limit, get_conf_class(tmp));
else if (tmp->status & CONF_CLIENT)
- send_reply(sptr, RPL_STATSILINE, host, maximum, (name[0] == ':' ? "0" : ""), name, port, get_conf_class(tmp));
+ send_reply(sptr, RPL_STATSILINE,
+ (tmp->host ? tmp->host : "*"), maximum,
+ (name[0] == ':' ? "0" : ""), (tmp->name ? tmp->name : "*"),
+ port, get_conf_class(tmp));
else if (tmp->status & CONF_OPERATOR)
send_reply(sptr, RPL_STATSOLINE, username, host, name, get_conf_class(tmp));
}
else if (tmp->status & CONF_OPERATOR)
send_reply(sptr, RPL_STATSOLINE, username, host, name, get_conf_class(tmp));
}