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 << 0)
64 #define USE_IPV6 (1 << 1)
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;
77 char *stringlist[MAX_STRINGS];
78 struct ListenerFlags listen_flags;
79 struct ConnectionClass *c_class;
80 struct DenyConf *dconf;
81 struct ServerConf *sconf;
84 struct Privs privs_dirty;
86 static void parse_error(char *pattern,...) {
87 static char error_buffer[1024];
90 ircd_vsnprintf(NULL, error_buffer, sizeof(error_buffer), pattern, vl);
92 yyerror(error_buffer);
165 %token TOK_IPV4 TOK_IPV6
167 /* and now a lot of privileges... */
168 %token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
169 %token TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
170 %token TPRIV_GLINE TPRIV_LOCAL_GLINE TPRIV_LOCAL_JUPE TPRIV_LOCAL_BADCHAN
171 %token TPRIV_LOCAL_OPMODE TPRIV_OPMODE TPRIV_SET TPRIV_WHOX TPRIV_BADCHAN
172 %token TPRIV_SEE_CHAN TPRIV_SHOW_INVIS TPRIV_SHOW_ALL_INVIS TPRIV_PROPAGATE
173 %token TPRIV_UNLIMIT_QUERY TPRIV_DISPLAY TPRIV_SEE_OPERS TPRIV_WIDE_GLINE
174 %token TPRIV_FORCE_OPMODE TPRIV_FORCE_LOCAL_OPMODE TPRIV_APASS_OPMODE
175 %token TPRIV_LIST_CHAN
176 /* and some types... */
178 %type <num> timespec timefactor factoredtimes factoredtime
179 %type <num> expr yesorno privtype address_family
189 /* Blocks in the config file... */
190 blocks: blocks block | block;
191 block: adminblock | generalblock | classblock | connectblock |
192 uworldblock | operblock | portblock | jupeblock | clientblock |
193 killblock | cruleblock | motdblock | featuresblock | quarantineblock |
194 pseudoblock | iauthblock | error ';';
196 /* The timespec, sizespec and expr was ripped straight from
198 timespec: expr | factoredtimes;
200 factoredtimes: factoredtimes factoredtime
205 factoredtime: expr timefactor
210 timefactor: SECONDS { $$ = 1; }
211 | MINUTES { $$ = 60; }
212 | HOURS { $$ = 60 * 60; }
213 | DAYS { $$ = 60 * 60 * 24; }
214 | WEEKS { $$ = 60 * 60 * 24 * 7; }
215 | MONTHS { $$ = 60 * 60 * 24 * 7 * 4; }
216 | YEARS { $$ = 60 * 60 * 24 * 365; }
217 | DECADES { $$ = 60 * 60 * 24 * 365 * 10; };
230 $$ = $1 * 1024 * 1024;
233 $$ = $1 * 1024 * 1024 * 1024;
236 $$ = $1 * 1024 * 1024 * 1024;
240 /* this is an arithmetic expression */
257 /* leave this out until we find why it makes BSD yacc dump core -larne
258 | '-' expr %prec NEG {
266 jupeblock: JUPE '{' jupeitems '}' ';' ;
267 jupeitems: jupeitem jupeitems | jupeitem;
269 jupenick: NICK '=' QSTRING ';'
275 generalblock: GENERAL
277 /* Zero out the vhost addresses, in case they were removed. */
278 memset(&VirtualHost_v4.addr, 0, sizeof(VirtualHost_v4.addr));
279 memset(&VirtualHost_v6.addr, 0, sizeof(VirtualHost_v6.addr));
280 } '{' generalitems '}' ';' {
281 if (localConf.name == NULL)
282 parse_error("Your General block must contain a name.");
283 if (localConf.numeric == 0)
284 parse_error("Your General block must contain a numeric (between 1 and 4095).");
286 generalitems: generalitem generalitems | generalitem;
287 generalitem: generalnumeric | generalname | generalvhost | generaldesc
288 | generaldnsvhost | generaldnsserver;
290 generalnumeric: NUMERIC '=' NUMBER ';'
292 if (localConf.numeric == 0)
293 localConf.numeric = $3;
294 else if (localConf.numeric != $3)
295 parse_error("Redefinition of server numeric %i (%i)", $3,
299 generalname: NAME '=' QSTRING ';'
301 if (localConf.name == NULL)
304 if (strcmp(localConf.name, $3))
305 parse_error("Redefinition of server name %s (%s)", $3,
311 generaldesc: DESCRIPTION '=' QSTRING ';'
313 MyFree(localConf.description);
314 localConf.description = $3;
315 ircd_strncpy(cli_info(&me), $3, REALLEN);
318 generalvhost: VHOST '=' QSTRING ';'
320 struct irc_in_addr addr;
323 if (!strcmp(vhost, "*")) {
324 /* This traditionally meant bind to all interfaces and connect
325 * from the default. */
326 } else if (!ircd_aton(&addr, vhost))
327 parse_error("Invalid virtual host '%s'.", vhost);
328 else if (irc_in_addr_is_ipv4(&addr))
329 memcpy(&VirtualHost_v4.addr, &addr, sizeof(addr));
331 memcpy(&VirtualHost_v6.addr, &addr, sizeof(addr));
335 generaldnsvhost: DNS VHOST '=' address_family QSTRING ';'
337 struct irc_in_addr addr;
341 if (!strcmp(vhost, "*")) {
342 /* Let the operating system assign the default. */
343 } else if (!ircd_aton(&addr, vhost))
344 parse_error("Invalid DNS virtual host '%s'.", vhost);
347 if ((families & USE_IPV4)
348 || (!families && irc_in_addr_is_ipv4(&addr)))
349 memcpy(&VirtualHost_dns_v4.addr, &addr, sizeof(addr));
350 if ((families & USE_IPV6)
351 || (!families && !irc_in_addr_is_ipv4(&addr)))
352 memcpy(&VirtualHost_dns_v6.addr, &addr, sizeof(addr));
357 generaldnsserver: DNS SERVER '=' QSTRING ';'
361 add_nameserver(server);
367 MyFree(localConf.location1);
368 MyFree(localConf.location2);
369 MyFree(localConf.contact);
370 localConf.location1 = localConf.location2 = localConf.contact = NULL;
372 '{' adminitems '}' ';'
374 if (localConf.location1 == NULL)
375 DupString(localConf.location1, "");
376 if (localConf.location2 == NULL)
377 DupString(localConf.location2, "");
378 if (localConf.contact == NULL)
379 DupString(localConf.contact, "");
381 adminitems: adminitems adminitem | adminitem;
382 adminitem: adminlocation | admincontact;
383 adminlocation: LOCATION '=' QSTRING ';'
385 if (localConf.location1 == NULL)
386 localConf.location1 = $3;
387 else if (localConf.location2 == NULL)
388 localConf.location2 = $3;
389 else /* Otherwise just drop it. -A1kmm */
392 admincontact: CONTACT '=' QSTRING ';'
394 MyFree(localConf.contact);
395 localConf.contact = $3;
400 } '{' classitems '}' ';'
404 struct ConnectionClass *c_class;
405 add_class(name, tping, tconn, maxlinks, sendq);
406 c_class = find_class(name);
407 MyFree(c_class->default_umode);
408 c_class->default_umode = pass;
409 memcpy(&c_class->privs, &privs, sizeof(c_class->privs));
410 memcpy(&c_class->privs_dirty, &privs_dirty, sizeof(c_class->privs_dirty));
413 parse_error("Missing name in class block");
420 memset(&privs, 0, sizeof(privs));
421 memset(&privs_dirty, 0, sizeof(privs_dirty));
423 classitems: classitem classitems | classitem;
424 classitem: classname | classpingfreq | classconnfreq | classmaxlinks |
425 classsendq | classusermode | priv;
426 classname: NAME '=' QSTRING ';'
431 classpingfreq: PINGFREQ '=' timespec ';'
435 classconnfreq: CONNECTFREQ '=' timespec ';'
439 classmaxlinks: MAXLINKS '=' expr ';'
443 classsendq: SENDQ '=' sizespec ';'
447 classusermode: USERMODE '=' QSTRING ';'
453 connectblock: CONNECT
456 flags = CONF_AUTOCONNECT;
457 } '{' connectitems '}' ';'
459 struct ConfItem *aconf = NULL;
461 parse_error("Missing name in connect block");
462 else if (pass == NULL)
463 parse_error("Missing password in connect block");
464 else if (strlen(pass) > PASSWDLEN)
465 parse_error("Password too long in connect block");
466 else if (host == NULL)
467 parse_error("Missing host in connect block");
468 else if (strchr(host, '*') || strchr(host, '?'))
469 parse_error("Invalid host '%s' in connect block", host);
470 else if (c_class == NULL)
471 parse_error("Missing or non-existent class in connect block");
473 aconf = make_conf(CONF_SERVER);
475 aconf->origin_name = origin;
476 aconf->passwd = pass;
477 aconf->conn_class = c_class;
478 aconf->address.port = port;
480 aconf->maximum = maxlinks;
481 aconf->hub_limit = hub_limit;
482 aconf->flags = flags;
483 lookup_confhost(aconf);
492 name = pass = host = origin = hub_limit = NULL;
496 connectitems: connectitem connectitems | connectitem;
497 connectitem: connectname | connectpass | connectclass | connecthost
498 | connectport | connectvhost | connectleaf | connecthub
499 | connecthublimit | connectmaxhops | connectauto;
500 connectname: NAME '=' QSTRING ';'
505 connectpass: PASS '=' QSTRING ';'
510 connectclass: CLASS '=' QSTRING ';'
512 c_class = find_class($3);
514 parse_error("No such connection class '%s' for Connect block", $3);
517 connecthost: HOST '=' QSTRING ';'
522 connectport: PORT '=' NUMBER ';'
526 connectvhost: VHOST '=' QSTRING ';'
531 connectleaf: LEAF ';'
538 DupString(hub_limit, "*");
540 connecthublimit: HUB '=' QSTRING ';'
545 connectmaxhops: MAXHOPS '=' expr ';'
549 connectauto: AUTOCONNECT '=' YES ';' { flags |= CONF_AUTOCONNECT; }
550 | AUTOCONNECT '=' NO ';' { flags &= ~CONF_AUTOCONNECT; };
552 uworldblock: UWORLD '{' uworlditems '}' ';';
553 uworlditems: uworlditem uworlditems | uworlditem;
554 uworlditem: uworldname;
555 uworldname: NAME '=' QSTRING ';'
557 make_conf(CONF_UWORLD)->host = $3;
560 operblock: OPER '{' operitems '}' ';'
562 struct ConfItem *aconf = NULL;
564 parse_error("Missing name in operator block");
565 else if (pass == NULL)
566 parse_error("Missing password in operator block");
567 /* Do not check password length because it may be crypted. */
568 else if (host == NULL)
569 parse_error("Missing host in operator block");
570 else if (c_class == NULL)
571 parse_error("Invalid or missing class in operator block");
572 else if (!FlagHas(&privs_dirty, PRIV_PROPAGATE)
573 && !FlagHas(&c_class->privs_dirty, PRIV_PROPAGATE))
574 parse_error("Operator block for %s and class %s have no LOCAL setting", name, c_class->cc_name);
576 aconf = make_conf(CONF_OPERATOR);
578 aconf->passwd = pass;
579 conf_parse_userhost(aconf, host);
580 aconf->conn_class = c_class;
581 memcpy(&aconf->privs, &privs, sizeof(aconf->privs));
582 memcpy(&aconf->privs_dirty, &privs_dirty, sizeof(aconf->privs_dirty));
589 name = pass = host = NULL;
591 memset(&privs, 0, sizeof(privs));
592 memset(&privs_dirty, 0, sizeof(privs_dirty));
594 operitems: operitem | operitems operitem;
595 operitem: opername | operpass | operhost | operclass | priv;
596 opername: NAME '=' QSTRING ';'
601 operpass: PASS '=' QSTRING ';'
606 operhost: HOST '=' QSTRING ';'
609 if (!strchr($3, '@'))
612 host = (char*) MyMalloc((uh_len = strlen($3)+3));
613 ircd_snprintf(0, host, uh_len, "*@%s", $3);
619 operclass: CLASS '=' QSTRING ';'
621 c_class = find_class($3);
623 parse_error("No such connection class '%s' for Operator block", $3);
627 priv: privtype '=' yesorno ';'
629 FlagSet(&privs_dirty, $1);
630 if (($3 == 1) ^ invert)
637 privtype: TPRIV_CHAN_LIMIT { $$ = PRIV_CHAN_LIMIT; } |
638 TPRIV_MODE_LCHAN { $$ = PRIV_MODE_LCHAN; } |
639 TPRIV_DEOP_LCHAN { $$ = PRIV_DEOP_LCHAN; } |
640 TPRIV_WALK_LCHAN { $$ = PRIV_WALK_LCHAN; } |
641 KILL { $$ = PRIV_KILL; } |
642 TPRIV_LOCAL_KILL { $$ = PRIV_LOCAL_KILL; } |
643 TPRIV_REHASH { $$ = PRIV_REHASH; } |
644 TPRIV_RESTART { $$ = PRIV_RESTART; } |
645 TPRIV_DIE { $$ = PRIV_DIE; } |
646 TPRIV_GLINE { $$ = PRIV_GLINE; } |
647 TPRIV_LOCAL_GLINE { $$ = PRIV_LOCAL_GLINE; } |
648 JUPE { $$ = PRIV_JUPE; } |
649 TPRIV_LOCAL_JUPE { $$ = PRIV_LOCAL_JUPE; } |
650 TPRIV_LOCAL_OPMODE { $$ = PRIV_LOCAL_OPMODE; } |
651 TPRIV_OPMODE { $$ = PRIV_OPMODE; }|
652 TPRIV_SET { $$ = PRIV_SET; } |
653 TPRIV_WHOX { $$ = PRIV_WHOX; } |
654 TPRIV_BADCHAN { $$ = PRIV_BADCHAN; } |
655 TPRIV_LOCAL_BADCHAN { $$ = PRIV_LOCAL_BADCHAN; } |
656 TPRIV_SEE_CHAN { $$ = PRIV_SEE_CHAN; } |
657 TPRIV_SHOW_INVIS { $$ = PRIV_SHOW_INVIS; } |
658 TPRIV_SHOW_ALL_INVIS { $$ = PRIV_SHOW_ALL_INVIS; } |
659 TPRIV_PROPAGATE { $$ = PRIV_PROPAGATE; } |
660 TPRIV_UNLIMIT_QUERY { $$ = PRIV_UNLIMIT_QUERY; } |
661 TPRIV_DISPLAY { $$ = PRIV_DISPLAY; } |
662 TPRIV_SEE_OPERS { $$ = PRIV_SEE_OPERS; } |
663 TPRIV_WIDE_GLINE { $$ = PRIV_WIDE_GLINE; } |
664 TPRIV_LIST_CHAN { $$ = PRIV_LIST_CHAN; } |
665 LOCAL { $$ = PRIV_PROPAGATE; invert = 1; } |
666 TPRIV_FORCE_OPMODE { $$ = PRIV_FORCE_OPMODE; } |
667 TPRIV_FORCE_LOCAL_OPMODE { $$ = PRIV_FORCE_LOCAL_OPMODE; } |
668 TPRIV_APASS_OPMODE { $$ = PRIV_APASS_OPMODE; } ;
670 yesorno: YES { $$ = 1; } | NO { $$ = 0; };
672 /* not a recursive definition because some pedant will just come along
673 * and whine that the parser accepts "ipv4 ipv4 ipv4 ipv4"
677 | TOK_IPV4 { $$ = USE_IPV4; }
678 | TOK_IPV6 { $$ = USE_IPV6; }
679 | TOK_IPV4 TOK_IPV6 { $$ = USE_IPV4 | USE_IPV6; }
680 | TOK_IPV6 TOK_IPV4 { $$ = USE_IPV6 | USE_IPV4; }
683 /* The port block... */
684 portblock: PORT '{' portitems '}' ';'
686 if (!FlagHas(&listen_flags, LISTEN_IPV4)
687 && !FlagHas(&listen_flags, LISTEN_IPV6))
689 FlagSet(&listen_flags, LISTEN_IPV4);
690 FlagSet(&listen_flags, LISTEN_IPV6);
692 if (port > 0 && port <= 0xFFFF)
693 add_listener(port, host, pass, &listen_flags);
695 parse_error("Port %d is out of range", port);
698 memset(&listen_flags, 0, sizeof(listen_flags));
702 portitems: portitem portitems | portitem;
703 portitem: portnumber | portvhost | portmask | portserver | porthidden;
704 portnumber: PORT '=' address_family NUMBER ';'
707 if (families & USE_IPV4)
708 FlagSet(&listen_flags, LISTEN_IPV4);
709 else if (families & USE_IPV6)
710 FlagSet(&listen_flags, LISTEN_IPV6);
714 portvhost: VHOST '=' address_family QSTRING ';'
717 if (families & USE_IPV4)
718 FlagSet(&listen_flags, LISTEN_IPV4);
719 else if (families & USE_IPV6)
720 FlagSet(&listen_flags, LISTEN_IPV6);
725 portmask: MASK '=' QSTRING ';'
731 portserver: SERVER '=' YES ';'
733 FlagSet(&listen_flags, LISTEN_SERVER);
734 } | SERVER '=' NO ';'
736 FlagClr(&listen_flags, LISTEN_SERVER);
739 porthidden: HIDDEN '=' YES ';'
741 FlagSet(&listen_flags, LISTEN_HIDDEN);
742 } | HIDDEN '=' NO ';'
744 FlagClr(&listen_flags, LISTEN_HIDDEN);
752 '{' clientitems '}' ';'
754 struct ConfItem *aconf = 0;
755 struct irc_in_addr addr;
756 unsigned char addrbits = 0;
759 parse_error("Invalid or missing class in Client block");
760 else if (pass && strlen(pass) > PASSWDLEN)
761 parse_error("Password too long in connect block");
762 else if (ip && !ipmask_parse(ip, &addr, &addrbits))
763 parse_error("Invalid IP address %s in Client block", ip);
765 aconf = make_conf(CONF_CLIENT);
766 aconf->username = username;
769 memcpy(&aconf->address.addr, &addr, sizeof(aconf->address.addr));
771 memset(&aconf->address.addr, 0, sizeof(aconf->address.addr));
772 aconf->address.port = port;
773 aconf->addrbits = addrbits;
775 aconf->conn_class = c_class;
776 aconf->maximum = maxlinks;
777 aconf->passwd = pass;
792 clientitems: clientitem clientitems | clientitem;
793 clientitem: clienthost | clientip | clientusername | clientclass | clientpass | clientmaxlinks | clientport;
794 clienthost: HOST '=' QSTRING ';'
796 char *sep = strchr($3, '@');
801 DupString(host, sep);
807 clientip: IP '=' QSTRING ';'
810 sep = strchr($3, '@');
821 clientusername: USERNAME '=' QSTRING ';'
826 clientclass: CLASS '=' QSTRING ';'
828 c_class = find_class($3);
830 parse_error("No such connection class '%s' for Client block", $3);
833 clientpass: PASS '=' QSTRING ';'
838 clientmaxlinks: MAXLINKS '=' expr ';'
842 clientport: PORT '=' expr ';'
849 dconf = (struct DenyConf*) MyCalloc(1, sizeof(*dconf));
850 } '{' killitems '}' ';'
852 if (dconf->usermask || dconf->hostmask ||dconf->realmask) {
853 dconf->next = denyConfList;
854 denyConfList = dconf;
858 MyFree(dconf->usermask);
859 MyFree(dconf->hostmask);
860 MyFree(dconf->realmask);
861 MyFree(dconf->message);
863 parse_error("Kill block must match on at least one of username, host or realname");
867 killitems: killitem killitems | killitem;
868 killitem: killuhost | killreal | killusername | killreasonfile | killreason;
869 killuhost: HOST '=' QSTRING ';'
872 MyFree(dconf->hostmask);
873 MyFree(dconf->usermask);
874 if ((h = strchr($3, '@')) == NULL)
876 DupString(dconf->usermask, "*");
877 dconf->hostmask = $3;
882 DupString(dconf->hostmask, h);
883 dconf->usermask = $3;
885 ipmask_parse(dconf->hostmask, &dconf->address, &dconf->bits);
888 killusername: USERNAME '=' QSTRING ';'
890 MyFree(dconf->usermask);
891 dconf->usermask = $3;
894 killreal: REAL '=' QSTRING ';'
896 MyFree(dconf->realmask);
897 dconf->realmask = $3;
900 killreason: REASON '=' QSTRING ';'
902 dconf->flags &= ~DENY_FLAGS_FILE;
903 MyFree(dconf->message);
907 killreasonfile: TFILE '=' QSTRING ';'
909 dconf->flags |= DENY_FLAGS_FILE;
910 MyFree(dconf->message);
917 } '{' cruleitems '}' ';'
919 struct CRuleNode *node = NULL;
921 parse_error("Missing host in crule block");
922 else if (pass == NULL)
923 parse_error("Missing rule in crule block");
924 else if ((node = crule_parse(pass)) == NULL)
925 parse_error("Invalid rule '%s' in crule block", pass);
928 struct CRuleConf *p = (struct CRuleConf*) MyMalloc(sizeof(*p));
933 p->next = cruleConfList;
945 cruleitems: cruleitem cruleitems | cruleitem;
946 cruleitem: cruleserver | crulerule | cruleall;
948 cruleserver: SERVER '=' QSTRING ';'
955 crulerule: RULE '=' QSTRING ';'
961 cruleall: ALL '=' YES ';'
969 motdblock: MOTD '{' motditems '}' ';'
971 if (host != NULL && pass != NULL)
972 motd_add(host, pass);
978 motditems: motditem motditems | motditem;
979 motditem: motdhost | motdfile;
980 motdhost: HOST '=' QSTRING ';'
985 motdfile: TFILE '=' QSTRING ';'
990 featuresblock: FEATURES '{' featureitems '}' ';';
991 featureitems: featureitems featureitem | featureitem;
997 } '=' stringlist ';' {
999 feature_set(NULL, (const char * const *)stringlist, stringno);
1000 for (ii = 0; ii < stringno; ++ii)
1001 MyFree(stringlist[ii]);
1004 stringlist: stringlist extrastring | extrastring;
1005 extrastring: QSTRING
1007 if (stringno < MAX_STRINGS)
1008 stringlist[stringno++] = $1;
1013 quarantineblock: QUARANTINE '{' quarantineitems '}' ';';
1014 quarantineitems: quarantineitems quarantineitem | quarantineitem;
1015 quarantineitem: QSTRING '=' QSTRING ';'
1017 struct qline *qconf = MyCalloc(1, sizeof(*qconf));
1020 qconf->next = GlobalQuarantineList;
1021 GlobalQuarantineList = qconf;
1024 pseudoblock: PSEUDO QSTRING '{'
1026 smap = MyCalloc(1, sizeof(struct s_map));
1034 parse_error("Missing name in pseudo %s block", smap->command);
1035 else if (!smap->services)
1036 parse_error("Missing nick in pseudo %s block", smap->command);
1039 if (valid && register_mapping(smap))
1041 smap->next = GlobalServiceMapList;
1042 GlobalServiceMapList = smap;
1051 pseudoitems: pseudoitem pseudoitems | pseudoitem;
1052 pseudoitem: pseudoname | pseudoprepend | pseudonick | pseudoflags;
1053 pseudoname: NAME '=' QSTRING ';'
1058 pseudoprepend: PREPEND '=' QSTRING ';'
1060 MyFree(smap->prepend);
1063 pseudonick: NICK '=' QSTRING ';'
1065 char *sep = strchr($3, '@');
1068 size_t slen = strlen($3);
1069 struct nick_host *nh = MyMalloc(sizeof(*nh) + slen);
1070 memcpy(nh->nick, $3, slen + 1);
1071 nh->nicklen = sep - $3;
1072 nh->next = smap->services;
1073 smap->services = nh;
1077 pseudoflags: FAST ';'
1079 smap->flags |= SMAP_FAST;
1082 iauthblock: IAUTH '{' iauthitems '}' ';'
1084 auth_spawn(stringno, stringlist);
1085 while (stringno > 0)
1086 MyFree(stringlist[--stringno]);
1089 iauthitems: iauthitem iauthitems | iauthitem;
1090 iauthitem: iauthprogram;
1091 iauthprogram: PROGRAM '='
1093 while (stringno > 0)
1094 MyFree(stringlist[--stringno]);