2 * ircd_parser.y: A yacc/bison parser for ircd config files.
3 * This is part of ircu, an Internet Relay Chat server.
4 * The contents of this file are Copyright 2001 Diane Bruce,
5 * Andrew Miller, the ircd-hybrid team and the ircu team.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
29 #include "ircd_features.h"
34 #include "ircd_alloc.h"
35 #include "ircd_chattr.h"
37 #include "ircd_reply.h"
38 #include "ircd_snprintf.h"
39 #include "ircd_string.h"
60 #include <arpa/inet.h>
62 #define MAX_STRINGS 80 /* Maximum number of feature params. */
63 #define USE_IPV4 (1 << 16)
64 #define USE_IPV6 (1 << 17)
66 extern struct LocalConf localConf;
67 extern struct DenyConf* denyConfList;
68 extern struct CRuleConf* cruleConfList;
69 extern struct ServerConf* serverConfList;
70 extern struct s_map* GlobalServiceMapList;
71 extern struct qline* GlobalQuarantineList;
74 /* Now all the globals we need :/... */
75 int tping, tconn, maxlinks, sendq, port, invert, stringno, flags;
76 char *name, *pass, *host, *ip, *username, *origin, *hub_limit;
78 char *stringlist[MAX_STRINGS];
79 struct ListenerFlags listen_flags;
80 struct ConnectionClass *c_class;
81 struct DenyConf *dconf;
82 struct ServerConf *sconf;
85 struct Privs privs_dirty;
87 static void parse_error(char *pattern,...) {
88 static char error_buffer[1024];
91 ircd_vsnprintf(NULL, error_buffer, sizeof(error_buffer), pattern, vl);
93 yyerror(error_buffer);
96 static void free_slist(struct SLink **link) {
98 while (*link != NULL) {
100 MyFree((*link)->value.cp);
108 %token <text> QSTRING
176 %token TOK_IPV4 TOK_IPV6
182 /* and now a lot of privileges... */
183 %token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
184 %token TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
185 %token TPRIV_GLINE TPRIV_LOCAL_GLINE TPRIV_LOCAL_JUPE TPRIV_LOCAL_BADCHAN
186 %token TPRIV_LOCAL_OPMODE TPRIV_OPMODE TPRIV_SET TPRIV_WHOX TPRIV_BADCHAN
187 %token TPRIV_SEE_CHAN TPRIV_SHOW_INVIS TPRIV_SHOW_ALL_INVIS TPRIV_PROPAGATE
188 %token TPRIV_UNLIMIT_QUERY TPRIV_UNLIMIT_FLOOD TPRIV_DISPLAY TPRIV_SEE_OPERS
189 %token TPRIV_WIDE_GLINE TPRIV_FORCE_OPMODE TPRIV_FORCE_LOCAL_OPMODE
190 %token TPRIV_APASS_OPMODE TPRIV_LIST_CHAN
191 /* and some types... */
193 %type <num> timespec timefactor factoredtimes factoredtime
194 %type <num> expr yesorno privtype address_family
204 /* Blocks in the config file... */
205 blocks: blocks block | block;
206 block: adminblock | generalblock | classblock | connectblock | sslblock |
207 uworldblock | operblock | portblock | jupeblock | clientblock |
208 killblock | cruleblock | motdblock | featuresblock | quarantineblock |
209 pseudoblock | iauthblock | error ';';
211 /* The timespec, sizespec and expr was ripped straight from
213 timespec: expr | factoredtimes;
215 factoredtimes: factoredtimes factoredtime
220 factoredtime: expr timefactor
225 timefactor: SECONDS { $$ = 1; }
226 | MINUTES { $$ = 60; }
227 | HOURS { $$ = 60 * 60; }
228 | DAYS { $$ = 60 * 60 * 24; }
229 | WEEKS { $$ = 60 * 60 * 24 * 7; }
230 | MONTHS { $$ = 60 * 60 * 24 * 7 * 4; }
231 | YEARS { $$ = 60 * 60 * 24 * 365; }
232 | DECADES { $$ = 60 * 60 * 24 * 365 * 10; };
245 $$ = $1 * 1024 * 1024;
248 $$ = $1 * 1024 * 1024 * 1024;
251 $$ = $1 * 1024 * 1024 * 1024;
255 /* this is an arithmetic expression */
272 /* leave this out until we find why it makes BSD yacc dump core -larne
273 | '-' expr %prec NEG {
281 jupeblock: JUPE '{' jupeitems '}' ';' ;
282 jupeitems: jupeitem jupeitems | jupeitem;
284 jupenick: NICK '=' QSTRING ';'
290 generalblock: GENERAL
292 /* Zero out the vhost addresses, in case they were removed. */
293 memset(&VirtualHost_v4.addr, 0, sizeof(VirtualHost_v4.addr));
294 memset(&VirtualHost_v6.addr, 0, sizeof(VirtualHost_v6.addr));
295 } '{' generalitems '}' ';' {
296 if (localConf.name == NULL)
297 parse_error("Your General block must contain a name.");
298 if (localConf.numeric == 0)
299 parse_error("Your General block must contain a numeric (between 1 and 4095).");
301 generalitems: generalitem generalitems | generalitem;
302 generalitem: generalnumeric | generalname | generalvhost | generaldesc
303 | generaldnsvhost | generaldnsserver;
305 generalnumeric: NUMERIC '=' NUMBER ';'
307 if (localConf.numeric == 0)
308 localConf.numeric = $3;
309 else if (localConf.numeric != $3)
310 parse_error("Redefinition of server numeric %i (%i)", $3,
314 generalname: NAME '=' QSTRING ';'
316 if (localConf.name == NULL)
319 if (strcmp(localConf.name, $3))
320 parse_error("Redefinition of server name %s (%s)", $3,
326 generaldesc: DESCRIPTION '=' QSTRING ';'
328 MyFree(localConf.description);
329 localConf.description = $3;
330 ircd_strncpy(cli_info(&me), $3, REALLEN);
333 generalvhost: VHOST '=' QSTRING ';'
335 struct irc_in_addr addr;
338 if (!strcmp(vhost, "*")) {
339 /* This traditionally meant bind to all interfaces and connect
340 * from the default. */
341 } else if (!ircd_aton(&addr, vhost))
342 parse_error("Invalid virtual host '%s'.", vhost);
343 else if (irc_in_addr_is_ipv4(&addr))
344 memcpy(&VirtualHost_v4.addr, &addr, sizeof(addr));
346 memcpy(&VirtualHost_v6.addr, &addr, sizeof(addr));
350 generaldnsvhost: DNS VHOST '=' address_family QSTRING ';'
352 struct irc_in_addr addr;
356 if (!strcmp(vhost, "*")) {
357 /* Let the operating system assign the default. */
358 } else if (!ircd_aton(&addr, vhost))
359 parse_error("Invalid DNS virtual host '%s'.", vhost);
362 if ((families & USE_IPV4)
363 || (!families && irc_in_addr_is_ipv4(&addr)))
364 memcpy(&VirtualHost_dns_v4.addr, &addr, sizeof(addr));
365 if ((families & USE_IPV6)
366 || (!families && !irc_in_addr_is_ipv4(&addr)))
367 memcpy(&VirtualHost_dns_v6.addr, &addr, sizeof(addr));
372 generaldnsserver: DNS SERVER '=' QSTRING ';'
376 add_nameserver(server);
382 MyFree(localConf.location1);
383 MyFree(localConf.location2);
384 MyFree(localConf.contact);
385 localConf.location1 = localConf.location2 = localConf.contact = NULL;
387 '{' adminitems '}' ';'
389 if (localConf.location1 == NULL)
390 DupString(localConf.location1, "");
391 if (localConf.location2 == NULL)
392 DupString(localConf.location2, "");
393 if (localConf.contact == NULL)
394 DupString(localConf.contact, "");
396 adminitems: adminitems adminitem | adminitem;
397 adminitem: adminlocation | admincontact;
398 adminlocation: LOCATION '=' QSTRING ';'
400 if (localConf.location1 == NULL)
401 localConf.location1 = $3;
402 else if (localConf.location2 == NULL)
403 localConf.location2 = $3;
404 else /* Otherwise just drop it. -A1kmm */
407 admincontact: CONTACT '=' QSTRING ';'
409 MyFree(localConf.contact);
410 localConf.contact = $3;
415 MyFree(localConf.sslcertfile);
416 MyFree(localConf.sslkeyfile);
417 MyFree(localConf.sslcafile);
418 localConf.sslcertfile = localConf.sslkeyfile = localConf.sslcafile = NULL;
422 if (localConf.sslcertfile == NULL)
423 DupString(localConf.sslcertfile, "");
424 if (localConf.sslkeyfile == NULL)
425 DupString(localConf.sslkeyfile, "");
426 if (localConf.sslcafile == NULL)
427 DupString(localConf.sslcafile, "");
429 sslitems: sslitems sslitem | sslitem;
430 sslitem: sslcertfile | sslkeyfile | sslcafile;
431 sslcertfile: CERTFILE '=' QSTRING ';'
433 MyFree(localConf.sslcertfile);
434 localConf.sslcertfile = $3;
436 sslkeyfile: KEYFILE '=' QSTRING ';'
438 MyFree(localConf.sslkeyfile);
439 localConf.sslkeyfile = $3;
441 sslcafile: CAFILE '=' QSTRING ';'
443 MyFree(localConf.sslcafile);
444 localConf.sslcafile = $3;
449 } '{' classitems '}' ';'
453 struct ConnectionClass *c_class;
454 add_class(name, tping, tconn, maxlinks, sendq);
455 c_class = find_class(name);
456 MyFree(c_class->default_umode);
457 c_class->default_umode = pass;
458 memcpy(&c_class->privs, &privs, sizeof(c_class->privs));
459 memcpy(&c_class->privs_dirty, &privs_dirty, sizeof(c_class->privs_dirty));
462 parse_error("Missing name in class block");
469 memset(&privs, 0, sizeof(privs));
470 memset(&privs_dirty, 0, sizeof(privs_dirty));
472 classitems: classitem classitems | classitem;
473 classitem: classname | classpingfreq | classconnfreq | classmaxlinks |
474 classsendq | classusermode | priv;
475 classname: NAME '=' QSTRING ';'
480 classpingfreq: PINGFREQ '=' timespec ';'
484 classconnfreq: CONNECTFREQ '=' timespec ';'
488 classmaxlinks: MAXLINKS '=' expr ';'
492 classsendq: SENDQ '=' sizespec ';'
496 classusermode: USERMODE '=' QSTRING ';'
502 connectblock: CONNECT
504 flags = CONF_AUTOCONNECT;
505 } '{' connectitems '}' ';'
507 struct ConfItem *aconf = NULL;
509 parse_error("Missing name in connect block");
510 else if (pass == NULL)
511 parse_error("Missing password in connect block");
512 else if (strlen(pass) > PASSWDLEN)
513 parse_error("Password too long in connect block");
514 else if (host == NULL)
515 parse_error("Missing host in connect block");
516 else if (strchr(host, '*') || strchr(host, '?'))
517 parse_error("Invalid host '%s' in connect block", host);
518 else if (c_class == NULL)
519 parse_error("Missing or non-existent class in connect block");
521 aconf = make_conf(CONF_SERVER);
523 aconf->origin_name = origin;
524 aconf->passwd = pass;
525 aconf->conn_class = c_class;
526 aconf->address.port = port;
528 /* If the user specified a hub allowance, but not maximum links,
529 * allow an effectively unlimited number of hops.
531 aconf->maximum = (hub_limit != NULL && maxlinks == 0) ? 65535 : maxlinks;
532 aconf->hub_limit = hub_limit;
533 aconf->flags = flags;
534 lookup_confhost(aconf);
543 name = pass = host = origin = hub_limit = NULL;
545 port = flags = maxlinks = 0;
547 connectitems: connectitem connectitems | connectitem;
548 connectitem: connectname | connectpass | connectclass | connecthost
549 | connectport | connectvhost | connectleaf | connecthub
550 | connecthublimit | connectmaxhops | connectauto;
551 connectname: NAME '=' QSTRING ';'
556 connectpass: PASS '=' QSTRING ';'
561 connectclass: CLASS '=' QSTRING ';'
563 c_class = find_class($3);
565 parse_error("No such connection class '%s' for Connect block", $3);
568 connecthost: HOST '=' QSTRING ';'
573 connectport: PORT '=' NUMBER ';'
577 connectvhost: VHOST '=' QSTRING ';'
582 connectleaf: LEAF ';'
589 DupString(hub_limit, "*");
591 connecthublimit: HUB '=' QSTRING ';'
596 connectmaxhops: MAXHOPS '=' expr ';'
600 connectauto: AUTOCONNECT '=' YES ';' { flags |= CONF_AUTOCONNECT; }
601 | AUTOCONNECT '=' NO ';' { flags &= ~CONF_AUTOCONNECT; };
603 uworldblock: UWORLD '{' uworlditems '}' ';';
604 uworlditems: uworlditem uworlditems | uworlditem;
605 uworlditem: uworldname;
606 uworldname: NAME '=' QSTRING ';'
608 make_conf(CONF_UWORLD)->host = $3;
611 operblock: OPER '{' operitems '}' ';'
613 struct ConfItem *aconf = NULL;
617 parse_error("Missing name in operator block");
618 else if (pass == NULL)
619 parse_error("Missing password in operator block");
620 /* Do not check password length because it may be crypted. */
621 else if (hosts == NULL)
622 parse_error("Missing host(s) in operator block");
623 else if (c_class == NULL)
624 parse_error("Invalid or missing class in operator block");
625 else if (!FlagHas(&privs_dirty, PRIV_PROPAGATE)
626 && !FlagHas(&c_class->privs_dirty, PRIV_PROPAGATE))
627 parse_error("Operator block for %s and class %s have no LOCAL setting", name, c_class->cc_name);
628 else for (link = hosts; link != NULL; link = link->next) {
629 aconf = make_conf(CONF_OPERATOR);
630 DupString(aconf->name, name);
631 DupString(aconf->passwd, pass);
632 conf_parse_userhost(aconf, link->value.cp);
633 aconf->conn_class = c_class;
634 memcpy(&aconf->privs, &privs, sizeof(aconf->privs));
635 memcpy(&aconf->privs_dirty, &privs_dirty, sizeof(aconf->privs_dirty));
642 memset(&privs, 0, sizeof(privs));
643 memset(&privs_dirty, 0, sizeof(privs_dirty));
645 operitems: operitem | operitems operitem;
646 operitem: opername | operpass | operhost | operclass | priv;
647 opername: NAME '=' QSTRING ';'
652 operpass: PASS '=' QSTRING ';'
657 operhost: HOST '=' QSTRING ';'
661 if (!strchr($3, '@'))
664 link->value.cp = (char*) MyMalloc((uh_len = strlen($3)+3));
665 ircd_snprintf(0, link->value.cp, uh_len, "*@%s", $3);
668 DupString(link->value.cp, $3);
673 operclass: CLASS '=' QSTRING ';'
675 c_class = find_class($3);
677 parse_error("No such connection class '%s' for Operator block", $3);
681 priv: privtype '=' yesorno ';'
683 FlagSet(&privs_dirty, $1);
684 if (($3 == 1) ^ invert)
691 privtype: TPRIV_CHAN_LIMIT { $$ = PRIV_CHAN_LIMIT; } |
692 TPRIV_MODE_LCHAN { $$ = PRIV_MODE_LCHAN; } |
693 TPRIV_DEOP_LCHAN { $$ = PRIV_DEOP_LCHAN; } |
694 TPRIV_WALK_LCHAN { $$ = PRIV_WALK_LCHAN; } |
695 KILL { $$ = PRIV_KILL; } |
696 TPRIV_LOCAL_KILL { $$ = PRIV_LOCAL_KILL; } |
697 TPRIV_REHASH { $$ = PRIV_REHASH; } |
698 TPRIV_RESTART { $$ = PRIV_RESTART; } |
699 TPRIV_DIE { $$ = PRIV_DIE; } |
700 TPRIV_GLINE { $$ = PRIV_GLINE; } |
701 TPRIV_LOCAL_GLINE { $$ = PRIV_LOCAL_GLINE; } |
702 JUPE { $$ = PRIV_JUPE; } |
703 TPRIV_LOCAL_JUPE { $$ = PRIV_LOCAL_JUPE; } |
704 TPRIV_LOCAL_OPMODE { $$ = PRIV_LOCAL_OPMODE; } |
705 TPRIV_OPMODE { $$ = PRIV_OPMODE; }|
706 TPRIV_SET { $$ = PRIV_SET; } |
707 TPRIV_WHOX { $$ = PRIV_WHOX; } |
708 TPRIV_BADCHAN { $$ = PRIV_BADCHAN; } |
709 TPRIV_LOCAL_BADCHAN { $$ = PRIV_LOCAL_BADCHAN; } |
710 TPRIV_SEE_CHAN { $$ = PRIV_SEE_CHAN; } |
711 TPRIV_SHOW_INVIS { $$ = PRIV_SHOW_INVIS; } |
712 TPRIV_SHOW_ALL_INVIS { $$ = PRIV_SHOW_ALL_INVIS; } |
713 TPRIV_PROPAGATE { $$ = PRIV_PROPAGATE; } |
714 TPRIV_UNLIMIT_QUERY { $$ = PRIV_UNLIMIT_QUERY; } |
715 TPRIV_UNLIMIT_FLOOD { $$ = PRIV_UNLIMIT_FLOOD; } |
716 TPRIV_DISPLAY { $$ = PRIV_DISPLAY; } |
717 TPRIV_SEE_OPERS { $$ = PRIV_SEE_OPERS; } |
718 TPRIV_WIDE_GLINE { $$ = PRIV_WIDE_GLINE; } |
719 TPRIV_LIST_CHAN { $$ = PRIV_LIST_CHAN; } |
720 LOCAL { $$ = PRIV_PROPAGATE; invert = 1; } |
721 TPRIV_FORCE_OPMODE { $$ = PRIV_FORCE_OPMODE; } |
722 TPRIV_FORCE_LOCAL_OPMODE { $$ = PRIV_FORCE_LOCAL_OPMODE; } |
723 TPRIV_APASS_OPMODE { $$ = PRIV_APASS_OPMODE; } ;
725 yesorno: YES { $$ = 1; } | NO { $$ = 0; };
727 /* not a recursive definition because some pedant will just come along
728 * and whine that the parser accepts "ipv4 ipv4 ipv4 ipv4"
732 | TOK_IPV4 { $$ = USE_IPV4; }
733 | TOK_IPV6 { $$ = USE_IPV6; }
734 | TOK_IPV4 TOK_IPV6 { $$ = USE_IPV4 | USE_IPV6; }
735 | TOK_IPV6 TOK_IPV4 { $$ = USE_IPV6 | USE_IPV4; }
738 /* The port block... */
739 portblock: PORT '{' portitems '}' ';' {
740 struct ListenerFlags flags_here;
745 DupString(link->value.cp, "*");
750 for (link = hosts; link != NULL; link = link->next) {
751 memcpy(&flags_here, &listen_flags, sizeof(flags_here));
752 switch (link->flags & (USE_IPV4 | USE_IPV6)) {
754 FlagSet(&flags_here, LISTEN_IPV4);
757 FlagSet(&flags_here, LISTEN_IPV6);
759 default: /* 0 or USE_IPV4|USE_IPV6 */
760 FlagSet(&flags_here, LISTEN_IPV4);
761 FlagSet(&flags_here, LISTEN_IPV6);
765 if (link->flags & 65535)
766 port = link->flags & 65535;
767 add_listener(port, link->value.cp, pass, &flags_here);
771 memset(&listen_flags, 0, sizeof(listen_flags));
775 portitems: portitem portitems | portitem;
776 portitem: portnumber | portvhost | portvhostnumber | portmask | portserver | portssl | porthidden;
777 portnumber: PORT '=' address_family NUMBER ';'
779 if ($4 < 1 || $4 > 65535) {
780 parse_error("Port %d is out of range", port);
783 if (hosts && (0 == (hosts->flags & 65535)))
784 hosts->flags = (hosts->flags & ~65535) | port;
788 portvhost: VHOST '=' address_family QSTRING ';'
793 link->flags = $3 | port;
798 portvhostnumber: VHOST '=' address_family QSTRING NUMBER ';'
800 if ($5 < 1 || $5 > 65535) {
801 parse_error("Port %d is out of range", port);
806 link->flags = $3 | $5;
812 portmask: MASK '=' QSTRING ';'
818 portserver: SERVER '=' YES ';'
820 FlagSet(&listen_flags, LISTEN_SERVER);
821 } | SERVER '=' NO ';'
823 FlagClr(&listen_flags, LISTEN_SERVER);
826 portssl: SSL '=' YES ';'
828 FlagSet(&listen_flags, LISTEN_SSL);
831 FlagClr(&listen_flags, LISTEN_SSL);
834 porthidden: HIDDEN '=' YES ';'
836 FlagSet(&listen_flags, LISTEN_HIDDEN);
837 } | HIDDEN '=' NO ';'
839 FlagClr(&listen_flags, LISTEN_HIDDEN);
847 '{' clientitems '}' ';'
849 struct ConfItem *aconf = 0;
850 struct irc_in_addr addr;
851 unsigned char addrbits = 0;
854 parse_error("Invalid or missing class in Client block");
855 else if (pass && strlen(pass) > PASSWDLEN)
856 parse_error("Password too long in connect block");
857 else if (ip && !ipmask_parse(ip, &addr, &addrbits))
858 parse_error("Invalid IP address %s in Client block", ip);
860 aconf = make_conf(CONF_CLIENT);
861 aconf->username = username;
864 memcpy(&aconf->address.addr, &addr, sizeof(aconf->address.addr));
866 memset(&aconf->address.addr, 0, sizeof(aconf->address.addr));
867 aconf->address.port = port;
868 aconf->addrbits = addrbits;
870 aconf->conn_class = c_class;
871 aconf->maximum = maxlinks;
872 aconf->passwd = pass;
888 clientitems: clientitem clientitems | clientitem;
889 clientitem: clienthost | clientip | clientusername | clientclass | clientpass | clientmaxlinks | clientport;
890 clienthost: HOST '=' QSTRING ';'
892 char *sep = strchr($3, '@');
897 DupString(host, sep);
903 clientip: IP '=' QSTRING ';'
906 sep = strchr($3, '@');
917 clientusername: USERNAME '=' QSTRING ';'
922 clientclass: CLASS '=' QSTRING ';'
924 c_class = find_class($3);
926 parse_error("No such connection class '%s' for Client block", $3);
929 clientpass: PASS '=' QSTRING ';'
934 clientmaxlinks: MAXLINKS '=' expr ';'
938 clientport: PORT '=' expr ';'
945 dconf = (struct DenyConf*) MyCalloc(1, sizeof(*dconf));
946 } '{' killitems '}' ';'
948 if (dconf->usermask || dconf->hostmask ||dconf->realmask) {
949 dconf->next = denyConfList;
950 denyConfList = dconf;
954 MyFree(dconf->usermask);
955 MyFree(dconf->hostmask);
956 MyFree(dconf->realmask);
957 MyFree(dconf->message);
959 parse_error("Kill block must match on at least one of username, host or realname");
963 killitems: killitem killitems | killitem;
964 killitem: killuhost | killreal | killusername | killreasonfile | killreason;
965 killuhost: HOST '=' QSTRING ';'
968 MyFree(dconf->hostmask);
969 MyFree(dconf->usermask);
970 if ((h = strchr($3, '@')) == NULL)
972 DupString(dconf->usermask, "*");
973 dconf->hostmask = $3;
978 DupString(dconf->hostmask, h);
979 dconf->usermask = $3;
981 ipmask_parse(dconf->hostmask, &dconf->address, &dconf->bits);
984 killusername: USERNAME '=' QSTRING ';'
986 MyFree(dconf->usermask);
987 dconf->usermask = $3;
990 killreal: REAL '=' QSTRING ';'
992 MyFree(dconf->realmask);
993 dconf->realmask = $3;
996 killreason: REASON '=' QSTRING ';'
998 dconf->flags &= ~DENY_FLAGS_FILE;
999 MyFree(dconf->message);
1000 dconf->message = $3;
1003 killreasonfile: TFILE '=' QSTRING ';'
1005 dconf->flags |= DENY_FLAGS_FILE;
1006 MyFree(dconf->message);
1007 dconf->message = $3;
1013 } '{' cruleitems '}' ';'
1015 struct CRuleNode *node = NULL;
1019 parse_error("Missing server(s) in crule block");
1020 else if (pass == NULL)
1021 parse_error("Missing rule in crule block");
1022 else if ((node = crule_parse(pass)) == NULL)
1023 parse_error("Invalid rule '%s' in crule block", pass);
1024 else for (link = hosts; link != NULL; link = link->next)
1026 struct CRuleConf *p = (struct CRuleConf*) MyMalloc(sizeof(*p));
1028 node = crule_parse(pass);
1029 DupString(p->hostmask, link->value.cp);
1030 DupString(p->rule, pass);
1034 p->next = cruleConfList;
1043 cruleitems: cruleitem cruleitems | cruleitem;
1044 cruleitem: cruleserver | crulerule | cruleall;
1046 cruleserver: SERVER '=' QSTRING ';'
1050 link->value.cp = $3;
1055 crulerule: RULE '=' QSTRING ';'
1061 cruleall: ALL '=' YES ';'
1069 motdblock: MOTD '{' motditems '}' ';'
1073 for (link = hosts; link != NULL; link = link->next)
1074 motd_add(link->value.cp, pass);
1080 motditems: motditem motditems | motditem;
1081 motditem: motdhost | motdfile;
1082 motdhost: HOST '=' QSTRING ';'
1086 link->value.cp = $3;
1091 motdfile: TFILE '=' QSTRING ';'
1097 featuresblock: FEATURES '{' featureitems '}' ';';
1098 featureitems: featureitems featureitem | featureitem;
1100 featureitem: QSTRING
1104 } '=' stringlist ';' {
1106 feature_set(NULL, (const char * const *)stringlist, stringno);
1107 for (ii = 0; ii < stringno; ++ii)
1108 MyFree(stringlist[ii]);
1111 stringlist: stringlist extrastring | extrastring;
1112 extrastring: QSTRING
1114 if (stringno < MAX_STRINGS)
1115 stringlist[stringno++] = $1;
1120 quarantineblock: QUARANTINE '{' quarantineitems '}' ';';
1121 quarantineitems: quarantineitems quarantineitem | quarantineitem;
1122 quarantineitem: QSTRING '=' QSTRING ';'
1124 struct qline *qconf = MyCalloc(1, sizeof(*qconf));
1127 qconf->next = GlobalQuarantineList;
1128 GlobalQuarantineList = qconf;
1131 pseudoblock: PSEUDO QSTRING '{'
1133 smap = MyCalloc(1, sizeof(struct s_map));
1141 parse_error("Missing name in pseudo %s block", smap->command);
1142 else if (!smap->services)
1143 parse_error("Missing nick in pseudo %s block", smap->command);
1144 else if (!strIsAlpha(smap->command))
1145 parse_error("Pseudo command %s invalid: must all be letters", smap->command);
1148 if (valid && register_mapping(smap))
1150 smap->next = GlobalServiceMapList;
1151 GlobalServiceMapList = smap;
1160 pseudoitems: pseudoitem pseudoitems | pseudoitem;
1161 pseudoitem: pseudoname | pseudoprepend | pseudonick | pseudoflags;
1162 pseudoname: NAME '=' QSTRING ';'
1167 pseudoprepend: PREPEND '=' QSTRING ';'
1169 MyFree(smap->prepend);
1172 pseudonick: NICK '=' QSTRING ';'
1174 char *sep = strchr($3, '@');
1177 size_t slen = strlen($3);
1178 struct nick_host *nh = MyMalloc(sizeof(*nh) + slen);
1179 memcpy(nh->nick, $3, slen + 1);
1180 nh->nicklen = sep - $3;
1181 nh->next = smap->services;
1182 smap->services = nh;
1186 pseudoflags: FAST ';'
1188 smap->flags |= SMAP_FAST;
1191 iauthblock: IAUTH '{' iauthitems '}' ';'
1193 auth_spawn(stringno, stringlist);
1194 while (stringno > 0)
1197 MyFree(stringlist[stringno]);
1201 iauthitems: iauthitem iauthitems | iauthitem;
1202 iauthitem: iauthprogram;
1203 iauthprogram: PROGRAM '='
1205 while (stringno > 0)
1208 MyFree(stringlist[stringno]);