ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 7793
Committed: Mon Oct 17 19:28:52 2016 UTC (8 years, 10 months ago) by michael
File size: 76736 byte(s)
Log Message:
- Implement INVITE expirations

File Contents

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

Properties

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