%token TPRIV_LOCAL_OPMODE TPRIV_OPMODE TPRIV_SET TPRIV_WHOX TPRIV_BADCHAN
%token TPRIV_SEE_CHAN TPRIV_SHOW_INVIS TPRIV_SHOW_ALL_INVIS TPRIV_PROPAGATE
%token TPRIV_UNLIMIT_QUERY TPRIV_DISPLAY TPRIV_SEE_OPERS TPRIV_WIDE_GLINE
-%token TPRIV_FORCE_OPMODE TPRIV_FORCE_LOCAL_OPMODE
+%token TPRIV_FORCE_OPMODE TPRIV_FORCE_LOCAL_OPMODE TPRIV_APASS_OPMODE
/* and some types... */
%type <num> sizespec
%type <num> timespec timefactor factoredtimes factoredtime
connectmaxhops: MAXHOPS '=' expr ';'
{
maxlinks = $3;
-}
+};
uworldblock: UWORLD '{' uworlditems '}' ';'
{
}
else
{
- log_write(LS_CONFIG, L_ERROR, 0, "operator blocks need a name, password, and host.");
+ parse_error("operator blocks need a name, password, class and host.");
MyFree(name);
MyFree(pass);
MyFree(host);
TPRIV_SET { $$ = PRIV_SET; } |
TPRIV_WHOX { $$ = PRIV_WHOX; } |
TPRIV_BADCHAN { $$ = PRIV_BADCHAN; } |
- TPRIV_LOCAL_BADCHAN { $$ = TPRIV_LOCAL_BADCHAN; } |
+ TPRIV_LOCAL_BADCHAN { $$ = PRIV_LOCAL_BADCHAN; } |
TPRIV_SEE_CHAN { $$ = PRIV_SEE_CHAN; } |
TPRIV_SHOW_INVIS { $$ = PRIV_SHOW_INVIS; } |
TPRIV_SHOW_ALL_INVIS { $$ = PRIV_SHOW_ALL_INVIS; } |
TPRIV_WIDE_GLINE { $$ = PRIV_WIDE_GLINE; } |
LOCAL { $$ = PRIV_PROPAGATE; invert = 1; } |
TPRIV_FORCE_OPMODE { $$ = PRIV_FORCE_OPMODE; } |
- TPRIV_FORCE_LOCAL_OPMODE { $$ = PRIV_FORCE_LOCAL_OPMODE; };
+ TPRIV_FORCE_LOCAL_OPMODE { $$ = PRIV_FORCE_LOCAL_OPMODE; } |
+ TPRIV_APASS_OPMODE { $$ = PRIV_APASS_OPMODE; } ;
yesorno: YES { $$ = 1; } | NO { $$ = 0; };
}
'{' clientitems '}' ';'
{
- struct ConfItem *aconf = make_conf(CONF_CLIENT);
+ struct irc_in_addr addr;
unsigned char addrbits;
- 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;
- else
- aconf->addrbits = -1;
- aconf->conn_class = c_class ? c_class : find_class("default");
- aconf->maximum = maxlinks;
+ aconf->name = ip;
+ 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 ';'
{
MyFree(username);
DupString(username, $3);
-}
+};
clientclass: CLASS '=' QSTRING ';'
{
c_class = find_class($3);
killreason: REASON '=' QSTRING ';'
{
- dconf->flags &= DENY_FLAGS_FILE;
+ dconf->flags &= ~DENY_FLAGS_FILE;
MyFree(dconf->message);
DupString(dconf->message, $3);
};
parse_error("Bad CRule block");
}
host = pass = NULL;
+ tconn = 0;
};
cruleitems: cruleitem cruleitems | cruleitem;
{
if (qconf->chname == NULL || qconf->reason == NULL)
{
- log_write(LS_CONFIG, L_ERROR, 0, "quarantine blocks need a channel name "
- "and a reason.");
+ parse_error("quarantine blocks need a channel name and a reason.");
return 0;
}
qconf->next = GlobalQuarantineList;
{
if (!smap->name || !smap->services)
{
- log_write(LS_CONFIG, L_ERROR, 0, "pseudo commands need a service name and list of target nicks.");
+ parse_error("pseudo commands need a service name and list of target nicks.");
return 0;
}
if (register_mapping(smap))
} iauthitems '}' ';'
{
if (!host || !port) {
- log_write(LS_CONFIG, L_ERROR, 0, "IAuth block needs a server name and port.");
+ parse_error("IAuth block needs a server name and port.");
return 0;
}
iauth_connect(host, port, pass, tconn, tping);
MyFree(pass);
MyFree(host);
pass = host = NULL;
- port = 0;
+ port = tconn = tping = 0;
};
iauthitems: iauthitem iauthitems | iauthitem;