git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1381
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c
+2005-04-24 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/ircd_parser.y: Rewrite so each error condition gets its own
+ error message, and so that invalid parameters are printed out.
+
2005-04-23 Michael Poole <mdpoole@troilus.org>
* ircd/channel.c (apply_ban): Consistently free newban->banstr
2005-04-23 Michael Poole <mdpoole@troilus.org>
* ircd/channel.c (apply_ban): Consistently free newban->banstr
maxlinks = 65535;
} '{' connectitems '}'
{
maxlinks = 65535;
} '{' connectitems '}'
{
- if (name != NULL && pass != NULL && host != NULL && c_class != NULL
- && !strchr(host, '*') && !strchr(host, '?'))
- {
- struct ConfItem *aconf = make_conf(CONF_SERVER);
+ struct ConfItem *aconf = NULL;
+ if (name == NULL)
+ parse_error("Missing name in connect block");
+ else if (pass == NULL)
+ parse_error("Missing password in connect block");
+ else if (host == NULL)
+ parse_error("Missing host in connect block");
+ else if (strchr(host, '*') || strchr(host, '?'))
+ parse_error("Invalid host '%s' in connect block", host);
+ else if (c_class == NULL)
+ parse_error("Missing class in connect block");
+ else {
+ aconf = make_conf(CONF_SERVER);
aconf->name = name;
aconf->origin_name = origin;
aconf->passwd = pass;
aconf->name = name;
aconf->origin_name = origin;
aconf->passwd = pass;
aconf->hub_limit = hub_limit;
lookup_confhost(aconf);
}
aconf->hub_limit = hub_limit;
lookup_confhost(aconf);
}
MyFree(name);
MyFree(pass);
MyFree(host);
MyFree(origin);
MyFree(hub_limit);
MyFree(name);
MyFree(pass);
MyFree(host);
MyFree(origin);
MyFree(hub_limit);
- parse_error("Bad connect block");
}
name = pass = host = origin = hub_limit = NULL;
c_class = NULL;
}
name = pass = host = origin = hub_limit = NULL;
c_class = NULL;
operblock: OPER '{' operitems '}' ';'
{
operblock: OPER '{' operitems '}' ';'
{
- if (name && pass && host && c_class)
- {
- struct ConfItem *aconf = make_conf(CONF_OPERATOR);
+ struct ConfItem *aconf = NULL;
+ if (name == NULL)
+ parse_error("Missing name in operator block");
+ else if (pass == NULL)
+ parse_error("Missing password in operator block");
+ else if (host == NULL)
+ parse_error("Missing host in operator block");
+ else if (c_class == NULL)
+ parse_error("Missing class in operator block");
+ else {
+ aconf = make_conf(CONF_OPERATOR);
aconf->name = name;
aconf->passwd = pass;
conf_parse_userhost(aconf, host);
aconf->name = name;
aconf->passwd = pass;
conf_parse_userhost(aconf, host);
&& !FlagHas(&c_class->privs_dirty, PRIV_PROPAGATE))
parse_error("Operator block for %s and class %s have no LOCAL setting", name, c_class->cc_name);
}
&& !FlagHas(&c_class->privs_dirty, PRIV_PROPAGATE))
parse_error("Operator block for %s and class %s have no LOCAL setting", name, c_class->cc_name);
}
- else
- {
- parse_error("operator blocks need a name, password, class and host.");
MyFree(name);
MyFree(pass);
MyFree(host);
MyFree(name);
MyFree(pass);
MyFree(host);
portblock: PORT '{' portitems '}' ';'
{
if (port > 0 && port <= 0xFFFF)
portblock: PORT '{' portitems '}' ';'
{
if (port > 0 && port <= 0xFFFF)
add_listener(port, host, pass, tconn, tping);
add_listener(port, host, pass, tconn, tping);
- {
- parse_error("Bad port block");
- }
+ parse_error("Port %d is out of range", port);
MyFree(host);
MyFree(pass);
host = pass = NULL;
MyFree(host);
MyFree(pass);
host = pass = NULL;
unsigned char addrbits = 0;
if (ip && !ipmask_parse(ip, &addr, &addrbits)) {
unsigned char addrbits = 0;
if (ip && !ipmask_parse(ip, &addr, &addrbits)) {
- parse_error("Invalid IP address in block");
+ parse_error("Invalid IP address %s in block", ip);
MyFree(username);
MyFree(host);
MyFree(ip);
MyFree(username);
MyFree(host);
MyFree(ip);
MyFree(dconf->realmask);
MyFree(dconf->message);
MyFree(dconf);
MyFree(dconf->realmask);
MyFree(dconf->message);
MyFree(dconf);
- parse_error("Bad kill block");
+ parse_error("Kill block must match on at least one of username, host or realname");
tconn = CRULE_AUTO;
} '{' cruleitems '}' ';'
{
tconn = CRULE_AUTO;
} '{' cruleitems '}' ';'
{
- struct CRuleNode *node;
- if (host != NULL && pass != NULL && (node=crule_parse(pass)) != NULL)
+ struct CRuleNode *node = NULL;
+ if (host == NULL)
+ parse_error("Missing host in crule block");
+ else if (pass == NULL)
+ parse_error("Missing rule in crule block");
+ else if ((node = crule_parse(pass)) == NULL)
+ parse_error("Invalid rule '%s' in crule block", pass);
+ else
{
struct CRuleConf *p = (struct CRuleConf*) MyMalloc(sizeof(*p));
p->hostmask = host;
{
struct CRuleConf *p = (struct CRuleConf*) MyMalloc(sizeof(*p));
p->hostmask = host;
p->next = cruleConfList;
cruleConfList = p;
}
p->next = cruleConfList;
cruleConfList = p;
}
{
MyFree(host);
MyFree(pass);
{
MyFree(host);
MyFree(pass);
- parse_error("Bad CRule block");
}
host = pass = NULL;
tconn = 0;
}
host = pass = NULL;
tconn = 0;
- if (!smap->name || !smap->services)
- {
- parse_error("pseudo commands need a service name and list of target nicks.");
- return 0;
- }
- if (register_mapping(smap))
+ int valid = 0;
+
+ if (!smap->name)
+ parse_error("Missing name in pseudo %s block", smap->command);
+ else if (!smap->services)
+ parse_error("Missing nick in pseudo %s block", smap->command);
+ else
+ valid = 1;
+ if (valid && register_mapping(smap))
{
smap->next = GlobalServiceMapList;
GlobalServiceMapList = smap;
{
smap->next = GlobalServiceMapList;
GlobalServiceMapList = smap;
tping = 60;
} iauthitems '}' ';'
{
tping = 60;
} iauthitems '}' ';'
{
- if (!host || !port) {
- parse_error("IAuth block needs a server name and port.");
- return 0;
- }
- iauth_connect(host, port, pass, tconn, tping);
+ if (!host)
+ parse_error("Missing host in iauth block");
+ else if (!port)
+ parse_error("Missing port in iauth block");
+ else
+ iauth_connect(host, port, pass, tconn, tping);
MyFree(pass);
MyFree(host);
pass = host = NULL;
MyFree(pass);
MyFree(host);
pass = host = NULL;