%token USERMODE
%token IAUTH
%token TIMEOUT
-/* and now a lot of priviledges... */
+%token FAST
+/* and now a lot of privileges... */
%token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
%token TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
%token TPRIV_GLINE TPRIV_LOCAL_GLINE TPRIV_LOCAL_JUPE TPRIV_LOCAL_BADCHAN
%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
}
;
-/* this is an arithmatic expression */
+/* this is an arithmetic expression */
expr: NUMBER
{
$$ = $1;
$$ = $1 / $3;
}
/* leave this out until we find why it makes BSD yacc dump core -larne
- | '-' expr %prec NEG
- = {
+ | '-' expr %prec NEG {
$$ = -$2;
} */
| '(' expr ')' {
}
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);
- unsigned char addrbits;
- aconf->username = username;
- aconf->host = host;
- if (ip && ipmask_parse(ip, &aconf->address.addr, &addrbits))
+ struct irc_in_addr addr;
+ unsigned char addrbits = 0;
+
+ 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;
+ if (ip)
+ memcpy(&aconf->address.addr, &addr, sizeof(aconf->address.addr));
+ else
+ memset(&aconf->address.addr, 0, 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 ';'
{
killreason: REASON '=' QSTRING ';'
{
- dconf->flags &= DENY_FLAGS_FILE;
+ dconf->flags &= ~DENY_FLAGS_FILE;
MyFree(dconf->message);
DupString(dconf->message, $3);
};
{
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))
};
pseudoitems: pseudoitem pseudoitems | pseudoitem;
-pseudoitem: pseudoname | pseudoprepend | pseudonick | error;
+pseudoitem: pseudoname | pseudoprepend | pseudonick | pseudoflags | error;
pseudoname: NAME '=' QSTRING ';'
{
DupString(smap->name, $3);
smap->services = nh;
}
};
+pseudoflags: FAST ';'
+{
+ smap->flags |= SMAP_FAST;
+};
iauthblock: IAUTH '{'
{
} 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);