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
178 /* and now a lot of privileges... */
179 %token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
180 %token TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
181 %token TPRIV_GLINE TPRIV_LOCAL_GLINE TPRIV_LOCAL_JUPE TPRIV_LOCAL_BADCHAN
182 %token TPRIV_LOCAL_OPMODE TPRIV_OPMODE TPRIV_SET TPRIV_WHOX TPRIV_BADCHAN
183 %token TPRIV_SEE_CHAN TPRIV_SHOW_INVIS TPRIV_SHOW_ALL_INVIS TPRIV_PROPAGATE
184 %token TPRIV_UNLIMIT_QUERY TPRIV_DISPLAY TPRIV_SEE_OPERS TPRIV_WIDE_GLINE
185 %token TPRIV_FORCE_OPMODE TPRIV_FORCE_LOCAL_OPMODE TPRIV_APASS_OPMODE
186 %token TPRIV_LIST_CHAN
187 /* and some types... */
189 %type <num> timespec timefactor factoredtimes factoredtime
190 %type <num> expr yesorno privtype address_family
200 /* Blocks in the config file... */
201 blocks: blocks block | block;
202 block: adminblock | generalblock | classblock | connectblock |
203 uworldblock | operblock | portblock | jupeblock | clientblock |
204 killblock | cruleblock | motdblock | featuresblock | quarantineblock |
205 pseudoblock | iauthblock | error ';';
207 /* The timespec, sizespec and expr was ripped straight from
209 timespec: expr | factoredtimes;
211 factoredtimes: factoredtimes factoredtime
216 factoredtime: expr timefactor
221 timefactor: SECONDS { $$ = 1; }
222 | MINUTES { $$ = 60; }
223 | HOURS { $$ = 60 * 60; }
224 | DAYS { $$ = 60 * 60 * 24; }
225 | WEEKS { $$ = 60 * 60 * 24 * 7; }
226 | MONTHS { $$ = 60 * 60 * 24 * 7 * 4; }
227 | YEARS { $$ = 60 * 60 * 24 * 365; }
228 | DECADES { $$ = 60 * 60 * 24 * 365 * 10; };
241 $$ = $1 * 1024 * 1024;
244 $$ = $1 * 1024 * 1024 * 1024;
247 $$ = $1 * 1024 * 1024 * 1024;
251 /* this is an arithmetic expression */
268 /* leave this out until we find why it makes BSD yacc dump core -larne
269 | '-' expr %prec NEG {
277 jupeblock: JUPE '{' jupeitems '}' ';' ;
278 jupeitems: jupeitem jupeitems | jupeitem;
280 jupenick: NICK '=' QSTRING ';'
286 generalblock: GENERAL
288 /* Zero out the vhost addresses, in case they were removed. */
289 memset(&VirtualHost_v4.addr, 0, sizeof(VirtualHost_v4.addr));
290 memset(&VirtualHost_v6.addr, 0, sizeof(VirtualHost_v6.addr));
291 } '{' generalitems '}' ';' {
292 if (localConf.name == NULL)
293 parse_error("Your General block must contain a name.");
294 if (localConf.numeric == 0)
295 parse_error("Your General block must contain a numeric (between 1 and 4095).");
297 generalitems: generalitem generalitems | generalitem;
298 generalitem: generalnumeric | generalname | generalvhost | generaldesc
299 | generaldnsvhost | generaldnsserver;
301 generalnumeric: NUMERIC '=' NUMBER ';'
303 if (localConf.numeric == 0)
304 localConf.numeric = $3;
305 else if (localConf.numeric != $3)
306 parse_error("Redefinition of server numeric %i (%i)", $3,
310 generalname: NAME '=' QSTRING ';'
312 if (localConf.name == NULL)
315 if (strcmp(localConf.name, $3))
316 parse_error("Redefinition of server name %s (%s)", $3,
322 generaldesc: DESCRIPTION '=' QSTRING ';'
324 MyFree(localConf.description);
325 localConf.description = $3;
326 ircd_strncpy(cli_info(&me), $3, REALLEN);
329 generalvhost: VHOST '=' QSTRING ';'
331 struct irc_in_addr addr;
334 if (!strcmp(vhost, "*")) {
335 /* This traditionally meant bind to all interfaces and connect
336 * from the default. */
337 } else if (!ircd_aton(&addr, vhost))
338 parse_error("Invalid virtual host '%s'.", vhost);
339 else if (irc_in_addr_is_ipv4(&addr))
340 memcpy(&VirtualHost_v4.addr, &addr, sizeof(addr));
342 memcpy(&VirtualHost_v6.addr, &addr, sizeof(addr));
346 generaldnsvhost: DNS VHOST '=' address_family QSTRING ';'
348 struct irc_in_addr addr;
352 if (!strcmp(vhost, "*")) {
353 /* Let the operating system assign the default. */
354 } else if (!ircd_aton(&addr, vhost))
355 parse_error("Invalid DNS virtual host '%s'.", vhost);
358 if ((families & USE_IPV4)
359 || (!families && irc_in_addr_is_ipv4(&addr)))
360 memcpy(&VirtualHost_dns_v4.addr, &addr, sizeof(addr));
361 if ((families & USE_IPV6)
362 || (!families && !irc_in_addr_is_ipv4(&addr)))
363 memcpy(&VirtualHost_dns_v6.addr, &addr, sizeof(addr));
368 generaldnsserver: DNS SERVER '=' QSTRING ';'
372 add_nameserver(server);
378 MyFree(localConf.location1);
379 MyFree(localConf.location2);
380 MyFree(localConf.contact);
381 localConf.location1 = localConf.location2 = localConf.contact = NULL;
383 '{' adminitems '}' ';'
385 if (localConf.location1 == NULL)
386 DupString(localConf.location1, "");
387 if (localConf.location2 == NULL)
388 DupString(localConf.location2, "");
389 if (localConf.contact == NULL)
390 DupString(localConf.contact, "");
392 adminitems: adminitems adminitem | adminitem;
393 adminitem: adminlocation | admincontact;
394 adminlocation: LOCATION '=' QSTRING ';'
396 if (localConf.location1 == NULL)
397 localConf.location1 = $3;
398 else if (localConf.location2 == NULL)
399 localConf.location2 = $3;
400 else /* Otherwise just drop it. -A1kmm */
403 admincontact: CONTACT '=' QSTRING ';'
405 MyFree(localConf.contact);
406 localConf.contact = $3;
411 } '{' classitems '}' ';'
415 struct ConnectionClass *c_class;
416 add_class(name, tping, tconn, maxlinks, sendq);
417 c_class = find_class(name);
418 MyFree(c_class->default_umode);
419 c_class->default_umode = pass;
420 memcpy(&c_class->privs, &privs, sizeof(c_class->privs));
421 memcpy(&c_class->privs_dirty, &privs_dirty, sizeof(c_class->privs_dirty));
424 parse_error("Missing name in class block");
431 memset(&privs, 0, sizeof(privs));
432 memset(&privs_dirty, 0, sizeof(privs_dirty));
434 classitems: classitem classitems | classitem;
435 classitem: classname | classpingfreq | classconnfreq | classmaxlinks |
436 classsendq | classusermode | priv;
437 classname: NAME '=' QSTRING ';'
442 classpingfreq: PINGFREQ '=' timespec ';'
446 classconnfreq: CONNECTFREQ '=' timespec ';'
450 classmaxlinks: MAXLINKS '=' expr ';'
454 classsendq: SENDQ '=' sizespec ';'
458 classusermode: USERMODE '=' QSTRING ';'
464 connectblock: CONNECT
466 flags = CONF_AUTOCONNECT;
467 } '{' connectitems '}' ';'
469 struct ConfItem *aconf = NULL;
471 parse_error("Missing name in connect block");
472 else if (pass == NULL)
473 parse_error("Missing password in connect block");
474 else if (strlen(pass) > PASSWDLEN)
475 parse_error("Password too long in connect block");
476 else if (host == NULL)
477 parse_error("Missing host in connect block");
478 else if (strchr(host, '*') || strchr(host, '?'))
479 parse_error("Invalid host '%s' in connect block", host);
480 else if (c_class == NULL)
481 parse_error("Missing or non-existent class in connect block");
483 aconf = make_conf(CONF_SERVER);
485 aconf->origin_name = origin;
486 aconf->passwd = pass;
487 aconf->conn_class = c_class;
488 aconf->address.port = port;
490 /* If the user specified a hub allowance, but not maximum links,
491 * allow an effectively unlimited number of hops.
493 aconf->maximum = (hub_limit != NULL && maxlinks == 0) ? 65535 : maxlinks;
494 aconf->hub_limit = hub_limit;
495 aconf->flags = flags;
496 lookup_confhost(aconf);
505 name = pass = host = origin = hub_limit = NULL;
507 port = flags = maxlinks = 0;
509 connectitems: connectitem connectitems | connectitem;
510 connectitem: connectname | connectpass | connectclass | connecthost
511 | connectport | connectvhost | connectleaf | connecthub
512 | connecthublimit | connectmaxhops | connectauto;
513 connectname: NAME '=' QSTRING ';'
518 connectpass: PASS '=' QSTRING ';'
523 connectclass: CLASS '=' QSTRING ';'
525 c_class = find_class($3);
527 parse_error("No such connection class '%s' for Connect block", $3);
530 connecthost: HOST '=' QSTRING ';'
535 connectport: PORT '=' NUMBER ';'
539 connectvhost: VHOST '=' QSTRING ';'
544 connectleaf: LEAF ';'
551 DupString(hub_limit, "*");
553 connecthublimit: HUB '=' QSTRING ';'
558 connectmaxhops: MAXHOPS '=' expr ';'
562 connectauto: AUTOCONNECT '=' YES ';' { flags |= CONF_AUTOCONNECT; }
563 | AUTOCONNECT '=' NO ';' { flags &= ~CONF_AUTOCONNECT; };
565 uworldblock: UWORLD '{' uworlditems '}' ';';
566 uworlditems: uworlditem uworlditems | uworlditem;
567 uworlditem: uworldname;
568 uworldname: NAME '=' QSTRING ';'
570 make_conf(CONF_UWORLD)->host = $3;
573 operblock: OPER '{' operitems '}' ';'
575 struct ConfItem *aconf = NULL;
579 parse_error("Missing name in operator block");
580 else if (pass == NULL)
581 parse_error("Missing password in operator block");
582 /* Do not check password length because it may be crypted. */
583 else if (hosts == NULL)
584 parse_error("Missing host(s) in operator block");
585 else if (c_class == NULL)
586 parse_error("Invalid or missing class in operator block");
587 else if (!FlagHas(&privs_dirty, PRIV_PROPAGATE)
588 && !FlagHas(&c_class->privs_dirty, PRIV_PROPAGATE))
589 parse_error("Operator block for %s and class %s have no LOCAL setting", name, c_class->cc_name);
590 else for (link = hosts; link != NULL; link = link->next) {
591 aconf = make_conf(CONF_OPERATOR);
592 DupString(aconf->name, name);
593 DupString(aconf->passwd, pass);
594 conf_parse_userhost(aconf, link->value.cp);
595 aconf->conn_class = c_class;
596 memcpy(&aconf->privs, &privs, sizeof(aconf->privs));
597 memcpy(&aconf->privs_dirty, &privs_dirty, sizeof(aconf->privs_dirty));
604 memset(&privs, 0, sizeof(privs));
605 memset(&privs_dirty, 0, sizeof(privs_dirty));
607 operitems: operitem | operitems operitem;
608 operitem: opername | operpass | operhost | operclass | priv;
609 opername: NAME '=' QSTRING ';'
614 operpass: PASS '=' QSTRING ';'
619 operhost: HOST '=' QSTRING ';'
623 if (!strchr($3, '@'))
626 link->value.cp = (char*) MyMalloc((uh_len = strlen($3)+3));
627 ircd_snprintf(0, link->value.cp, uh_len, "*@%s", $3);
630 DupString(link->value.cp, $3);
635 operclass: CLASS '=' QSTRING ';'
637 c_class = find_class($3);
639 parse_error("No such connection class '%s' for Operator block", $3);
643 priv: privtype '=' yesorno ';'
645 FlagSet(&privs_dirty, $1);
646 if (($3 == 1) ^ invert)
653 privtype: TPRIV_CHAN_LIMIT { $$ = PRIV_CHAN_LIMIT; } |
654 TPRIV_MODE_LCHAN { $$ = PRIV_MODE_LCHAN; } |
655 TPRIV_DEOP_LCHAN { $$ = PRIV_DEOP_LCHAN; } |
656 TPRIV_WALK_LCHAN { $$ = PRIV_WALK_LCHAN; } |
657 KILL { $$ = PRIV_KILL; } |
658 TPRIV_LOCAL_KILL { $$ = PRIV_LOCAL_KILL; } |
659 TPRIV_REHASH { $$ = PRIV_REHASH; } |
660 TPRIV_RESTART { $$ = PRIV_RESTART; } |
661 TPRIV_DIE { $$ = PRIV_DIE; } |
662 TPRIV_GLINE { $$ = PRIV_GLINE; } |
663 TPRIV_LOCAL_GLINE { $$ = PRIV_LOCAL_GLINE; } |
664 JUPE { $$ = PRIV_JUPE; } |
665 TPRIV_LOCAL_JUPE { $$ = PRIV_LOCAL_JUPE; } |
666 TPRIV_LOCAL_OPMODE { $$ = PRIV_LOCAL_OPMODE; } |
667 TPRIV_OPMODE { $$ = PRIV_OPMODE; }|
668 TPRIV_SET { $$ = PRIV_SET; } |
669 TPRIV_WHOX { $$ = PRIV_WHOX; } |
670 TPRIV_BADCHAN { $$ = PRIV_BADCHAN; } |
671 TPRIV_LOCAL_BADCHAN { $$ = PRIV_LOCAL_BADCHAN; } |
672 TPRIV_SEE_CHAN { $$ = PRIV_SEE_CHAN; } |
673 TPRIV_SHOW_INVIS { $$ = PRIV_SHOW_INVIS; } |
674 TPRIV_SHOW_ALL_INVIS { $$ = PRIV_SHOW_ALL_INVIS; } |
675 TPRIV_PROPAGATE { $$ = PRIV_PROPAGATE; } |
676 TPRIV_UNLIMIT_QUERY { $$ = PRIV_UNLIMIT_QUERY; } |
677 TPRIV_DISPLAY { $$ = PRIV_DISPLAY; } |
678 TPRIV_SEE_OPERS { $$ = PRIV_SEE_OPERS; } |
679 TPRIV_WIDE_GLINE { $$ = PRIV_WIDE_GLINE; } |
680 TPRIV_LIST_CHAN { $$ = PRIV_LIST_CHAN; } |
681 LOCAL { $$ = PRIV_PROPAGATE; invert = 1; } |
682 TPRIV_FORCE_OPMODE { $$ = PRIV_FORCE_OPMODE; } |
683 TPRIV_FORCE_LOCAL_OPMODE { $$ = PRIV_FORCE_LOCAL_OPMODE; } |
684 TPRIV_APASS_OPMODE { $$ = PRIV_APASS_OPMODE; } ;
686 yesorno: YES { $$ = 1; } | NO { $$ = 0; };
688 /* not a recursive definition because some pedant will just come along
689 * and whine that the parser accepts "ipv4 ipv4 ipv4 ipv4"
693 | TOK_IPV4 { $$ = USE_IPV4; }
694 | TOK_IPV6 { $$ = USE_IPV6; }
695 | TOK_IPV4 TOK_IPV6 { $$ = USE_IPV4 | USE_IPV6; }
696 | TOK_IPV6 TOK_IPV4 { $$ = USE_IPV6 | USE_IPV4; }
699 /* The port block... */
700 portblock: PORT '{' portitems '}' ';' {
701 struct ListenerFlags flags_here;
706 DupString(link->value.cp, "*");
711 for (link = hosts; link != NULL; link = link->next) {
712 memcpy(&flags_here, &listen_flags, sizeof(&flags_here));
713 switch (link->flags & (USE_IPV4 | USE_IPV6)) {
715 FlagSet(&flags_here, LISTEN_IPV4);
718 FlagSet(&flags_here, LISTEN_IPV6);
720 default: /* 0 or USE_IPV4|USE_IPV6 */
721 FlagSet(&flags_here, LISTEN_IPV4);
722 FlagSet(&flags_here, LISTEN_IPV6);
725 if (link->flags & 65535)
726 port = link->flags & 65535;
727 add_listener(port, link->value.cp, pass, &flags_here);
731 memset(&listen_flags, 0, sizeof(listen_flags));
735 portitems: portitem portitems | portitem;
736 portitem: portnumber | portvhost | portvhostnumber | portmask | portserver | porthidden;
737 portnumber: PORT '=' address_family NUMBER ';'
739 if ($4 < 1 || $4 > 65535) {
740 parse_error("Port %d is out of range", port);
743 if (hosts && (0 == (hosts->flags & 65535)))
744 hosts->flags = (hosts->flags & ~65535) | port;
748 portvhost: VHOST '=' address_family QSTRING ';'
753 link->flags = $3 | port;
758 portvhostnumber: VHOST '=' address_family QSTRING NUMBER ';'
760 if ($5 < 1 || $5 > 65535) {
761 parse_error("Port %d is out of range", port);
766 link->flags = $3 | $5;
772 portmask: MASK '=' QSTRING ';'
778 portserver: SERVER '=' YES ';'
780 FlagSet(&listen_flags, LISTEN_SERVER);
781 } | SERVER '=' NO ';'
783 FlagClr(&listen_flags, LISTEN_SERVER);
786 porthidden: HIDDEN '=' YES ';'
788 FlagSet(&listen_flags, LISTEN_HIDDEN);
789 } | HIDDEN '=' NO ';'
791 FlagClr(&listen_flags, LISTEN_HIDDEN);
799 '{' clientitems '}' ';'
801 struct ConfItem *aconf = 0;
802 struct irc_in_addr addr;
803 unsigned char addrbits = 0;
806 parse_error("Invalid or missing class in Client block");
807 else if (pass && strlen(pass) > PASSWDLEN)
808 parse_error("Password too long in connect block");
809 else if (ip && !ipmask_parse(ip, &addr, &addrbits))
810 parse_error("Invalid IP address %s in Client block", ip);
812 aconf = make_conf(CONF_CLIENT);
813 aconf->username = username;
816 memcpy(&aconf->address.addr, &addr, sizeof(aconf->address.addr));
818 memset(&aconf->address.addr, 0, sizeof(aconf->address.addr));
819 aconf->address.port = port;
820 aconf->addrbits = addrbits;
822 aconf->conn_class = c_class;
823 aconf->maximum = maxlinks;
824 aconf->passwd = pass;
840 clientitems: clientitem clientitems | clientitem;
841 clientitem: clienthost | clientip | clientusername | clientclass | clientpass | clientmaxlinks | clientport;
842 clienthost: HOST '=' QSTRING ';'
844 char *sep = strchr($3, '@');
849 DupString(host, sep);
855 clientip: IP '=' QSTRING ';'
858 sep = strchr($3, '@');
869 clientusername: USERNAME '=' QSTRING ';'
874 clientclass: CLASS '=' QSTRING ';'
876 c_class = find_class($3);
878 parse_error("No such connection class '%s' for Client block", $3);
881 clientpass: PASS '=' QSTRING ';'
886 clientmaxlinks: MAXLINKS '=' expr ';'
890 clientport: PORT '=' expr ';'
897 dconf = (struct DenyConf*) MyCalloc(1, sizeof(*dconf));
898 } '{' killitems '}' ';'
900 if (dconf->usermask || dconf->hostmask ||dconf->realmask) {
901 dconf->next = denyConfList;
902 denyConfList = dconf;
906 MyFree(dconf->usermask);
907 MyFree(dconf->hostmask);
908 MyFree(dconf->realmask);
909 MyFree(dconf->message);
911 parse_error("Kill block must match on at least one of username, host or realname");
915 killitems: killitem killitems | killitem;
916 killitem: killuhost | killreal | killusername | killreasonfile | killreason;
917 killuhost: HOST '=' QSTRING ';'
920 MyFree(dconf->hostmask);
921 MyFree(dconf->usermask);
922 if ((h = strchr($3, '@')) == NULL)
924 DupString(dconf->usermask, "*");
925 dconf->hostmask = $3;
930 DupString(dconf->hostmask, h);
931 dconf->usermask = $3;
933 ipmask_parse(dconf->hostmask, &dconf->address, &dconf->bits);
936 killusername: USERNAME '=' QSTRING ';'
938 MyFree(dconf->usermask);
939 dconf->usermask = $3;
942 killreal: REAL '=' QSTRING ';'
944 MyFree(dconf->realmask);
945 dconf->realmask = $3;
948 killreason: REASON '=' QSTRING ';'
950 dconf->flags &= ~DENY_FLAGS_FILE;
951 MyFree(dconf->message);
955 killreasonfile: TFILE '=' QSTRING ';'
957 dconf->flags |= DENY_FLAGS_FILE;
958 MyFree(dconf->message);
965 } '{' cruleitems '}' ';'
967 struct CRuleNode *node = NULL;
971 parse_error("Missing server(s) in crule block");
972 else if (pass == NULL)
973 parse_error("Missing rule in crule block");
974 else if ((node = crule_parse(pass)) == NULL)
975 parse_error("Invalid rule '%s' in crule block", pass);
976 else for (link = hosts; link != NULL; link = link->next)
978 struct CRuleConf *p = (struct CRuleConf*) MyMalloc(sizeof(*p));
980 node = crule_parse(pass);
981 DupString(p->hostmask, link->value.cp);
982 DupString(p->rule, pass);
986 p->next = cruleConfList;
995 cruleitems: cruleitem cruleitems | cruleitem;
996 cruleitem: cruleserver | crulerule | cruleall;
998 cruleserver: SERVER '=' QSTRING ';'
1002 link->value.cp = $3;
1007 crulerule: RULE '=' QSTRING ';'
1013 cruleall: ALL '=' YES ';'
1021 motdblock: MOTD '{' motditems '}' ';'
1025 for (link = hosts; link != NULL; link = link->next)
1026 motd_add(link->value.cp, pass);
1032 motditems: motditem motditems | motditem;
1033 motditem: motdhost | motdfile;
1034 motdhost: HOST '=' QSTRING ';'
1038 link->value.cp = $3;
1043 motdfile: TFILE '=' QSTRING ';'
1049 featuresblock: FEATURES '{' featureitems '}' ';';
1050 featureitems: featureitems featureitem | featureitem;
1052 featureitem: QSTRING
1056 } '=' stringlist ';' {
1058 feature_set(NULL, (const char * const *)stringlist, stringno);
1059 for (ii = 0; ii < stringno; ++ii)
1060 MyFree(stringlist[ii]);
1063 stringlist: stringlist extrastring | extrastring;
1064 extrastring: QSTRING
1066 if (stringno < MAX_STRINGS)
1067 stringlist[stringno++] = $1;
1072 quarantineblock: QUARANTINE '{' quarantineitems '}' ';';
1073 quarantineitems: quarantineitems quarantineitem | quarantineitem;
1074 quarantineitem: QSTRING '=' QSTRING ';'
1076 struct qline *qconf = MyCalloc(1, sizeof(*qconf));
1079 qconf->next = GlobalQuarantineList;
1080 GlobalQuarantineList = qconf;
1083 pseudoblock: PSEUDO QSTRING '{'
1085 smap = MyCalloc(1, sizeof(struct s_map));
1093 parse_error("Missing name in pseudo %s block", smap->command);
1094 else if (!smap->services)
1095 parse_error("Missing nick in pseudo %s block", smap->command);
1096 else if (!strIsAlpha(smap->command))
1097 parse_error("Pseudo command %s invalid: must all be letters", smap->command);
1100 if (valid && register_mapping(smap))
1102 smap->next = GlobalServiceMapList;
1103 GlobalServiceMapList = smap;
1112 pseudoitems: pseudoitem pseudoitems | pseudoitem;
1113 pseudoitem: pseudoname | pseudoprepend | pseudonick | pseudoflags;
1114 pseudoname: NAME '=' QSTRING ';'
1119 pseudoprepend: PREPEND '=' QSTRING ';'
1121 MyFree(smap->prepend);
1124 pseudonick: NICK '=' QSTRING ';'
1126 char *sep = strchr($3, '@');
1129 size_t slen = strlen($3);
1130 struct nick_host *nh = MyMalloc(sizeof(*nh) + slen);
1131 memcpy(nh->nick, $3, slen + 1);
1132 nh->nicklen = sep - $3;
1133 nh->next = smap->services;
1134 smap->services = nh;
1138 pseudoflags: FAST ';'
1140 smap->flags |= SMAP_FAST;
1143 iauthblock: IAUTH '{' iauthitems '}' ';'
1145 auth_spawn(stringno, stringlist);
1146 while (stringno > 0)
1149 MyFree(stringlist[stringno]);
1153 iauthitems: iauthitem iauthitems | iauthitem;
1154 iauthitem: iauthprogram;
1155 iauthprogram: PROGRAM '='
1157 while (stringno > 0)
1160 MyFree(stringlist[stringno]);