ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 8872
Committed: Sat Feb 16 21:49:34 2019 UTC (7 years, 7 months ago) by michael
File size: 73350 byte(s)
Log Message:
- Cleanup server connecting related code even further
- Make comm_connect_tcp() take less arguments and remove unused dns resolving functionality

File Contents

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

Properties

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