ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 9586
Committed: Sat Aug 29 14:00:43 2020 UTC (6 years, 1 month ago) by michael
File size: 73596 byte(s)
Log Message:
- Added 'client' option to listener::flags

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 2000-2020 ircd-hybrid development team
5 *
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.
10 *
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.
15 *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file conf_parser.y
23 * \brief Parses the ircd configuration file.
24 * \version $Id$
25 */
26
27
28 %{
29
30 #include "config.h"
31 #include "stdinc.h"
32 #include "ircd.h"
33 #include "list.h"
34 #include "parse.h"
35 #include "conf.h"
36 #include "conf_class.h"
37 #include "conf_cluster.h"
38 #include "conf_gecos.h"
39 #include "conf_pseudo.h"
40 #include "conf_resv.h"
41 #include "conf_service.h"
42 #include "conf_shared.h"
43 #include "event.h"
44 #include "id.h"
45 #include "log.h"
46 #include "irc_string.h"
47 #include "memory.h"
48 #include "modules.h"
49 #include "server.h"
50 #include "hostmask.h"
51 #include "listener.h"
52 #include "user.h"
53 #include "motd.h"
54
55 int yylex(void);
56
57 static struct
58 {
59 struct
60 {
61 dlink_list list;
62 } mask,
63 leaf,
64 hub;
65
66 struct
67 {
68 char buf[IRCD_BUFSIZE];
69 } name,
70 nick,
71 user,
72 host,
73 addr,
74 bind,
75 file,
76 ciph,
77 cert,
78 rpass,
79 spass,
80 whois,
81 class,
82 target,
83 prepend,
84 command;
85
86 struct
87 {
88 unsigned int value;
89 } flags,
90 modes,
91 size,
92 type,
93 port,
94 timeout,
95 aftype,
96 ping_freq,
97 max_perip_local,
98 max_perip_global,
99 con_freq,
100 min_idle,
101 max_idle,
102 max_total,
103 max_sendq,
104 max_recvq,
105 max_channels,
106 cidr_bitlen_ipv4,
107 cidr_bitlen_ipv6,
108 number_per_cidr;
109 } block_state;
110
111 static void
112 reset_block_state(void)
113 {
114 dlink_node *node, *node_next;
115 dlink_list *tab[] = { &block_state.mask.list,
116 &block_state.leaf.list, &block_state.hub.list, NULL };
117
118 for (dlink_list **list = tab; *list; ++list)
119 {
120 DLINK_FOREACH_SAFE(node, node_next, (*list)->head)
121 {
122 xfree(node->data);
123 dlinkDelete(node, *list);
124 free_dlink_node(node);
125 }
126 }
127
128 memset(&block_state, 0, sizeof(block_state));
129 }
130
131 %}
132
133 %union {
134 int number;
135 char *string;
136 }
137
138 %token ACCEPT_PASSWORD
139 %token ADMIN
140 %token AFTYPE
141 %token ANTI_NICK_FLOOD
142 %token ANTI_SPAM_EXIT_MESSAGE_TIME
143 %token AUTOCONN
144 %token AWAY_COUNT
145 %token AWAY_TIME
146 %token BYTES KBYTES MBYTES
147 %token CALLER_ID_WAIT
148 %token CAN_FLOOD
149 %token CHANNEL
150 %token CIDR_BITLEN_IPV4
151 %token CIDR_BITLEN_IPV6
152 %token CLASS
153 %token CLIENT
154 %token CLOSE
155 %token CONNECT
156 %token CONNECTFREQ
157 %token CYCLE_ON_HOST_CHANGE
158 %token DEFAULT_FLOODCOUNT
159 %token DEFAULT_FLOODTIME
160 %token DEFAULT_JOIN_FLOOD_COUNT
161 %token DEFAULT_JOIN_FLOOD_TIME
162 %token DEFAULT_MAX_CLIENTS
163 %token DENY
164 %token DESCRIPTION
165 %token DIE
166 %token DISABLE_AUTH
167 %token DISABLE_FAKE_CHANNELS
168 %token DISABLE_REMOTE_COMMANDS
169 %token DLINE_MIN_CIDR
170 %token DLINE_MIN_CIDR6
171 %token DOTS_IN_IDENT
172 %token EMAIL
173 %token ENABLE_EXTBANS
174 %token ENCRYPTED
175 %token EXCEED_LIMIT
176 %token EXEMPT
177 %token EXPIRATION
178 %token FAILED_OPER_NOTICE
179 %token FLATTEN_LINKS
180 %token FLATTEN_LINKS_DELAY
181 %token FLATTEN_LINKS_FILE
182 %token GECOS
183 %token GENERAL
184 %token HIDDEN
185 %token HIDDEN_NAME
186 %token HIDE_CHANS
187 %token HIDE_IDLE
188 %token HIDE_IDLE_FROM_OPERS
189 %token HIDE_SERVER_IPS
190 %token HIDE_SERVERS
191 %token HIDE_SERVICES
192 %token HOST
193 %token HUB
194 %token HUB_MASK
195 %token INVISIBLE_ON_CONNECT
196 %token INVITE_CLIENT_COUNT
197 %token INVITE_CLIENT_TIME
198 %token INVITE_DELAY_CHANNEL
199 %token INVITE_EXPIRE_TIME
200 %token IP
201 %token IRCD_AUTH
202 %token IRCD_FLAGS
203 %token IRCD_SID
204 %token JOIN
205 %token KILL
206 %token KILL_CHASE_TIME_LIMIT
207 %token KLINE
208 %token KLINE_EXEMPT
209 %token KLINE_MIN_CIDR
210 %token KLINE_MIN_CIDR6
211 %token KNOCK_CLIENT_COUNT
212 %token KNOCK_CLIENT_TIME
213 %token KNOCK_DELAY_CHANNEL
214 %token LEAF_MASK
215 %token LISTEN
216 %token MASK
217 %token MAX_ACCEPT
218 %token MAX_BANS
219 %token MAX_BANS_LARGE
220 %token MAX_CHANNELS
221 %token MAX_IDLE
222 %token MAX_INVITES
223 %token MAX_NICK_CHANGES
224 %token MAX_NICK_LENGTH
225 %token MAX_NICK_TIME
226 %token MAX_NUMBER
227 %token MAX_TARGETS
228 %token MAX_TOPIC_LENGTH
229 %token MAX_WATCH
230 %token MIN_IDLE
231 %token MIN_NONWILDCARD
232 %token MIN_NONWILDCARD_SIMPLE
233 %token MODULE
234 %token MODULES
235 %token MOTD
236 %token NAME
237 %token NEED_IDENT
238 %token NEED_PASSWORD
239 %token NETWORK_DESC
240 %token NETWORK_NAME
241 %token NICK
242 %token NO_OPER_FLOOD
243 %token NO_TILDE
244 %token NUMBER
245 %token NUMBER_PER_CIDR
246 %token NUMBER_PER_IP_GLOBAL
247 %token NUMBER_PER_IP_LOCAL
248 %token OPER_ONLY_UMODES
249 %token OPER_UMODES
250 %token OPERATOR
251 %token OPERS_BYPASS_CALLERID
252 %token PACE_WAIT
253 %token PACE_WAIT_SIMPLE
254 %token PASSWORD
255 %token PATH
256 %token PING_COOKIE
257 %token PING_TIME
258 %token PORT
259 %token QSTRING
260 %token RANDOM_IDLE
261 %token REASON
262 %token REDIRPORT
263 %token REDIRSERV
264 %token REHASH
265 %token REMOTE
266 %token REMOTEBAN
267 %token RESV
268 %token RESV_EXEMPT
269 %token RSA_PRIVATE_KEY_FILE
270 %token SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
271 %token SEND_PASSWORD
272 %token SENDQ
273 %token SERVERHIDE
274 %token SERVERINFO
275 %token SHORT_MOTD
276 %token SPOOF
277 %token SQUIT
278 %token STATS_E_DISABLED
279 %token STATS_I_OPER_ONLY
280 %token STATS_K_OPER_ONLY
281 %token STATS_M_OPER_ONLY
282 %token STATS_O_OPER_ONLY
283 %token STATS_P_OPER_ONLY
284 %token STATS_U_OPER_ONLY
285 %token T_ALL
286 %token T_BIND
287 %token T_BOTS
288 %token T_CALLERID
289 %token T_CCONN
290 %token T_COMMAND
291 %token T_CLUSTER
292 %token T_DEAF
293 %token T_DEBUG
294 %token T_DLINE
295 %token T_EXTERNAL
296 %token T_FARCONNECT
297 %token T_FILE
298 %token T_FULL
299 %token T_GLOBOPS
300 %token T_INVISIBLE
301 %token T_IPV4
302 %token T_IPV6
303 %token T_LOCOPS
304 %token T_LOG
305 %token T_NCHANGE
306 %token T_NONONREG
307 %token T_OPME
308 %token T_PREPEND
309 %token T_PSEUDO
310 %token T_RECVQ
311 %token T_REJ
312 %token T_RESTART
313 %token T_SERVER
314 %token T_SERVICE
315 %token T_SERVNOTICE
316 %token T_SET
317 %token T_SHARED
318 %token T_SIZE
319 %token T_SKILL
320 %token T_SOFTCALLERID
321 %token T_SPY
322 %token T_TARGET
323 %token T_TLS
324 %token T_UMODES
325 %token T_UNAUTH
326 %token T_UNDLINE
327 %token T_UNLIMITED
328 %token T_UNRESV
329 %token T_UNXLINE
330 %token T_WALLOP
331 %token T_WALLOPS
332 %token T_WEBIRC
333 %token TBOOL
334 %token THROTTLE_COUNT
335 %token THROTTLE_TIME
336 %token TIMEOUT
337 %token TLS_CERTIFICATE_FILE
338 %token TLS_CERTIFICATE_FINGERPRINT
339 %token TLS_CIPHER_LIST
340 %token TLS_CIPHER_SUITES
341 %token TLS_CONNECTION_REQUIRED
342 %token TLS_DH_PARAM_FILE
343 %token TLS_MESSAGE_DIGEST_ALGORITHM
344 %token TLS_SUPPORTED_GROUPS
345 %token TS_MAX_DELTA
346 %token TS_WARN_DELTA
347 %token TWODOTS
348 %token TYPE
349 %token UNKLINE
350 %token USE_LOGGING
351 %token USER
352 %token VHOST
353 %token VHOST6
354 %token WARN_NO_CONNECT_BLOCK
355 %token WHOIS
356 %token WHOWAS_HISTORY_LENGTH
357 %token XLINE
358 %token XLINE_EXEMPT
359
360 %type <string> QSTRING
361 %type <number> NUMBER
362 %type <number> timespec
363 %type <number> timespec_
364 %type <number> sizespec
365 %type <number> sizespec_
366
367 %%
368 conf:
369 | conf conf_item
370 ;
371
372 conf_item: admin_entry
373 | logging_entry
374 | oper_entry
375 | channel_entry
376 | class_entry
377 | listen_entry
378 | auth_entry
379 | serverinfo_entry
380 | serverhide_entry
381 | resv_entry
382 | service_entry
383 | shared_entry
384 | cluster_entry
385 | connect_entry
386 | kill_entry
387 | deny_entry
388 | exempt_entry
389 | general_entry
390 | gecos_entry
391 | modules_entry
392 | motd_entry
393 | pseudo_entry
394 | error ';'
395 | error '}'
396 ;
397
398
399 timespec_: { $$ = 0; } | timespec;
400 timespec: NUMBER timespec_ { $$ = $1 + $2; } |
401 NUMBER SECONDS timespec_ { $$ = $1 + $3; } |
402 NUMBER MINUTES timespec_ { $$ = $1 * 60 + $3; } |
403 NUMBER HOURS timespec_ { $$ = $1 * 60 * 60 + $3; } |
404 NUMBER DAYS timespec_ { $$ = $1 * 60 * 60 * 24 + $3; } |
405 NUMBER WEEKS timespec_ { $$ = $1 * 60 * 60 * 24 * 7 + $3; } |
406 NUMBER MONTHS timespec_ { $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3; } |
407 NUMBER YEARS timespec_ { $$ = $1 * 60 * 60 * 24 * 365 + $3; }
408 ;
409
410 sizespec_: { $$ = 0; } | sizespec;
411 sizespec: NUMBER sizespec_ { $$ = $1 + $2; } |
412 NUMBER BYTES sizespec_ { $$ = $1 + $3; } |
413 NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } |
414 NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
415 ;
416
417
418 /***************************************************************************
419 * modules {} section
420 ***************************************************************************/
421 modules_entry: MODULES '{' modules_items '}' ';';
422
423 modules_items: modules_items modules_item | modules_item;
424 modules_item: modules_module | modules_path | error ';' ;
425
426 modules_module: MODULE '=' QSTRING ';'
427 {
428 if (conf_parser_ctx.pass == 2)
429 add_conf_module(libio_basename(yylval.string));
430 };
431
432 modules_path: PATH '=' QSTRING ';'
433 {
434 if (conf_parser_ctx.pass == 2)
435 mod_add_path(yylval.string);
436 };
437
438
439 /***************************************************************************
440 * serverinfo {} section
441 ***************************************************************************/
442 serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
443
444 serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ;
445 serverinfo_item: serverinfo_name |
446 serverinfo_hub |
447 serverinfo_description |
448 serverinfo_network_name |
449 serverinfo_network_desc |
450 serverinfo_default_max_clients |
451 serverinfo_max_nick_length |
452 serverinfo_max_topic_length |
453 serverinfo_tls_dh_param_file |
454 serverinfo_tls_supported_groups |
455 serverinfo_rsa_private_key_file |
456 serverinfo_sid |
457 serverinfo_tls_certificate_file |
458 serverinfo_tls_cipher_list |
459 serverinfo_tls_cipher_suites |
460 serverinfo_tls_message_digest_algorithm |
461 error ';' ;
462
463
464 serverinfo_tls_certificate_file: TLS_CERTIFICATE_FILE '=' QSTRING ';'
465 {
466 if (conf_parser_ctx.pass == 2)
467 {
468 xfree(ConfigServerInfo.tls_certificate_file);
469 ConfigServerInfo.tls_certificate_file = xstrdup(yylval.string);
470 }
471 };
472
473 serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
474 {
475 if (conf_parser_ctx.pass == 2)
476 {
477 xfree(ConfigServerInfo.rsa_private_key_file);
478 ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
479 }
480 };
481
482 serverinfo_tls_dh_param_file: TLS_DH_PARAM_FILE '=' QSTRING ';'
483 {
484 if (conf_parser_ctx.pass == 2)
485 {
486 xfree(ConfigServerInfo.tls_dh_param_file);
487 ConfigServerInfo.tls_dh_param_file = xstrdup(yylval.string);
488 }
489 };
490
491 serverinfo_tls_cipher_list: TLS_CIPHER_LIST '=' QSTRING ';'
492 {
493 if (conf_parser_ctx.pass == 2)
494 {
495 xfree(ConfigServerInfo.tls_cipher_list);
496 ConfigServerInfo.tls_cipher_list = xstrdup(yylval.string);
497 }
498 };
499
500 serverinfo_tls_cipher_suites: TLS_CIPHER_SUITES '=' QSTRING ';'
501 {
502 if (conf_parser_ctx.pass == 2)
503 {
504 xfree(ConfigServerInfo.tls_cipher_suites);
505 ConfigServerInfo.tls_cipher_suites = xstrdup(yylval.string);
506 }
507 };
508
509 serverinfo_tls_message_digest_algorithm: TLS_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';'
510 {
511 if (conf_parser_ctx.pass == 2)
512 {
513 xfree(ConfigServerInfo.tls_message_digest_algorithm);
514 ConfigServerInfo.tls_message_digest_algorithm = xstrdup(yylval.string);
515 }
516 }
517
518 serverinfo_tls_supported_groups: TLS_SUPPORTED_GROUPS '=' QSTRING ';'
519 {
520 if (conf_parser_ctx.pass == 2)
521 {
522 xfree(ConfigServerInfo.tls_supported_groups);
523 ConfigServerInfo.tls_supported_groups = xstrdup(yylval.string);
524 }
525 };
526
527 serverinfo_name: NAME '=' QSTRING ';'
528 {
529 /* This isn't rehashable */
530 if (conf_parser_ctx.pass == 2 && ConfigServerInfo.name == NULL)
531 {
532 if (server_valid_name(yylval.string) == true)
533 ConfigServerInfo.name = xstrdup(yylval.string);
534 else
535 {
536 conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting.");
537 exit(EXIT_FAILURE);
538 }
539 }
540 };
541
542 serverinfo_sid: IRCD_SID '=' QSTRING ';'
543 {
544 /* This isn't rehashable */
545 if (conf_parser_ctx.pass == 2 && ConfigServerInfo.sid == NULL)
546 {
547 if (valid_sid(yylval.string))
548 ConfigServerInfo.sid = xstrdup(yylval.string);
549 else
550 {
551 conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting.");
552 exit(EXIT_FAILURE);
553 }
554 }
555 };
556
557 serverinfo_description: DESCRIPTION '=' QSTRING ';'
558 {
559 if (conf_parser_ctx.pass == 2)
560 {
561 xfree(ConfigServerInfo.description);
562 ConfigServerInfo.description = xstrdup(yylval.string);
563 strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info));
564 }
565 };
566
567 serverinfo_network_name: NETWORK_NAME '=' QSTRING ';'
568 {
569 if (conf_parser_ctx.pass == 2)
570 {
571 char *p = strchr(yylval.string, ' ');
572
573 if (p)
574 *p = '\0';
575
576 xfree(ConfigServerInfo.network_name);
577 ConfigServerInfo.network_name = xstrdup(yylval.string);
578 }
579 };
580
581 serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
582 {
583 if (conf_parser_ctx.pass != 2)
584 break;
585
586 xfree(ConfigServerInfo.network_desc);
587 ConfigServerInfo.network_desc = xstrdup(yylval.string);
588 };
589
590 serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';'
591 {
592 if (conf_parser_ctx.pass != 2)
593 break;
594
595 if ($3 < 1)
596 {
597 conf_error_report("default_max_clients too low, setting to 1");
598 ConfigServerInfo.default_max_clients = 1;
599 }
600 else if ($3 > MAXCLIENTS_MAX)
601 {
602 char buf[IRCD_BUFSIZE];
603
604 snprintf(buf, sizeof(buf), "default_max_clients too high, setting to %d", MAXCLIENTS_MAX);
605 conf_error_report(buf);
606
607 ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
608 }
609 else
610 ConfigServerInfo.default_max_clients = $3;
611 };
612
613 serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';'
614 {
615 if (conf_parser_ctx.pass != 2)
616 break;
617
618 if ($3 < 9)
619 {
620 conf_error_report("max_nick_length too low, setting to 9");
621 ConfigServerInfo.max_nick_length = 9;
622 }
623 else if ($3 > NICKLEN)
624 {
625 char buf[IRCD_BUFSIZE];
626
627 snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN);
628 conf_error_report(buf);
629
630 ConfigServerInfo.max_nick_length = NICKLEN;
631 }
632 else
633 ConfigServerInfo.max_nick_length = $3;
634 };
635
636 serverinfo_max_topic_length: MAX_TOPIC_LENGTH '=' NUMBER ';'
637 {
638 if (conf_parser_ctx.pass != 2)
639 break;
640
641 if ($3 < 80)
642 {
643 conf_error_report("max_topic_length too low, setting to 80");
644 ConfigServerInfo.max_topic_length = 80;
645 }
646 else if ($3 > TOPICLEN)
647 {
648 char buf[IRCD_BUFSIZE];
649
650 snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN);
651 conf_error_report(buf);
652
653 ConfigServerInfo.max_topic_length = TOPICLEN;
654 }
655 else
656 ConfigServerInfo.max_topic_length = $3;
657 };
658
659 serverinfo_hub: HUB '=' TBOOL ';'
660 {
661 if (conf_parser_ctx.pass == 2)
662 ConfigServerInfo.hub = yylval.number;
663 };
664
665
666 /***************************************************************************
667 * admin {} section
668 ***************************************************************************/
669 admin_entry: ADMIN '{' admin_items '}' ';' ;
670
671 admin_items: admin_items admin_item | admin_item;
672 admin_item: admin_name |
673 admin_description |
674 admin_email |
675 error ';' ;
676
677 admin_name: NAME '=' QSTRING ';'
678 {
679 if (conf_parser_ctx.pass != 2)
680 break;
681
682 xfree(ConfigAdminInfo.name);
683 ConfigAdminInfo.name = xstrdup(yylval.string);
684 };
685
686 admin_email: EMAIL '=' QSTRING ';'
687 {
688 if (conf_parser_ctx.pass != 2)
689 break;
690
691 xfree(ConfigAdminInfo.email);
692 ConfigAdminInfo.email = xstrdup(yylval.string);
693 };
694
695 admin_description: DESCRIPTION '=' QSTRING ';'
696 {
697 if (conf_parser_ctx.pass != 2)
698 break;
699
700 xfree(ConfigAdminInfo.description);
701 ConfigAdminInfo.description = xstrdup(yylval.string);
702 };
703
704
705 /***************************************************************************
706 * motd {} section
707 ***************************************************************************/
708 motd_entry: MOTD
709 {
710 if (conf_parser_ctx.pass == 2)
711 reset_block_state();
712 } '{' motd_items '}' ';'
713 {
714 dlink_node *node;
715
716 if (conf_parser_ctx.pass != 2)
717 break;
718
719 if (!block_state.file.buf[0])
720 break;
721
722 DLINK_FOREACH(node, block_state.mask.list.head)
723 motd_add(node->data, block_state.file.buf);
724 };
725
726 motd_items: motd_items motd_item | motd_item;
727 motd_item: motd_mask | motd_file | error ';' ;
728
729 motd_mask: MASK '=' QSTRING ';'
730 {
731 if (conf_parser_ctx.pass == 2)
732 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
733 };
734
735 motd_file: T_FILE '=' QSTRING ';'
736 {
737 if (conf_parser_ctx.pass == 2)
738 strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
739 };
740
741
742 /***************************************************************************
743 * pseudo {} section
744 ***************************************************************************/
745 pseudo_entry: T_PSEUDO
746 {
747 if (conf_parser_ctx.pass == 2)
748 reset_block_state();
749 } '{' pseudo_items '}' ';'
750 {
751 if (conf_parser_ctx.pass != 2)
752 break;
753
754 if (!block_state.command.buf[0] ||
755 !block_state.name.buf[0] ||
756 !block_state.nick.buf[0] ||
757 !block_state.host.buf[0])
758 break;
759
760 pseudo_register(block_state.name.buf, block_state.nick.buf, block_state.host.buf,
761 block_state.prepend.buf, block_state.command.buf);
762 };
763
764 pseudo_items: pseudo_items pseudo_item | pseudo_item;
765 pseudo_item: pseudo_command | pseudo_prepend | pseudo_name | pseudo_target | error ';' ;
766
767 pseudo_command: T_COMMAND '=' QSTRING ';'
768 {
769 if (conf_parser_ctx.pass == 2)
770 strlcpy(block_state.command.buf, yylval.string, sizeof(block_state.command.buf));
771 };
772
773 pseudo_name: NAME '=' QSTRING ';'
774 {
775 if (conf_parser_ctx.pass == 2)
776 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
777 };
778
779 pseudo_prepend: T_PREPEND '=' QSTRING ';'
780 {
781 if (conf_parser_ctx.pass == 2)
782 strlcpy(block_state.prepend.buf, yylval.string, sizeof(block_state.prepend.buf));
783 };
784
785 pseudo_target: T_TARGET '=' QSTRING ';'
786 {
787 if (conf_parser_ctx.pass == 2)
788 {
789 struct split_nuh_item nuh;
790
791 nuh.nuhmask = yylval.string;
792 nuh.nickptr = NULL;
793 nuh.userptr = block_state.nick.buf;
794 nuh.hostptr = block_state.host.buf;
795 nuh.nicksize = 0;
796 nuh.usersize = sizeof(block_state.nick.buf);
797 nuh.hostsize = sizeof(block_state.host.buf);
798
799 split_nuh(&nuh);
800 }
801 };
802
803
804 /***************************************************************************
805 * log {} section
806 ***************************************************************************/
807 logging_entry: T_LOG '{' logging_items '}' ';' ;
808 logging_items: logging_items logging_item | logging_item ;
809
810 logging_item: logging_use_logging | logging_file_entry |
811 error ';' ;
812
813 logging_use_logging: USE_LOGGING '=' TBOOL ';'
814 {
815 if (conf_parser_ctx.pass == 2)
816 ConfigLog.use_logging = yylval.number;
817 };
818
819 logging_file_entry:
820 {
821 if (conf_parser_ctx.pass == 2)
822 reset_block_state();
823 } T_FILE '{' logging_file_items '}' ';'
824 {
825 if (conf_parser_ctx.pass != 2)
826 break;
827
828 if (block_state.type.value && block_state.file.buf[0])
829 log_set_file(block_state.type.value, block_state.size.value,
830 block_state.file.buf);
831 };
832
833 logging_file_items: logging_file_items logging_file_item |
834 logging_file_item ;
835
836 logging_file_item: logging_file_name | logging_file_type |
837 logging_file_size | error ';' ;
838
839 logging_file_name: NAME '=' QSTRING ';'
840 {
841 if (conf_parser_ctx.pass != 2)
842 break;
843
844 strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
845 }
846
847 logging_file_size: T_SIZE '=' sizespec ';'
848 {
849 block_state.size.value = $3;
850 } | T_SIZE '=' T_UNLIMITED ';'
851 {
852 block_state.size.value = 0;
853 };
854
855 logging_file_type: TYPE
856 {
857 if (conf_parser_ctx.pass == 2)
858 block_state.type.value = 0;
859 } '=' logging_file_type_items ';' ;
860
861 logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
862 logging_file_type_item: USER
863 {
864 if (conf_parser_ctx.pass == 2)
865 block_state.type.value = LOG_TYPE_USER;
866 } | OPERATOR
867 {
868 if (conf_parser_ctx.pass == 2)
869 block_state.type.value = LOG_TYPE_OPER;
870 } | XLINE
871 {
872 if (conf_parser_ctx.pass == 2)
873 block_state.type.value = LOG_TYPE_XLINE;
874 } | RESV
875 {
876 if (conf_parser_ctx.pass == 2)
877 block_state.type.value = LOG_TYPE_RESV;
878 } | T_DLINE
879 {
880 if (conf_parser_ctx.pass == 2)
881 block_state.type.value = LOG_TYPE_DLINE;
882 } | KLINE
883 {
884 if (conf_parser_ctx.pass == 2)
885 block_state.type.value = LOG_TYPE_KLINE;
886 } | KILL
887 {
888 if (conf_parser_ctx.pass == 2)
889 block_state.type.value = LOG_TYPE_KILL;
890 } | T_DEBUG
891 {
892 if (conf_parser_ctx.pass == 2)
893 block_state.type.value = LOG_TYPE_DEBUG;
894 };
895
896
897 /***************************************************************************
898 * operator {} section
899 ***************************************************************************/
900 oper_entry: OPERATOR
901 {
902 if (conf_parser_ctx.pass != 2)
903 break;
904
905 reset_block_state();
906 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
907 } '{' oper_items '}' ';'
908 {
909 dlink_node *node;
910
911 if (conf_parser_ctx.pass != 2)
912 break;
913
914 if (!block_state.name.buf[0])
915 break;
916
917 if (!block_state.rpass.buf[0])
918 break;
919
920 DLINK_FOREACH(node, block_state.mask.list.head)
921 {
922 struct split_nuh_item nuh;
923 char *s = node->data;
924
925 if (EmptyString(s))
926 continue;
927
928 nuh.nuhmask = s;
929 nuh.nickptr = NULL;
930 nuh.userptr = block_state.user.buf;
931 nuh.hostptr = block_state.host.buf;
932
933 nuh.nicksize = 0;
934 nuh.usersize = sizeof(block_state.user.buf);
935 nuh.hostsize = sizeof(block_state.host.buf);
936
937 split_nuh(&nuh);
938
939 struct MaskItem *conf = conf_make(CONF_OPER);
940 conf->addr = xcalloc(sizeof(*conf->addr));
941 conf->name = xstrdup(block_state.name.buf);
942 conf->user = xstrdup(block_state.user.buf);
943 conf->host = xstrdup(block_state.host.buf);
944
945 if (block_state.cert.buf[0])
946 conf->certfp = xstrdup(block_state.cert.buf);
947
948 if (block_state.rpass.buf[0])
949 conf->passwd = xstrdup(block_state.rpass.buf);
950
951 if (block_state.whois.buf[0])
952 conf->whois = xstrdup(block_state.whois.buf);
953
954 conf->flags = block_state.flags.value;
955 conf->modes = block_state.modes.value;
956 conf->port = block_state.port.value;
957 conf->htype = parse_netmask(conf->host, conf->addr, &conf->bits);
958
959 conf_add_class_to_conf(conf, block_state.class.buf);
960 }
961 };
962
963 oper_items: oper_items oper_item | oper_item;
964 oper_item: oper_name |
965 oper_user |
966 oper_password |
967 oper_whois |
968 oper_umodes |
969 oper_class |
970 oper_encrypted |
971 oper_tls_certificate_fingerprint |
972 oper_tls_connection_required |
973 oper_flags |
974 error ';' ;
975
976 oper_name: NAME '=' QSTRING ';'
977 {
978 if (conf_parser_ctx.pass == 2)
979 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
980 };
981
982 oper_user: USER '=' QSTRING ';'
983 {
984 if (conf_parser_ctx.pass == 2)
985 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
986 };
987
988 oper_password: PASSWORD '=' QSTRING ';'
989 {
990 if (conf_parser_ctx.pass == 2)
991 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
992 };
993
994 oper_whois: WHOIS '=' QSTRING ';'
995 {
996 if (conf_parser_ctx.pass == 2)
997 strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf));
998 };
999
1000 oper_encrypted: ENCRYPTED '=' TBOOL ';'
1001 {
1002 if (conf_parser_ctx.pass != 2)
1003 break;
1004
1005 if (yylval.number)
1006 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1007 else
1008 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1009 };
1010
1011 oper_tls_certificate_fingerprint: TLS_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1012 {
1013 if (conf_parser_ctx.pass == 2)
1014 strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1015 };
1016
1017 oper_tls_connection_required: TLS_CONNECTION_REQUIRED '=' TBOOL ';'
1018 {
1019 if (conf_parser_ctx.pass != 2)
1020 break;
1021
1022 if (yylval.number)
1023 block_state.flags.value |= CONF_FLAGS_TLS;
1024 else
1025 block_state.flags.value &= ~CONF_FLAGS_TLS;
1026 };
1027
1028 oper_class: CLASS '=' QSTRING ';'
1029 {
1030 if (conf_parser_ctx.pass == 2)
1031 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1032 };
1033
1034 oper_umodes: T_UMODES
1035 {
1036 if (conf_parser_ctx.pass == 2)
1037 block_state.modes.value = 0;
1038 } '=' oper_umodes_items ';' ;
1039
1040 oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1041 oper_umodes_item: T_BOTS
1042 {
1043 if (conf_parser_ctx.pass == 2)
1044 block_state.modes.value |= UMODE_BOTS;
1045 } | T_CCONN
1046 {
1047 if (conf_parser_ctx.pass == 2)
1048 block_state.modes.value |= UMODE_CCONN;
1049 } | T_DEAF
1050 {
1051 if (conf_parser_ctx.pass == 2)
1052 block_state.modes.value |= UMODE_DEAF;
1053 } | T_DEBUG
1054 {
1055 if (conf_parser_ctx.pass == 2)
1056 block_state.modes.value |= UMODE_DEBUG;
1057 } | T_FULL
1058 {
1059 if (conf_parser_ctx.pass == 2)
1060 block_state.modes.value |= UMODE_FULL;
1061 } | HIDDEN
1062 {
1063 if (conf_parser_ctx.pass == 2)
1064 block_state.modes.value |= UMODE_HIDDEN;
1065 } | HIDE_CHANS
1066 {
1067 if (conf_parser_ctx.pass == 2)
1068 block_state.modes.value |= UMODE_HIDECHANS;
1069 } | HIDE_IDLE
1070 {
1071 if (conf_parser_ctx.pass == 2)
1072 block_state.modes.value |= UMODE_HIDEIDLE;
1073 } | T_SKILL
1074 {
1075 if (conf_parser_ctx.pass == 2)
1076 block_state.modes.value |= UMODE_SKILL;
1077 } | T_NCHANGE
1078 {
1079 if (conf_parser_ctx.pass == 2)
1080 block_state.modes.value |= UMODE_NCHANGE;
1081 } | T_REJ
1082 {
1083 if (conf_parser_ctx.pass == 2)
1084 block_state.modes.value |= UMODE_REJ;
1085 } | T_UNAUTH
1086 {
1087 if (conf_parser_ctx.pass == 2)
1088 block_state.modes.value |= UMODE_UNAUTH;
1089 } | T_SPY
1090 {
1091 if (conf_parser_ctx.pass == 2)
1092 block_state.modes.value |= UMODE_SPY;
1093 } | T_EXTERNAL
1094 {
1095 if (conf_parser_ctx.pass == 2)
1096 block_state.modes.value |= UMODE_EXTERNAL;
1097 } | T_SERVNOTICE
1098 {
1099 if (conf_parser_ctx.pass == 2)
1100 block_state.modes.value |= UMODE_SERVNOTICE;
1101 } | T_INVISIBLE
1102 {
1103 if (conf_parser_ctx.pass == 2)
1104 block_state.modes.value |= UMODE_INVISIBLE;
1105 } | T_WALLOP
1106 {
1107 if (conf_parser_ctx.pass == 2)
1108 block_state.modes.value |= UMODE_WALLOP;
1109 } | T_SOFTCALLERID
1110 {
1111 if (conf_parser_ctx.pass == 2)
1112 block_state.modes.value |= UMODE_SOFTCALLERID;
1113 } | T_CALLERID
1114 {
1115 if (conf_parser_ctx.pass == 2)
1116 block_state.modes.value |= UMODE_CALLERID;
1117 } | T_LOCOPS
1118 {
1119 if (conf_parser_ctx.pass == 2)
1120 block_state.modes.value |= UMODE_LOCOPS;
1121 } | T_NONONREG
1122 {
1123 if (conf_parser_ctx.pass == 2)
1124 block_state.modes.value |= UMODE_REGONLY;
1125 } | T_FARCONNECT
1126 {
1127 if (conf_parser_ctx.pass == 2)
1128 block_state.modes.value |= UMODE_FARCONNECT;
1129 } | EXPIRATION
1130 {
1131 if (conf_parser_ctx.pass == 2)
1132 block_state.modes.value |= UMODE_EXPIRATION;
1133 };
1134
1135 oper_flags: IRCD_FLAGS
1136 {
1137 if (conf_parser_ctx.pass == 2)
1138 block_state.port.value = 0;
1139 } '=' oper_flags_items ';';
1140
1141 oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1142 oper_flags_item: KILL ':' REMOTE
1143 {
1144 if (conf_parser_ctx.pass == 2)
1145 block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1146 } | KILL
1147 {
1148 if (conf_parser_ctx.pass == 2)
1149 block_state.port.value |= OPER_FLAG_KILL;
1150 } | CONNECT ':' REMOTE
1151 {
1152 if (conf_parser_ctx.pass == 2)
1153 block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1154 } | CONNECT
1155 {
1156 if (conf_parser_ctx.pass == 2)
1157 block_state.port.value |= OPER_FLAG_CONNECT;
1158 } | SQUIT ':' REMOTE
1159 {
1160 if (conf_parser_ctx.pass == 2)
1161 block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1162 } | SQUIT
1163 {
1164 if (conf_parser_ctx.pass == 2)
1165 block_state.port.value |= OPER_FLAG_SQUIT;
1166 } | KLINE
1167 {
1168 if (conf_parser_ctx.pass == 2)
1169 block_state.port.value |= OPER_FLAG_KLINE;
1170 } | UNKLINE
1171 {
1172 if (conf_parser_ctx.pass == 2)
1173 block_state.port.value |= OPER_FLAG_UNKLINE;
1174 } | T_DLINE
1175 {
1176 if (conf_parser_ctx.pass == 2)
1177 block_state.port.value |= OPER_FLAG_DLINE;
1178 } | T_UNDLINE
1179 {
1180 if (conf_parser_ctx.pass == 2)
1181 block_state.port.value |= OPER_FLAG_UNDLINE;
1182 } | XLINE
1183 {
1184 if (conf_parser_ctx.pass == 2)
1185 block_state.port.value |= OPER_FLAG_XLINE;
1186 } | T_UNXLINE
1187 {
1188 if (conf_parser_ctx.pass == 2)
1189 block_state.port.value |= OPER_FLAG_UNXLINE;
1190 } | DIE
1191 {
1192 if (conf_parser_ctx.pass == 2)
1193 block_state.port.value |= OPER_FLAG_DIE;
1194 } | T_RESTART
1195 {
1196 if (conf_parser_ctx.pass == 2)
1197 block_state.port.value |= OPER_FLAG_RESTART;
1198 } | REHASH ':' REMOTE
1199 {
1200 if (conf_parser_ctx.pass == 2)
1201 block_state.port.value |= OPER_FLAG_REHASH_REMOTE;
1202 } | REHASH
1203 {
1204 if (conf_parser_ctx.pass == 2)
1205 block_state.port.value |= OPER_FLAG_REHASH;
1206 } | ADMIN
1207 {
1208 if (conf_parser_ctx.pass == 2)
1209 block_state.port.value |= OPER_FLAG_ADMIN;
1210 } | T_GLOBOPS
1211 {
1212 if (conf_parser_ctx.pass == 2)
1213 block_state.port.value |= OPER_FLAG_GLOBOPS;
1214 } | T_WALLOPS
1215 {
1216 if (conf_parser_ctx.pass == 2)
1217 block_state.port.value |= OPER_FLAG_WALLOPS;
1218 } | T_LOCOPS
1219 {
1220 if (conf_parser_ctx.pass == 2)
1221 block_state.port.value |= OPER_FLAG_LOCOPS;
1222 } | REMOTEBAN
1223 {
1224 if (conf_parser_ctx.pass == 2)
1225 block_state.port.value |= OPER_FLAG_REMOTEBAN;
1226 } | T_SET
1227 {
1228 if (conf_parser_ctx.pass == 2)
1229 block_state.port.value |= OPER_FLAG_SET;
1230 } | MODULE
1231 {
1232 if (conf_parser_ctx.pass == 2)
1233 block_state.port.value |= OPER_FLAG_MODULE;
1234 } | T_OPME
1235 {
1236 if (conf_parser_ctx.pass == 2)
1237 block_state.port.value |= OPER_FLAG_OPME;
1238 } | NICK ':' RESV
1239 {
1240 if (conf_parser_ctx.pass == 2)
1241 block_state.port.value |= OPER_FLAG_NICK_RESV;
1242 } | JOIN ':' RESV
1243 {
1244 if (conf_parser_ctx.pass == 2)
1245 block_state.port.value |= OPER_FLAG_JOIN_RESV;
1246 } | RESV
1247 {
1248 if (conf_parser_ctx.pass == 2)
1249 block_state.port.value |= OPER_FLAG_RESV;
1250 } | T_UNRESV
1251 {
1252 if (conf_parser_ctx.pass == 2)
1253 block_state.port.value |= OPER_FLAG_UNRESV;
1254 } | CLOSE
1255 {
1256 if (conf_parser_ctx.pass == 2)
1257 block_state.port.value |= OPER_FLAG_CLOSE;
1258 };
1259
1260
1261 /***************************************************************************
1262 * class {} section
1263 ***************************************************************************/
1264 class_entry: CLASS
1265 {
1266 if (conf_parser_ctx.pass != 1)
1267 break;
1268
1269 reset_block_state();
1270
1271 block_state.ping_freq.value = DEFAULT_PINGFREQUENCY;
1272 block_state.con_freq.value = DEFAULT_CONNECTFREQUENCY;
1273 block_state.max_sendq.value = DEFAULT_SENDQ;
1274 block_state.max_recvq.value = DEFAULT_RECVQ;
1275 } '{' class_items '}' ';'
1276 {
1277 if (conf_parser_ctx.pass != 1)
1278 break;
1279
1280 if (!block_state.class.buf[0])
1281 break;
1282
1283 struct ClassItem *class = class_find(block_state.class.buf, false);
1284 if (class == NULL)
1285 class = class_make();
1286
1287 class->active = true;
1288 xfree(class->name);
1289 class->name = xstrdup(block_state.class.buf);
1290 class->ping_freq = block_state.ping_freq.value;
1291 class->max_perip_local = block_state.max_perip_local.value;
1292 class->max_perip_global = block_state.max_perip_global.value;
1293 class->con_freq = block_state.con_freq.value;
1294 class->max_total = block_state.max_total.value;
1295 class->max_sendq = block_state.max_sendq.value;
1296 class->max_recvq = block_state.max_recvq.value;
1297 class->max_channels = block_state.max_channels.value;
1298
1299 if (block_state.min_idle.value > block_state.max_idle.value)
1300 {
1301 block_state.min_idle.value = 0;
1302 block_state.max_idle.value = 0;
1303 block_state.flags.value &= ~CLASS_FLAGS_FAKE_IDLE;
1304 }
1305
1306 class->flags = block_state.flags.value;
1307 class->min_idle = block_state.min_idle.value;
1308 class->max_idle = block_state.max_idle.value;
1309
1310 bool diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value ||
1311 class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value);
1312 class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1313 class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1314 class->number_per_cidr = block_state.number_per_cidr.value;
1315
1316 if (diff)
1317 class_ip_limit_rebuild(class);
1318 };
1319
1320 class_items: class_items class_item | class_item;
1321 class_item: class_name |
1322 class_cidr_bitlen_ipv4 |
1323 class_cidr_bitlen_ipv6 |
1324 class_ping_time |
1325 class_number_per_cidr |
1326 class_number_per_ip_local |
1327 class_number_per_ip_global |
1328 class_connectfreq |
1329 class_max_channels |
1330 class_max_number |
1331 class_sendq |
1332 class_recvq |
1333 class_min_idle |
1334 class_max_idle |
1335 class_flags |
1336 error ';' ;
1337
1338 class_name: NAME '=' QSTRING ';'
1339 {
1340 if (conf_parser_ctx.pass == 1)
1341 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1342 };
1343
1344 class_ping_time: PING_TIME '=' timespec ';'
1345 {
1346 if (conf_parser_ctx.pass == 1)
1347 block_state.ping_freq.value = $3;
1348 };
1349
1350 class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';'
1351 {
1352 if (conf_parser_ctx.pass == 1)
1353 block_state.max_perip_local.value = $3;
1354 };
1355
1356 class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';'
1357 {
1358 if (conf_parser_ctx.pass == 1)
1359 block_state.max_perip_global.value = $3;
1360 };
1361
1362 class_connectfreq: CONNECTFREQ '=' timespec ';'
1363 {
1364 if (conf_parser_ctx.pass == 1)
1365 block_state.con_freq.value = $3;
1366 };
1367
1368 class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1369 {
1370 if (conf_parser_ctx.pass == 1)
1371 block_state.max_channels.value = $3;
1372 };
1373
1374 class_max_number: MAX_NUMBER '=' NUMBER ';'
1375 {
1376 if (conf_parser_ctx.pass == 1)
1377 block_state.max_total.value = $3;
1378 };
1379
1380 class_sendq: SENDQ '=' sizespec ';'
1381 {
1382 if (conf_parser_ctx.pass == 1)
1383 block_state.max_sendq.value = $3;
1384 };
1385
1386 class_recvq: T_RECVQ '=' sizespec ';'
1387 {
1388 if (conf_parser_ctx.pass == 1)
1389 if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1390 block_state.max_recvq.value = $3;
1391 };
1392
1393 class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1394 {
1395 if (conf_parser_ctx.pass == 1)
1396 block_state.cidr_bitlen_ipv4.value = $3 > 32 ? 32 : $3;
1397 };
1398
1399 class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1400 {
1401 if (conf_parser_ctx.pass == 1)
1402 block_state.cidr_bitlen_ipv6.value = $3 > 128 ? 128 : $3;
1403 };
1404
1405 class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1406 {
1407 if (conf_parser_ctx.pass == 1)
1408 block_state.number_per_cidr.value = $3;
1409 };
1410
1411 class_min_idle: MIN_IDLE '=' timespec ';'
1412 {
1413 if (conf_parser_ctx.pass != 1)
1414 break;
1415
1416 block_state.min_idle.value = $3;
1417 block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1418 };
1419
1420 class_max_idle: MAX_IDLE '=' timespec ';'
1421 {
1422 if (conf_parser_ctx.pass != 1)
1423 break;
1424
1425 block_state.max_idle.value = $3;
1426 block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1427 };
1428
1429 class_flags: IRCD_FLAGS
1430 {
1431 if (conf_parser_ctx.pass == 1)
1432 block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE;
1433 } '=' class_flags_items ';';
1434
1435 class_flags_items: class_flags_items ',' class_flags_item | class_flags_item;
1436 class_flags_item: RANDOM_IDLE
1437 {
1438 if (conf_parser_ctx.pass == 1)
1439 block_state.flags.value |= CLASS_FLAGS_RANDOM_IDLE;
1440 } | HIDE_IDLE_FROM_OPERS
1441 {
1442 if (conf_parser_ctx.pass == 1)
1443 block_state.flags.value |= CLASS_FLAGS_HIDE_IDLE_FROM_OPERS;
1444 };
1445
1446
1447 /***************************************************************************
1448 * listen {} section
1449 ***************************************************************************/
1450 listen_entry: LISTEN
1451 {
1452 if (conf_parser_ctx.pass == 2)
1453 reset_block_state();
1454 } '{' listen_items '}' ';';
1455
1456 listen_flags: IRCD_FLAGS
1457 {
1458 block_state.flags.value = 0;
1459 } '=' listen_flags_items ';';
1460
1461 listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1462 listen_flags_item: T_TLS
1463 {
1464 if (conf_parser_ctx.pass == 2)
1465 block_state.flags.value |= LISTENER_TLS;
1466 } | HIDDEN
1467 {
1468 if (conf_parser_ctx.pass == 2)
1469 block_state.flags.value |= LISTENER_HIDDEN;
1470 } | T_SERVER
1471 {
1472 if (conf_parser_ctx.pass == 2)
1473 block_state.flags.value |= LISTENER_SERVER;
1474 } | CLIENT
1475 {
1476 if (conf_parser_ctx.pass == 2)
1477 block_state.flags.value |= LISTENER_CLIENT;
1478 };
1479
1480 listen_items: listen_items listen_item | listen_item;
1481 listen_item: listen_port | listen_flags | listen_address | listen_host | error ';';
1482
1483 listen_port: PORT '=' port_items { block_state.flags.value = 0; } ';';
1484
1485 port_items: port_items ',' port_item | port_item;
1486
1487 port_item: NUMBER
1488 {
1489 if (conf_parser_ctx.pass == 2)
1490 {
1491 #ifndef HAVE_TLS
1492 if (block_state.flags.value & LISTENER_TLS)
1493 {
1494 conf_error_report("TLS not available - port closed");
1495 break;
1496 }
1497 #endif
1498 listener_add($1, block_state.addr.buf, block_state.flags.value);
1499 }
1500 } | NUMBER TWODOTS NUMBER
1501 {
1502 if (conf_parser_ctx.pass == 2)
1503 {
1504 #ifndef HAVE_TLS
1505 if (block_state.flags.value & LISTENER_TLS)
1506 {
1507 conf_error_report("TLS not available - port closed");
1508 break;
1509 }
1510 #endif
1511
1512 for (int i = $1; i <= $3; ++i)
1513 listener_add(i, block_state.addr.buf, block_state.flags.value);
1514 }
1515 };
1516
1517 listen_address: IP '=' QSTRING ';'
1518 {
1519 if (conf_parser_ctx.pass == 2)
1520 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1521 };
1522
1523 listen_host: HOST '=' QSTRING ';'
1524 {
1525 if (conf_parser_ctx.pass == 2)
1526 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1527 };
1528
1529
1530 /***************************************************************************
1531 * auth {} section
1532 ***************************************************************************/
1533 auth_entry: IRCD_AUTH
1534 {
1535 if (conf_parser_ctx.pass == 2)
1536 reset_block_state();
1537 } '{' auth_items '}' ';'
1538 {
1539 dlink_node *node;
1540
1541 if (conf_parser_ctx.pass != 2)
1542 break;
1543
1544 DLINK_FOREACH(node, block_state.mask.list.head)
1545 {
1546 struct split_nuh_item nuh;
1547 char *s = node->data;
1548
1549 if (EmptyString(s))
1550 continue;
1551
1552 nuh.nuhmask = s;
1553 nuh.nickptr = NULL;
1554 nuh.userptr = block_state.user.buf;
1555 nuh.hostptr = block_state.host.buf;
1556
1557 nuh.nicksize = 0;
1558 nuh.usersize = sizeof(block_state.user.buf);
1559 nuh.hostsize = sizeof(block_state.host.buf);
1560
1561 split_nuh(&nuh);
1562
1563 struct MaskItem *conf = conf_make(CONF_CLIENT);
1564 conf->user = xstrdup(block_state.user.buf);
1565 conf->host = xstrdup(block_state.host.buf);
1566
1567 if (block_state.rpass.buf[0])
1568 conf->passwd = xstrdup(block_state.rpass.buf);
1569 if (block_state.name.buf[0])
1570 conf->name = xstrdup(block_state.name.buf);
1571
1572 conf->flags = block_state.flags.value;
1573 conf->port = block_state.port.value;
1574
1575 conf_add_class_to_conf(conf, block_state.class.buf);
1576 add_conf_by_address(CONF_CLIENT, conf);
1577 }
1578 };
1579
1580 auth_items: auth_items auth_item | auth_item;
1581 auth_item: auth_user |
1582 auth_passwd |
1583 auth_class |
1584 auth_flags |
1585 auth_spoof |
1586 auth_redir_serv |
1587 auth_redir_port |
1588 auth_encrypted |
1589 error ';' ;
1590
1591 auth_user: USER '=' QSTRING ';'
1592 {
1593 if (conf_parser_ctx.pass == 2)
1594 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1595 };
1596
1597 auth_passwd: PASSWORD '=' QSTRING ';'
1598 {
1599 if (conf_parser_ctx.pass == 2)
1600 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1601 };
1602
1603 auth_class: CLASS '=' QSTRING ';'
1604 {
1605 if (conf_parser_ctx.pass == 2)
1606 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1607 };
1608
1609 auth_encrypted: ENCRYPTED '=' TBOOL ';'
1610 {
1611 if (conf_parser_ctx.pass == 2)
1612 {
1613 if (yylval.number)
1614 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1615 else
1616 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1617 }
1618 };
1619
1620 auth_flags: IRCD_FLAGS
1621 {
1622 if (conf_parser_ctx.pass == 2)
1623 block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1624 } '=' auth_flags_items ';';
1625
1626 auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1627 auth_flags_item: EXCEED_LIMIT
1628 {
1629 if (conf_parser_ctx.pass == 2)
1630 block_state.flags.value |= CONF_FLAGS_NOLIMIT;
1631 } | KLINE_EXEMPT
1632 {
1633 if (conf_parser_ctx.pass == 2)
1634 block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1635 } | XLINE_EXEMPT
1636 {
1637 if (conf_parser_ctx.pass == 2)
1638 block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1639 } | NEED_IDENT
1640 {
1641 if (conf_parser_ctx.pass == 2)
1642 block_state.flags.value |= CONF_FLAGS_NEED_IDENTD;
1643 } | CAN_FLOOD
1644 {
1645 if (conf_parser_ctx.pass == 2)
1646 block_state.flags.value |= CONF_FLAGS_CAN_FLOOD;
1647 } | NO_TILDE
1648 {
1649 if (conf_parser_ctx.pass == 2)
1650 block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1651 } | RESV_EXEMPT
1652 {
1653 if (conf_parser_ctx.pass == 2)
1654 block_state.flags.value |= CONF_FLAGS_EXEMPTRESV;
1655 } | T_WEBIRC
1656 {
1657 if (conf_parser_ctx.pass == 2)
1658 block_state.flags.value |= CONF_FLAGS_WEBIRC;
1659 } | NEED_PASSWORD
1660 {
1661 if (conf_parser_ctx.pass == 2)
1662 block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1663 };
1664
1665 auth_spoof: SPOOF '=' QSTRING ';'
1666 {
1667 if (conf_parser_ctx.pass != 2)
1668 break;
1669
1670 if (valid_hostname(yylval.string))
1671 {
1672 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1673 block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
1674 }
1675 else
1676 ilog(LOG_TYPE_IRCD, "Spoof either is too long or contains invalid characters. Ignoring it.");
1677 };
1678
1679 auth_redir_serv: REDIRSERV '=' QSTRING ';'
1680 {
1681 if (conf_parser_ctx.pass != 2)
1682 break;
1683
1684 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1685 block_state.flags.value |= CONF_FLAGS_REDIR;
1686 };
1687
1688 auth_redir_port: REDIRPORT '=' NUMBER ';'
1689 {
1690 if (conf_parser_ctx.pass != 2)
1691 break;
1692
1693 block_state.flags.value |= CONF_FLAGS_REDIR;
1694 block_state.port.value = $3;
1695 };
1696
1697
1698 /***************************************************************************
1699 * resv {} section
1700 ***************************************************************************/
1701 resv_entry: RESV
1702 {
1703 if (conf_parser_ctx.pass != 2)
1704 break;
1705
1706 reset_block_state();
1707 strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1708 } '{' resv_items '}' ';'
1709 {
1710 if (conf_parser_ctx.pass != 2)
1711 break;
1712
1713 resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1714 };
1715
1716 resv_items: resv_items resv_item | resv_item;
1717 resv_item: resv_mask | resv_reason | resv_exempt | error ';' ;
1718
1719 resv_mask: MASK '=' QSTRING ';'
1720 {
1721 if (conf_parser_ctx.pass == 2)
1722 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1723 };
1724
1725 resv_reason: REASON '=' QSTRING ';'
1726 {
1727 if (conf_parser_ctx.pass == 2)
1728 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1729 };
1730
1731 resv_exempt: EXEMPT '=' QSTRING ';'
1732 {
1733 if (conf_parser_ctx.pass == 2)
1734 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1735 };
1736
1737
1738 /***************************************************************************
1739 * service {} section
1740 ***************************************************************************/
1741 service_entry: T_SERVICE '{' service_items '}' ';';
1742
1743 service_items: service_items service_item | service_item;
1744 service_item: service_name | error;
1745
1746 service_name: NAME '=' QSTRING ';'
1747 {
1748 if (conf_parser_ctx.pass != 2)
1749 break;
1750
1751 if (server_valid_name(yylval.string) == true)
1752 {
1753 struct ServiceItem *service = service_make();
1754 service->name = xstrdup(yylval.string);
1755 }
1756 };
1757
1758
1759 /***************************************************************************
1760 * shared {} section, for sharing remote klines etc.
1761 ***************************************************************************/
1762 shared_entry: T_SHARED
1763 {
1764 if (conf_parser_ctx.pass != 2)
1765 break;
1766
1767 reset_block_state();
1768
1769 strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1770 strlcpy(block_state.user.buf, "*", sizeof(block_state.user.buf));
1771 strlcpy(block_state.host.buf, "*", sizeof(block_state.host.buf));
1772 block_state.flags.value = SHARED_ALL;
1773 } '{' shared_items '}' ';'
1774 {
1775 if (conf_parser_ctx.pass != 2)
1776 break;
1777
1778 struct SharedItem *shared = shared_make();
1779 shared->type = block_state.flags.value;
1780 shared->server = xstrdup(block_state.name.buf);
1781 shared->user = xstrdup(block_state.user.buf);
1782 shared->host = xstrdup(block_state.host.buf);
1783 };
1784
1785 shared_items: shared_items shared_item | shared_item;
1786 shared_item: shared_name | shared_user | shared_type | error ';' ;
1787
1788 shared_name: NAME '=' QSTRING ';'
1789 {
1790 if (conf_parser_ctx.pass == 2)
1791 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1792 };
1793
1794 shared_user: USER '=' QSTRING ';'
1795 {
1796 if (conf_parser_ctx.pass == 2)
1797 {
1798 struct split_nuh_item nuh;
1799
1800 nuh.nuhmask = yylval.string;
1801 nuh.nickptr = NULL;
1802 nuh.userptr = block_state.user.buf;
1803 nuh.hostptr = block_state.host.buf;
1804
1805 nuh.nicksize = 0;
1806 nuh.usersize = sizeof(block_state.user.buf);
1807 nuh.hostsize = sizeof(block_state.host.buf);
1808
1809 split_nuh(&nuh);
1810 }
1811 };
1812
1813 shared_type: TYPE
1814 {
1815 if (conf_parser_ctx.pass == 2)
1816 block_state.flags.value = 0;
1817 } '=' shared_types ';' ;
1818
1819 shared_types: shared_types ',' shared_type_item | shared_type_item;
1820 shared_type_item: KLINE
1821 {
1822 if (conf_parser_ctx.pass == 2)
1823 block_state.flags.value |= SHARED_KLINE;
1824 } | UNKLINE
1825 {
1826 if (conf_parser_ctx.pass == 2)
1827 block_state.flags.value |= SHARED_UNKLINE;
1828 } | T_DLINE
1829 {
1830 if (conf_parser_ctx.pass == 2)
1831 block_state.flags.value |= SHARED_DLINE;
1832 } | T_UNDLINE
1833 {
1834 if (conf_parser_ctx.pass == 2)
1835 block_state.flags.value |= SHARED_UNDLINE;
1836 } | XLINE
1837 {
1838 if (conf_parser_ctx.pass == 2)
1839 block_state.flags.value |= SHARED_XLINE;
1840 } | T_UNXLINE
1841 {
1842 if (conf_parser_ctx.pass == 2)
1843 block_state.flags.value |= SHARED_UNXLINE;
1844 } | RESV
1845 {
1846 if (conf_parser_ctx.pass == 2)
1847 block_state.flags.value |= SHARED_RESV;
1848 } | T_UNRESV
1849 {
1850 if (conf_parser_ctx.pass == 2)
1851 block_state.flags.value |= SHARED_UNRESV;
1852 } | T_LOCOPS
1853 {
1854 if (conf_parser_ctx.pass == 2)
1855 block_state.flags.value |= SHARED_LOCOPS;
1856 } | T_ALL
1857 {
1858 if (conf_parser_ctx.pass == 2)
1859 block_state.flags.value = SHARED_ALL;
1860 };
1861
1862
1863 /***************************************************************************
1864 * cluster {} section
1865 ***************************************************************************/
1866 cluster_entry: T_CLUSTER
1867 {
1868 if (conf_parser_ctx.pass != 2)
1869 break;
1870
1871 reset_block_state();
1872
1873 strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1874 block_state.flags.value = CLUSTER_ALL;
1875 } '{' cluster_items '}' ';'
1876 {
1877 if (conf_parser_ctx.pass != 2)
1878 break;
1879
1880 struct ClusterItem *cluster = cluster_make();
1881 cluster->type = block_state.flags.value;
1882 cluster->server = xstrdup(block_state.name.buf);
1883 };
1884
1885 cluster_items: cluster_items cluster_item | cluster_item;
1886 cluster_item: cluster_name | cluster_type | error ';' ;
1887
1888 cluster_name: NAME '=' QSTRING ';'
1889 {
1890 if (conf_parser_ctx.pass == 2)
1891 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1892 };
1893
1894 cluster_type: TYPE
1895 {
1896 if (conf_parser_ctx.pass == 2)
1897 block_state.flags.value = 0;
1898 } '=' cluster_types ';' ;
1899
1900 cluster_types: cluster_types ',' cluster_type_item | cluster_type_item;
1901 cluster_type_item: KLINE
1902 {
1903 if (conf_parser_ctx.pass == 2)
1904 block_state.flags.value |= CLUSTER_KLINE;
1905 } | UNKLINE
1906 {
1907 if (conf_parser_ctx.pass == 2)
1908 block_state.flags.value |= CLUSTER_UNKLINE;
1909 } | T_DLINE
1910 {
1911 if (conf_parser_ctx.pass == 2)
1912 block_state.flags.value |= CLUSTER_DLINE;
1913 } | T_UNDLINE
1914 {
1915 if (conf_parser_ctx.pass == 2)
1916 block_state.flags.value |= CLUSTER_UNDLINE;
1917 } | XLINE
1918 {
1919 if (conf_parser_ctx.pass == 2)
1920 block_state.flags.value |= CLUSTER_XLINE;
1921 } | T_UNXLINE
1922 {
1923 if (conf_parser_ctx.pass == 2)
1924 block_state.flags.value |= CLUSTER_UNXLINE;
1925 } | RESV
1926 {
1927 if (conf_parser_ctx.pass == 2)
1928 block_state.flags.value |= CLUSTER_RESV;
1929 } | T_UNRESV
1930 {
1931 if (conf_parser_ctx.pass == 2)
1932 block_state.flags.value |= CLUSTER_UNRESV;
1933 } | T_LOCOPS
1934 {
1935 if (conf_parser_ctx.pass == 2)
1936 block_state.flags.value |= CLUSTER_LOCOPS;
1937 } | T_ALL
1938 {
1939 if (conf_parser_ctx.pass == 2)
1940 block_state.flags.value = CLUSTER_ALL;
1941 };
1942
1943
1944 /***************************************************************************
1945 * connect {} section
1946 ***************************************************************************/
1947 connect_entry: CONNECT
1948 {
1949
1950 if (conf_parser_ctx.pass != 2)
1951 break;
1952
1953 reset_block_state();
1954 block_state.aftype.value = AF_INET;
1955 block_state.port.value = PORTNUM;
1956 block_state.timeout.value = CONNECTTIMEOUT;
1957 } '{' connect_items '}' ';'
1958 {
1959 struct addrinfo hints, *res;
1960
1961 if (conf_parser_ctx.pass != 2)
1962 break;
1963
1964 if (!block_state.name.buf[0] ||
1965 !block_state.host.buf[0])
1966 break;
1967
1968 if (!block_state.rpass.buf[0] ||
1969 !block_state.spass.buf[0])
1970 break;
1971
1972 if (server_valid_name(block_state.name.buf) == false)
1973 break;
1974
1975 if (has_wildcards(block_state.name.buf) ||
1976 has_wildcards(block_state.host.buf))
1977 break;
1978
1979 struct MaskItem *conf = conf_make(CONF_SERVER);
1980 conf->addr = xcalloc(sizeof(*conf->addr));
1981 conf->port = block_state.port.value;
1982 conf->timeout = block_state.timeout.value;
1983 conf->flags = block_state.flags.value;
1984 conf->aftype = block_state.aftype.value;
1985 conf->host = xstrdup(block_state.host.buf);
1986 conf->name = xstrdup(block_state.name.buf);
1987 conf->passwd = xstrdup(block_state.rpass.buf);
1988 conf->spasswd = xstrdup(block_state.spass.buf);
1989
1990 if (block_state.cert.buf[0])
1991 conf->certfp = xstrdup(block_state.cert.buf);
1992
1993 if (block_state.ciph.buf[0])
1994 conf->cipher_list = xstrdup(block_state.ciph.buf);
1995
1996 dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
1997 dlinkMoveList(&block_state.hub.list, &conf->hub_list);
1998
1999 if (block_state.bind.buf[0])
2000 {
2001 memset(&hints, 0, sizeof(hints));
2002
2003 hints.ai_family = AF_UNSPEC;
2004 hints.ai_socktype = SOCK_STREAM;
2005 hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2006
2007 if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2008 ilog(LOG_TYPE_IRCD, "Invalid netmask for server bind(%s)", block_state.bind.buf);
2009 else
2010 {
2011 assert(res);
2012
2013 conf->bind = xcalloc(sizeof(*conf->bind));
2014
2015 memcpy(conf->bind, res->ai_addr, res->ai_addrlen);
2016 conf->bind->ss_len = res->ai_addrlen;
2017 freeaddrinfo(res);
2018 }
2019 }
2020
2021 conf_add_class_to_conf(conf, block_state.class.buf);
2022 conf_dns_lookup(conf);
2023 };
2024
2025 connect_items: connect_items connect_item | connect_item;
2026 connect_item: connect_name |
2027 connect_host |
2028 connect_timeout |
2029 connect_bind |
2030 connect_send_password |
2031 connect_accept_password |
2032 connect_tls_certificate_fingerprint |
2033 connect_aftype |
2034 connect_port |
2035 connect_tls_cipher_list |
2036 connect_flags |
2037 connect_hub_mask |
2038 connect_leaf_mask |
2039 connect_class |
2040 connect_encrypted |
2041 error ';' ;
2042
2043 connect_name: NAME '=' QSTRING ';'
2044 {
2045 if (conf_parser_ctx.pass == 2)
2046 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2047 };
2048
2049 connect_host: HOST '=' QSTRING ';'
2050 {
2051 if (conf_parser_ctx.pass == 2)
2052 strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2053 };
2054
2055 connect_timeout: TIMEOUT '=' timespec ';'
2056 {
2057 if (conf_parser_ctx.pass == 2)
2058 block_state.timeout.value = $3;
2059 };
2060
2061 connect_bind: T_BIND '=' QSTRING ';'
2062 {
2063 if (conf_parser_ctx.pass == 2)
2064 strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2065 };
2066
2067 connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2068 {
2069 if (conf_parser_ctx.pass != 2)
2070 break;
2071
2072 if (*yylval.string == ':')
2073 conf_error_report("Server passwords cannot begin with a colon");
2074 else if (strchr(yylval.string, ' '))
2075 conf_error_report("Server passwords cannot contain spaces");
2076 else
2077 strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
2078 };
2079
2080 connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2081 {
2082 if (conf_parser_ctx.pass != 2)
2083 break;
2084
2085 if (*yylval.string == ':')
2086 conf_error_report("Server passwords cannot begin with a colon");
2087 else if (strchr(yylval.string, ' '))
2088 conf_error_report("Server passwords cannot contain spaces");
2089 else
2090 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2091 };
2092
2093 connect_tls_certificate_fingerprint: TLS_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2094 {
2095 if (conf_parser_ctx.pass == 2)
2096 strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2097 };
2098
2099 connect_port: PORT '=' NUMBER ';'
2100 {
2101 if (conf_parser_ctx.pass == 2)
2102 block_state.port.value = $3;
2103 };
2104
2105 connect_aftype: AFTYPE '=' T_IPV4 ';'
2106 {
2107 if (conf_parser_ctx.pass == 2)
2108 block_state.aftype.value = AF_INET;
2109 } | AFTYPE '=' T_IPV6 ';'
2110 {
2111 if (conf_parser_ctx.pass == 2)
2112 block_state.aftype.value = AF_INET6;
2113 };
2114
2115 connect_flags: IRCD_FLAGS
2116 {
2117 block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2118 } '=' connect_flags_items ';';
2119
2120 connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2121 connect_flags_item: AUTOCONN
2122 {
2123 if (conf_parser_ctx.pass == 2)
2124 block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN;
2125 } | T_TLS
2126 {
2127 if (conf_parser_ctx.pass == 2)
2128 block_state.flags.value |= CONF_FLAGS_TLS;
2129 };
2130
2131 connect_encrypted: ENCRYPTED '=' TBOOL ';'
2132 {
2133 if (conf_parser_ctx.pass == 2)
2134 {
2135 if (yylval.number)
2136 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
2137 else
2138 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
2139 }
2140 };
2141
2142 connect_hub_mask: HUB_MASK '=' QSTRING ';'
2143 {
2144 if (conf_parser_ctx.pass == 2)
2145 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2146 };
2147
2148 connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2149 {
2150 if (conf_parser_ctx.pass == 2)
2151 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
2152 };
2153
2154 connect_class: CLASS '=' QSTRING ';'
2155 {
2156 if (conf_parser_ctx.pass == 2)
2157 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
2158 };
2159
2160 connect_tls_cipher_list: TLS_CIPHER_LIST '=' QSTRING ';'
2161 {
2162 #ifdef HAVE_TLS
2163 if (conf_parser_ctx.pass == 2)
2164 strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2165 #else
2166 if (conf_parser_ctx.pass == 2)
2167 conf_error_report("Ignoring connect::tls_cipher_list -- no TLS support");
2168 #endif
2169 };
2170
2171
2172 /***************************************************************************
2173 * kill {} section
2174 ***************************************************************************/
2175 kill_entry: KILL
2176 {
2177 if (conf_parser_ctx.pass == 2)
2178 reset_block_state();
2179 } '{' kill_items '}' ';'
2180 {
2181 if (conf_parser_ctx.pass != 2)
2182 break;
2183
2184 if (!block_state.user.buf[0] ||
2185 !block_state.host.buf[0])
2186 break;
2187
2188 struct MaskItem *conf = conf_make(CONF_KLINE);
2189 conf->user = xstrdup(block_state.user.buf);
2190 conf->host = xstrdup(block_state.host.buf);
2191
2192 if (block_state.rpass.buf[0])
2193 conf->reason = xstrdup(block_state.rpass.buf);
2194 else
2195 conf->reason = xstrdup(CONF_NOREASON);
2196 add_conf_by_address(CONF_KLINE, conf);
2197 };
2198
2199 kill_items: kill_items kill_item | kill_item;
2200 kill_item: kill_user | kill_reason | error;
2201
2202 kill_user: USER '=' QSTRING ';'
2203 {
2204
2205 if (conf_parser_ctx.pass == 2)
2206 {
2207 struct split_nuh_item nuh;
2208
2209 nuh.nuhmask = yylval.string;
2210 nuh.nickptr = NULL;
2211 nuh.userptr = block_state.user.buf;
2212 nuh.hostptr = block_state.host.buf;
2213
2214 nuh.nicksize = 0;
2215 nuh.usersize = sizeof(block_state.user.buf);
2216 nuh.hostsize = sizeof(block_state.host.buf);
2217
2218 split_nuh(&nuh);
2219 }
2220 };
2221
2222 kill_reason: REASON '=' QSTRING ';'
2223 {
2224 if (conf_parser_ctx.pass == 2)
2225 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2226 };
2227
2228
2229 /***************************************************************************
2230 * deny {} section
2231 ***************************************************************************/
2232 deny_entry: DENY
2233 {
2234 if (conf_parser_ctx.pass == 2)
2235 reset_block_state();
2236 } '{' deny_items '}' ';'
2237 {
2238 if (conf_parser_ctx.pass != 2)
2239 break;
2240
2241 if (!block_state.addr.buf[0])
2242 break;
2243
2244 if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2245 {
2246 struct MaskItem *conf = conf_make(CONF_DLINE);
2247 conf->host = xstrdup(block_state.addr.buf);
2248
2249 if (block_state.rpass.buf[0])
2250 conf->reason = xstrdup(block_state.rpass.buf);
2251 else
2252 conf->reason = xstrdup(CONF_NOREASON);
2253 add_conf_by_address(CONF_DLINE, conf);
2254 }
2255 };
2256
2257 deny_items: deny_items deny_item | deny_item;
2258 deny_item: deny_ip | deny_reason | error;
2259
2260 deny_ip: IP '=' QSTRING ';'
2261 {
2262 if (conf_parser_ctx.pass == 2)
2263 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2264 };
2265
2266 deny_reason: REASON '=' QSTRING ';'
2267 {
2268 if (conf_parser_ctx.pass == 2)
2269 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2270 };
2271
2272
2273 /***************************************************************************
2274 * exempt {} section
2275 ***************************************************************************/
2276 exempt_entry: EXEMPT '{' exempt_items '}' ';';
2277
2278 exempt_items: exempt_items exempt_item | exempt_item;
2279 exempt_item: exempt_ip | error;
2280
2281 exempt_ip: IP '=' QSTRING ';'
2282 {
2283 if (conf_parser_ctx.pass == 2)
2284 {
2285 if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2286 {
2287 struct MaskItem *conf = conf_make(CONF_EXEMPT);
2288 conf->host = xstrdup(yylval.string);
2289
2290 add_conf_by_address(CONF_EXEMPT, conf);
2291 }
2292 }
2293 };
2294
2295 /***************************************************************************
2296 * gecos {} section
2297 ***************************************************************************/
2298 gecos_entry: GECOS
2299 {
2300 if (conf_parser_ctx.pass == 2)
2301 reset_block_state();
2302 } '{' gecos_items '}' ';'
2303 {
2304 if (conf_parser_ctx.pass != 2)
2305 break;
2306
2307 if (!block_state.name.buf[0])
2308 break;
2309
2310 struct GecosItem *gecos = gecos_make();
2311 gecos->mask = xstrdup(block_state.name.buf);
2312
2313 if (block_state.rpass.buf[0])
2314 gecos->reason = xstrdup(block_state.rpass.buf);
2315 else
2316 gecos->reason = xstrdup(CONF_NOREASON);
2317 };
2318
2319 gecos_items: gecos_items gecos_item | gecos_item;
2320 gecos_item: gecos_name | gecos_reason | error;
2321
2322 gecos_name: NAME '=' QSTRING ';'
2323 {
2324 if (conf_parser_ctx.pass == 2)
2325 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2326 };
2327
2328 gecos_reason: REASON '=' QSTRING ';'
2329 {
2330 if (conf_parser_ctx.pass == 2)
2331 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2332 };
2333
2334
2335 /***************************************************************************
2336 * general {} section
2337 ***************************************************************************/
2338 general_entry: GENERAL '{' general_items '}' ';';
2339
2340 general_items: general_items general_item | general_item;
2341 general_item: general_away_count |
2342 general_away_time |
2343 general_failed_oper_notice |
2344 general_anti_nick_flood |
2345 general_max_nick_time |
2346 general_max_nick_changes |
2347 general_max_accept |
2348 general_whowas_history_length |
2349 general_anti_spam_exit_message_time |
2350 general_ts_warn_delta |
2351 general_ts_max_delta |
2352 general_kill_chase_time_limit |
2353 general_invisible_on_connect |
2354 general_warn_no_connect_block |
2355 general_dots_in_ident |
2356 general_stats_i_oper_only |
2357 general_stats_k_oper_only |
2358 general_stats_m_oper_only |
2359 general_stats_o_oper_only |
2360 general_stats_P_oper_only |
2361 general_stats_u_oper_only |
2362 general_pace_wait |
2363 general_pace_wait_simple |
2364 general_short_motd |
2365 general_no_oper_flood |
2366 general_oper_only_umodes |
2367 general_max_targets |
2368 general_oper_umodes |
2369 general_caller_id_wait |
2370 general_opers_bypass_callerid |
2371 general_default_floodcount |
2372 general_default_floodtime |
2373 general_min_nonwildcard |
2374 general_min_nonwildcard_simple |
2375 general_throttle_count |
2376 general_throttle_time |
2377 general_ping_cookie |
2378 general_disable_auth |
2379 general_dline_min_cidr |
2380 general_dline_min_cidr6 |
2381 general_kline_min_cidr |
2382 general_kline_min_cidr6 |
2383 general_stats_e_disabled |
2384 general_max_watch |
2385 general_cycle_on_host_change |
2386 error;
2387
2388
2389 general_away_count: AWAY_COUNT '=' NUMBER ';'
2390 {
2391 ConfigGeneral.away_count = $3;
2392 };
2393
2394 general_away_time: AWAY_TIME '=' timespec ';'
2395 {
2396 ConfigGeneral.away_time = $3;
2397 };
2398
2399 general_max_watch: MAX_WATCH '=' NUMBER ';'
2400 {
2401 ConfigGeneral.max_watch = $3;
2402 };
2403
2404 general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2405 {
2406 ConfigGeneral.whowas_history_length = $3;
2407 };
2408
2409 general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2410 {
2411 ConfigGeneral.cycle_on_host_change = yylval.number;
2412 };
2413
2414 general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2415 {
2416 ConfigGeneral.dline_min_cidr = $3;
2417 };
2418
2419 general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2420 {
2421 ConfigGeneral.dline_min_cidr6 = $3;
2422 };
2423
2424 general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2425 {
2426 ConfigGeneral.kline_min_cidr = $3;
2427 };
2428
2429 general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2430 {
2431 ConfigGeneral.kline_min_cidr6 = $3;
2432 };
2433
2434 general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2435 {
2436 ConfigGeneral.kill_chase_time_limit = $3;
2437 };
2438
2439 general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2440 {
2441 ConfigGeneral.failed_oper_notice = yylval.number;
2442 };
2443
2444 general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2445 {
2446 ConfigGeneral.anti_nick_flood = yylval.number;
2447 };
2448
2449 general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2450 {
2451 ConfigGeneral.max_nick_time = $3;
2452 };
2453
2454 general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2455 {
2456 ConfigGeneral.max_nick_changes = $3;
2457 };
2458
2459 general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2460 {
2461 ConfigGeneral.max_accept = $3;
2462 };
2463
2464 general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2465 {
2466 ConfigGeneral.anti_spam_exit_message_time = $3;
2467 };
2468
2469 general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2470 {
2471 ConfigGeneral.ts_warn_delta = $3;
2472 };
2473
2474 general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2475 {
2476 ConfigGeneral.ts_max_delta = $3;
2477 };
2478
2479 general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2480 {
2481 ConfigGeneral.invisible_on_connect = yylval.number;
2482 };
2483
2484 general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2485 {
2486 ConfigGeneral.warn_no_connect_block = yylval.number;
2487 };
2488
2489 general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2490 {
2491 ConfigGeneral.stats_e_disabled = yylval.number;
2492 };
2493
2494 general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2495 {
2496 ConfigGeneral.stats_m_oper_only = yylval.number;
2497 };
2498
2499 general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2500 {
2501 ConfigGeneral.stats_o_oper_only = yylval.number;
2502 };
2503
2504 general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2505 {
2506 ConfigGeneral.stats_P_oper_only = yylval.number;
2507 };
2508
2509 general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2510 {
2511 ConfigGeneral.stats_u_oper_only = yylval.number;
2512 };
2513
2514 general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2515 {
2516 ConfigGeneral.stats_k_oper_only = yylval.number;
2517 };
2518
2519 general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2520 {
2521 ConfigGeneral.stats_i_oper_only = yylval.number;
2522 };
2523
2524 general_pace_wait: PACE_WAIT '=' timespec ';'
2525 {
2526 ConfigGeneral.pace_wait = $3;
2527 };
2528
2529 general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2530 {
2531 ConfigGeneral.caller_id_wait = $3;
2532 };
2533
2534 general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2535 {
2536 ConfigGeneral.opers_bypass_callerid = yylval.number;
2537 };
2538
2539 general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2540 {
2541 ConfigGeneral.pace_wait_simple = $3;
2542 };
2543
2544 general_short_motd: SHORT_MOTD '=' TBOOL ';'
2545 {
2546 ConfigGeneral.short_motd = yylval.number;
2547 };
2548
2549 general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2550 {
2551 ConfigGeneral.no_oper_flood = yylval.number;
2552 };
2553
2554 general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2555 {
2556 ConfigGeneral.dots_in_ident = $3;
2557 };
2558
2559 general_max_targets: MAX_TARGETS '=' NUMBER ';'
2560 {
2561 ConfigGeneral.max_targets = $3;
2562 };
2563
2564 general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2565 {
2566 ConfigGeneral.ping_cookie = yylval.number;
2567 };
2568
2569 general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2570 {
2571 ConfigGeneral.disable_auth = yylval.number;
2572 };
2573
2574 general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2575 {
2576 ConfigGeneral.throttle_count = $3;
2577 };
2578
2579 general_throttle_time: THROTTLE_TIME '=' timespec ';'
2580 {
2581 ConfigGeneral.throttle_time = $3;
2582 };
2583
2584 general_oper_umodes: OPER_UMODES
2585 {
2586 ConfigGeneral.oper_umodes = 0;
2587 } '=' umode_oitems ';' ;
2588
2589 umode_oitems: umode_oitems ',' umode_oitem | umode_oitem;
2590 umode_oitem: T_BOTS
2591 {
2592 ConfigGeneral.oper_umodes |= UMODE_BOTS;
2593 } | T_CCONN
2594 {
2595 ConfigGeneral.oper_umodes |= UMODE_CCONN;
2596 } | T_DEAF
2597 {
2598 ConfigGeneral.oper_umodes |= UMODE_DEAF;
2599 } | T_DEBUG
2600 {
2601 ConfigGeneral.oper_umodes |= UMODE_DEBUG;
2602 } | T_FULL
2603 {
2604 ConfigGeneral.oper_umodes |= UMODE_FULL;
2605 } | HIDDEN
2606 {
2607 ConfigGeneral.oper_umodes |= UMODE_HIDDEN;
2608 } | HIDE_CHANS
2609 {
2610 ConfigGeneral.oper_umodes |= UMODE_HIDECHANS;
2611 } | HIDE_IDLE
2612 {
2613 ConfigGeneral.oper_umodes |= UMODE_HIDEIDLE;
2614 } | T_SKILL
2615 {
2616 ConfigGeneral.oper_umodes |= UMODE_SKILL;
2617 } | T_NCHANGE
2618 {
2619 ConfigGeneral.oper_umodes |= UMODE_NCHANGE;
2620 } | T_REJ
2621 {
2622 ConfigGeneral.oper_umodes |= UMODE_REJ;
2623 } | T_UNAUTH
2624 {
2625 ConfigGeneral.oper_umodes |= UMODE_UNAUTH;
2626 } | T_SPY
2627 {
2628 ConfigGeneral.oper_umodes |= UMODE_SPY;
2629 } | T_EXTERNAL
2630 {
2631 ConfigGeneral.oper_umodes |= UMODE_EXTERNAL;
2632 } | T_SERVNOTICE
2633 {
2634 ConfigGeneral.oper_umodes |= UMODE_SERVNOTICE;
2635 } | T_INVISIBLE
2636 {
2637 ConfigGeneral.oper_umodes |= UMODE_INVISIBLE;
2638 } | T_WALLOP
2639 {
2640 ConfigGeneral.oper_umodes |= UMODE_WALLOP;
2641 } | T_SOFTCALLERID
2642 {
2643 ConfigGeneral.oper_umodes |= UMODE_SOFTCALLERID;
2644 } | T_CALLERID
2645 {
2646 ConfigGeneral.oper_umodes |= UMODE_CALLERID;
2647 } | T_LOCOPS
2648 {
2649 ConfigGeneral.oper_umodes |= UMODE_LOCOPS;
2650 } | T_NONONREG
2651 {
2652 ConfigGeneral.oper_umodes |= UMODE_REGONLY;
2653 } | T_FARCONNECT
2654 {
2655 ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2656 } | EXPIRATION
2657 {
2658 ConfigGeneral.oper_umodes |= UMODE_EXPIRATION;
2659 };
2660
2661 general_oper_only_umodes: OPER_ONLY_UMODES
2662 {
2663 ConfigGeneral.oper_only_umodes = 0;
2664 } '=' umode_items ';' ;
2665
2666 umode_items: umode_items ',' umode_item | umode_item;
2667 umode_item: T_BOTS
2668 {
2669 ConfigGeneral.oper_only_umodes |= UMODE_BOTS;
2670 } | T_CCONN
2671 {
2672 ConfigGeneral.oper_only_umodes |= UMODE_CCONN;
2673 } | T_DEAF
2674 {
2675 ConfigGeneral.oper_only_umodes |= UMODE_DEAF;
2676 } | T_DEBUG
2677 {
2678 ConfigGeneral.oper_only_umodes |= UMODE_DEBUG;
2679 } | T_FULL
2680 {
2681 ConfigGeneral.oper_only_umodes |= UMODE_FULL;
2682 } | T_SKILL
2683 {
2684 ConfigGeneral.oper_only_umodes |= UMODE_SKILL;
2685 } | HIDDEN
2686 {
2687 ConfigGeneral.oper_only_umodes |= UMODE_HIDDEN;
2688 } | T_NCHANGE
2689 {
2690 ConfigGeneral.oper_only_umodes |= UMODE_NCHANGE;
2691 } | T_REJ
2692 {
2693 ConfigGeneral.oper_only_umodes |= UMODE_REJ;
2694 } | T_UNAUTH
2695 {
2696 ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH;
2697 } | T_SPY
2698 {
2699 ConfigGeneral.oper_only_umodes |= UMODE_SPY;
2700 } | T_EXTERNAL
2701 {
2702 ConfigGeneral.oper_only_umodes |= UMODE_EXTERNAL;
2703 } | T_SERVNOTICE
2704 {
2705 ConfigGeneral.oper_only_umodes |= UMODE_SERVNOTICE;
2706 } | T_INVISIBLE
2707 {
2708 ConfigGeneral.oper_only_umodes |= UMODE_INVISIBLE;
2709 } | T_WALLOP
2710 {
2711 ConfigGeneral.oper_only_umodes |= UMODE_WALLOP;
2712 } | T_SOFTCALLERID
2713 {
2714 ConfigGeneral.oper_only_umodes |= UMODE_SOFTCALLERID;
2715 } | T_CALLERID
2716 {
2717 ConfigGeneral.oper_only_umodes |= UMODE_CALLERID;
2718 } | T_LOCOPS
2719 {
2720 ConfigGeneral.oper_only_umodes |= UMODE_LOCOPS;
2721 } | T_NONONREG
2722 {
2723 ConfigGeneral.oper_only_umodes |= UMODE_REGONLY;
2724 } | T_FARCONNECT
2725 {
2726 ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2727 } | EXPIRATION
2728 {
2729 ConfigGeneral.oper_only_umodes |= UMODE_EXPIRATION;
2730 };
2731
2732 general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2733 {
2734 ConfigGeneral.min_nonwildcard = $3;
2735 };
2736
2737 general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2738 {
2739 ConfigGeneral.min_nonwildcard_simple = $3;
2740 };
2741
2742 general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2743 {
2744 ConfigGeneral.default_floodcount = $3;
2745 };
2746
2747 general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';'
2748 {
2749 ConfigGeneral.default_floodtime = $3;
2750 };
2751
2752
2753 /***************************************************************************
2754 * channel {} section
2755 ***************************************************************************/
2756 channel_entry: CHANNEL '{' channel_items '}' ';';
2757
2758 channel_items: channel_items channel_item | channel_item;
2759 channel_item: channel_max_bans |
2760 channel_max_bans_large |
2761 channel_invite_client_count |
2762 channel_invite_client_time |
2763 channel_invite_delay_channel |
2764 channel_invite_expire_time |
2765 channel_knock_client_count |
2766 channel_knock_client_time |
2767 channel_knock_delay_channel |
2768 channel_max_channels |
2769 channel_max_invites |
2770 channel_default_join_flood_count |
2771 channel_default_join_flood_time |
2772 channel_disable_fake_channels |
2773 channel_enable_extbans |
2774 error;
2775
2776 channel_enable_extbans: ENABLE_EXTBANS '=' TBOOL ';'
2777 {
2778 ConfigChannel.enable_extbans = yylval.number;
2779 };
2780
2781 channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2782 {
2783 ConfigChannel.disable_fake_channels = yylval.number;
2784 };
2785
2786 channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2787 {
2788 ConfigChannel.invite_client_count = $3;
2789 };
2790
2791 channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2792 {
2793 ConfigChannel.invite_client_time = $3;
2794 };
2795
2796 channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2797 {
2798 ConfigChannel.invite_delay_channel = $3;
2799 };
2800
2801 channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';'
2802 {
2803 ConfigChannel.invite_expire_time = $3;
2804 };
2805
2806 channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2807 {
2808 ConfigChannel.knock_client_count = $3;
2809 };
2810
2811 channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2812 {
2813 ConfigChannel.knock_client_time = $3;
2814 };
2815
2816 channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
2817 {
2818 ConfigChannel.knock_delay_channel = $3;
2819 };
2820
2821 channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
2822 {
2823 ConfigChannel.max_channels = $3;
2824 };
2825
2826 channel_max_invites: MAX_INVITES '=' NUMBER ';'
2827 {
2828 ConfigChannel.max_invites = $3;
2829 };
2830
2831 channel_max_bans: MAX_BANS '=' NUMBER ';'
2832 {
2833 ConfigChannel.max_bans = $3;
2834 };
2835
2836 channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';'
2837 {
2838 ConfigChannel.max_bans_large = $3;
2839 };
2840
2841 channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2842 {
2843 ConfigChannel.default_join_flood_count = yylval.number;
2844 };
2845
2846 channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2847 {
2848 ConfigChannel.default_join_flood_time = $3;
2849 };
2850
2851
2852 /***************************************************************************
2853 * serverhide {} section
2854 ***************************************************************************/
2855 serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2856
2857 serverhide_items: serverhide_items serverhide_item | serverhide_item;
2858 serverhide_item: serverhide_flatten_links |
2859 serverhide_flatten_links_delay |
2860 serverhide_flatten_links_file |
2861 serverhide_disable_remote_commands |
2862 serverhide_hide_servers |
2863 serverhide_hide_services |
2864 serverhide_hidden |
2865 serverhide_hidden_name |
2866 serverhide_hide_server_ips |
2867 error;
2868
2869 serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
2870 {
2871 if (conf_parser_ctx.pass == 2)
2872 ConfigServerHide.flatten_links = yylval.number;
2873 };
2874
2875 serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2876 {
2877 if (conf_parser_ctx.pass == 2)
2878 {
2879 if ($3 > 0)
2880 {
2881 event_write_links_file.when = $3;
2882 event_add(&event_write_links_file, NULL);
2883 }
2884 else
2885 event_delete(&event_write_links_file);
2886
2887 ConfigServerHide.flatten_links_delay = $3;
2888 }
2889 };
2890
2891 serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
2892 {
2893 if (conf_parser_ctx.pass == 2)
2894 {
2895 xfree(ConfigServerHide.flatten_links_file);
2896 ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
2897 }
2898 };
2899
2900 serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2901 {
2902 if (conf_parser_ctx.pass == 2)
2903 ConfigServerHide.disable_remote_commands = yylval.number;
2904 };
2905
2906 serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
2907 {
2908 if (conf_parser_ctx.pass == 2)
2909 ConfigServerHide.hide_servers = yylval.number;
2910 };
2911
2912 serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
2913 {
2914 if (conf_parser_ctx.pass == 2)
2915 ConfigServerHide.hide_services = yylval.number;
2916 };
2917
2918 serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
2919 {
2920 if (conf_parser_ctx.pass == 2)
2921 {
2922 xfree(ConfigServerHide.hidden_name);
2923 ConfigServerHide.hidden_name = xstrdup(yylval.string);
2924 }
2925 };
2926
2927 serverhide_hidden: HIDDEN '=' TBOOL ';'
2928 {
2929 if (conf_parser_ctx.pass == 2)
2930 ConfigServerHide.hidden = yylval.number;
2931 };
2932
2933 serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
2934 {
2935 if (conf_parser_ctx.pass == 2)
2936 ConfigServerHide.hide_server_ips = yylval.number;
2937 };

Properties

Name Value
svn:eol-style native
svn:keywords Id