ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/src/conf_parser.y
Revision: 8791
Committed: Thu Jan 17 18:34:51 2019 UTC (7 years, 6 months ago) by michael
File size: 74816 byte(s)
Log Message:
- No longer enforce a lower limit of MAXCLIENTS_MIN on GlobalSetOptions.maxclients and ConfigServerInfo.default_max_clients

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

Properties

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