ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 7437
Committed: Thu Mar 10 19:59:52 2016 UTC (8 years, 1 month ago) by michael
File size: 76619 byte(s)
Log Message:
- Change whowas system to use a linked list instead of othe this monolithic WHOWAS table
- Size of the whowas nick name history length is now configurable

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_ident,
103 max_sendq,
104 max_recvq,
105 max_channels,
106 cidr_bitlen_ipv4,
107 cidr_bitlen_ipv6,
108 number_per_cidr;
109 } block_state;
110
111 static void
112 reset_block_state(void)
113 {
114 dlink_node *node = NULL, *node_next = NULL;
115
116 DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head)
117 {
118 xfree(node->data);
119 dlinkDelete(node, &block_state.mask.list);
120 free_dlink_node(node);
121 }
122
123 DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head)
124 {
125 xfree(node->data);
126 dlinkDelete(node, &block_state.leaf.list);
127 free_dlink_node(node);
128 }
129
130 DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head)
131 {
132 xfree(node->data);
133 dlinkDelete(node, &block_state.hub.list);
134 free_dlink_node(node);
135 }
136
137 memset(&block_state, 0, sizeof(block_state));
138 }
139
140 %}
141
142 %union {
143 int number;
144 char *string;
145 }
146
147 %token ACCEPT_PASSWORD
148 %token ADMIN
149 %token AFTYPE
150 %token ANTI_NICK_FLOOD
151 %token ANTI_SPAM_EXIT_MESSAGE_TIME
152 %token AUTOCONN
153 %token AWAY_COUNT
154 %token AWAY_TIME
155 %token BYTES KBYTES MBYTES
156 %token CALLER_ID_WAIT
157 %token CAN_FLOOD
158 %token CHANNEL
159 %token CHECK_CACHE
160 %token CIDR_BITLEN_IPV4
161 %token CIDR_BITLEN_IPV6
162 %token CLASS
163 %token CLOSE
164 %token CONNECT
165 %token CONNECTFREQ
166 %token CYCLE_ON_HOST_CHANGE
167 %token DEFAULT_FLOODCOUNT
168 %token DEFAULT_JOIN_FLOOD_COUNT
169 %token DEFAULT_JOIN_FLOOD_TIME
170 %token DEFAULT_MAX_CLIENTS
171 %token DENY
172 %token DESCRIPTION
173 %token DIE
174 %token DISABLE_AUTH
175 %token DISABLE_FAKE_CHANNELS
176 %token DISABLE_REMOTE_COMMANDS
177 %token DLINE_MIN_CIDR
178 %token DLINE_MIN_CIDR6
179 %token DOTS_IN_IDENT
180 %token EMAIL
181 %token ENCRYPTED
182 %token EXCEED_LIMIT
183 %token EXEMPT
184 %token FAILED_OPER_NOTICE
185 %token FLATTEN_LINKS
186 %token FLATTEN_LINKS_DELAY
187 %token FLATTEN_LINKS_FILE
188 %token GECOS
189 %token GENERAL
190 %token HIDDEN
191 %token HIDDEN_NAME
192 %token HIDE_CHANS
193 %token HIDE_IDLE
194 %token HIDE_IDLE_FROM_OPERS
195 %token HIDE_SERVER_IPS
196 %token HIDE_SERVERS
197 %token HIDE_SERVICES
198 %token HOST
199 %token HUB
200 %token HUB_MASK
201 %token IGNORE_BOGUS_TS
202 %token INVISIBLE_ON_CONNECT
203 %token INVITE_CLIENT_COUNT
204 %token INVITE_CLIENT_TIME
205 %token INVITE_DELAY_CHANNEL
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_IDENT
231 %token MAX_IDLE
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_ident = block_state.max_ident.value;
1419 class->max_sendq = block_state.max_sendq.value;
1420 class->max_recvq = block_state.max_recvq.value;
1421 class->max_channels = block_state.max_channels.value;
1422
1423 if (block_state.min_idle.value > block_state.max_idle.value)
1424 {
1425 block_state.min_idle.value = 0;
1426 block_state.max_idle.value = 0;
1427 block_state.flags.value &= ~CLASS_FLAGS_FAKE_IDLE;
1428 }
1429
1430 class->flags = block_state.flags.value;
1431 class->min_idle = block_state.min_idle.value;
1432 class->max_idle = block_state.max_idle.value;
1433
1434 rebuild_cidr_list(class);
1435
1436 class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1437 class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1438 class->number_per_cidr = block_state.number_per_cidr.value;
1439 };
1440
1441 class_items: class_items class_item | class_item;
1442 class_item: class_name |
1443 class_cidr_bitlen_ipv4 |
1444 class_cidr_bitlen_ipv6 |
1445 class_ping_time |
1446 class_number_per_cidr |
1447 class_number_per_ip |
1448 class_connectfreq |
1449 class_max_channels |
1450 class_max_number |
1451 class_max_global |
1452 class_max_local |
1453 class_max_ident |
1454 class_sendq | class_recvq |
1455 class_min_idle |
1456 class_max_idle |
1457 class_flags |
1458 error ';' ;
1459
1460 class_name: NAME '=' QSTRING ';'
1461 {
1462 if (conf_parser_ctx.pass == 1)
1463 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1464 };
1465
1466 class_ping_time: PING_TIME '=' timespec ';'
1467 {
1468 if (conf_parser_ctx.pass == 1)
1469 block_state.ping_freq.value = $3;
1470 };
1471
1472 class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1473 {
1474 if (conf_parser_ctx.pass == 1)
1475 block_state.max_perip.value = $3;
1476 };
1477
1478 class_connectfreq: CONNECTFREQ '=' timespec ';'
1479 {
1480 if (conf_parser_ctx.pass == 1)
1481 block_state.con_freq.value = $3;
1482 };
1483
1484 class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1485 {
1486 if (conf_parser_ctx.pass == 1)
1487 block_state.max_channels.value = $3;
1488 };
1489
1490 class_max_number: MAX_NUMBER '=' NUMBER ';'
1491 {
1492 if (conf_parser_ctx.pass == 1)
1493 block_state.max_total.value = $3;
1494 };
1495
1496 class_max_global: MAX_GLOBAL '=' NUMBER ';'
1497 {
1498 if (conf_parser_ctx.pass == 1)
1499 block_state.max_global.value = $3;
1500 };
1501
1502 class_max_local: MAX_LOCAL '=' NUMBER ';'
1503 {
1504 if (conf_parser_ctx.pass == 1)
1505 block_state.max_local.value = $3;
1506 };
1507
1508 class_max_ident: MAX_IDENT '=' NUMBER ';'
1509 {
1510 if (conf_parser_ctx.pass == 1)
1511 block_state.max_ident.value = $3;
1512 };
1513
1514 class_sendq: SENDQ '=' sizespec ';'
1515 {
1516 if (conf_parser_ctx.pass == 1)
1517 block_state.max_sendq.value = $3;
1518 };
1519
1520 class_recvq: T_RECVQ '=' sizespec ';'
1521 {
1522 if (conf_parser_ctx.pass == 1)
1523 if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1524 block_state.max_recvq.value = $3;
1525 };
1526
1527 class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1528 {
1529 if (conf_parser_ctx.pass == 1)
1530 block_state.cidr_bitlen_ipv4.value = $3 > 32 ? 32 : $3;
1531 };
1532
1533 class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1534 {
1535 if (conf_parser_ctx.pass == 1)
1536 block_state.cidr_bitlen_ipv6.value = $3 > 128 ? 128 : $3;
1537 };
1538
1539 class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1540 {
1541 if (conf_parser_ctx.pass == 1)
1542 block_state.number_per_cidr.value = $3;
1543 };
1544
1545 class_min_idle: MIN_IDLE '=' timespec ';'
1546 {
1547 if (conf_parser_ctx.pass != 1)
1548 break;
1549
1550 block_state.min_idle.value = $3;
1551 block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1552 };
1553
1554 class_max_idle: MAX_IDLE '=' timespec ';'
1555 {
1556 if (conf_parser_ctx.pass != 1)
1557 break;
1558
1559 block_state.max_idle.value = $3;
1560 block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1561 };
1562
1563 class_flags: IRCD_FLAGS
1564 {
1565 if (conf_parser_ctx.pass == 1)
1566 block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE;
1567 } '=' class_flags_items ';';
1568
1569 class_flags_items: class_flags_items ',' class_flags_item | class_flags_item;
1570 class_flags_item: RANDOM_IDLE
1571 {
1572 if (conf_parser_ctx.pass == 1)
1573 block_state.flags.value |= CLASS_FLAGS_RANDOM_IDLE;
1574 } | HIDE_IDLE_FROM_OPERS
1575 {
1576 if (conf_parser_ctx.pass == 1)
1577 block_state.flags.value |= CLASS_FLAGS_HIDE_IDLE_FROM_OPERS;
1578 };
1579
1580
1581 /***************************************************************************
1582 * listen {} section
1583 ***************************************************************************/
1584 listen_entry: LISTEN
1585 {
1586 if (conf_parser_ctx.pass == 2)
1587 reset_block_state();
1588 } '{' listen_items '}' ';';
1589
1590 listen_flags: IRCD_FLAGS
1591 {
1592 block_state.flags.value = 0;
1593 } '=' listen_flags_items ';';
1594
1595 listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1596 listen_flags_item: T_SSL
1597 {
1598 if (conf_parser_ctx.pass == 2)
1599 block_state.flags.value |= LISTENER_SSL;
1600 } | HIDDEN
1601 {
1602 if (conf_parser_ctx.pass == 2)
1603 block_state.flags.value |= LISTENER_HIDDEN;
1604 } | T_SERVER
1605 {
1606 if (conf_parser_ctx.pass == 2)
1607 block_state.flags.value |= LISTENER_SERVER;
1608 };
1609
1610 listen_items: listen_items listen_item | listen_item;
1611 listen_item: listen_port | listen_flags | listen_address | listen_host | error ';';
1612
1613 listen_port: PORT '=' port_items { block_state.flags.value = 0; } ';';
1614
1615 port_items: port_items ',' port_item | port_item;
1616
1617 port_item: NUMBER
1618 {
1619 if (conf_parser_ctx.pass == 2)
1620 {
1621 #ifndef HAVE_TLS
1622 if (block_state.flags.value & LISTENER_SSL)
1623 {
1624 conf_error_report("TLS not available - port closed");
1625 break;
1626 }
1627 #endif
1628 listener_add($1, block_state.addr.buf, block_state.flags.value);
1629 }
1630 } | NUMBER TWODOTS NUMBER
1631 {
1632 if (conf_parser_ctx.pass == 2)
1633 {
1634 #ifndef HAVE_TLS
1635 if (block_state.flags.value & LISTENER_SSL)
1636 {
1637 conf_error_report("TLS not available - port closed");
1638 break;
1639 }
1640 #endif
1641
1642 for (int i = $1; i <= $3; ++i)
1643 listener_add(i, block_state.addr.buf, block_state.flags.value);
1644 }
1645 };
1646
1647 listen_address: IP '=' QSTRING ';'
1648 {
1649 if (conf_parser_ctx.pass == 2)
1650 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1651 };
1652
1653 listen_host: HOST '=' QSTRING ';'
1654 {
1655 if (conf_parser_ctx.pass == 2)
1656 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1657 };
1658
1659
1660 /***************************************************************************
1661 * auth {} section
1662 ***************************************************************************/
1663 auth_entry: IRCD_AUTH
1664 {
1665 if (conf_parser_ctx.pass == 2)
1666 reset_block_state();
1667 } '{' auth_items '}' ';'
1668 {
1669 dlink_node *node = NULL;
1670
1671 if (conf_parser_ctx.pass != 2)
1672 break;
1673
1674 DLINK_FOREACH(node, block_state.mask.list.head)
1675 {
1676 struct MaskItem *conf = NULL;
1677 struct split_nuh_item nuh;
1678 char *s = node->data;
1679
1680 if (EmptyString(s))
1681 continue;
1682
1683 nuh.nuhmask = s;
1684 nuh.nickptr = NULL;
1685 nuh.userptr = block_state.user.buf;
1686 nuh.hostptr = block_state.host.buf;
1687 nuh.nicksize = 0;
1688 nuh.usersize = sizeof(block_state.user.buf);
1689 nuh.hostsize = sizeof(block_state.host.buf);
1690 split_nuh(&nuh);
1691
1692 conf = conf_make(CONF_CLIENT);
1693 conf->user = xstrdup(block_state.user.buf);
1694 conf->host = xstrdup(block_state.host.buf);
1695
1696 if (block_state.rpass.buf[0])
1697 conf->passwd = xstrdup(block_state.rpass.buf);
1698 if (block_state.name.buf[0])
1699 conf->name = xstrdup(block_state.name.buf);
1700
1701 conf->flags = block_state.flags.value;
1702 conf->port = block_state.port.value;
1703
1704 conf_add_class_to_conf(conf, block_state.class.buf);
1705 add_conf_by_address(CONF_CLIENT, conf);
1706 }
1707 };
1708
1709 auth_items: auth_items auth_item | auth_item;
1710 auth_item: auth_user |
1711 auth_passwd |
1712 auth_class |
1713 auth_flags |
1714 auth_spoof |
1715 auth_redir_serv |
1716 auth_redir_port |
1717 auth_encrypted |
1718 error ';' ;
1719
1720 auth_user: USER '=' QSTRING ';'
1721 {
1722 if (conf_parser_ctx.pass == 2)
1723 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1724 };
1725
1726 auth_passwd: PASSWORD '=' QSTRING ';'
1727 {
1728 if (conf_parser_ctx.pass == 2)
1729 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1730 };
1731
1732 auth_class: CLASS '=' QSTRING ';'
1733 {
1734 if (conf_parser_ctx.pass == 2)
1735 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1736 };
1737
1738 auth_encrypted: ENCRYPTED '=' TBOOL ';'
1739 {
1740 if (conf_parser_ctx.pass == 2)
1741 {
1742 if (yylval.number)
1743 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1744 else
1745 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1746 }
1747 };
1748
1749 auth_flags: IRCD_FLAGS
1750 {
1751 if (conf_parser_ctx.pass == 2)
1752 block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1753 } '=' auth_flags_items ';';
1754
1755 auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1756 auth_flags_item: SPOOF_NOTICE
1757 {
1758 if (conf_parser_ctx.pass == 2)
1759 block_state.flags.value |= CONF_FLAGS_SPOOF_NOTICE;
1760 } | EXCEED_LIMIT
1761 {
1762 if (conf_parser_ctx.pass == 2)
1763 block_state.flags.value |= CONF_FLAGS_NOLIMIT;
1764 } | KLINE_EXEMPT
1765 {
1766 if (conf_parser_ctx.pass == 2)
1767 block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1768 } | XLINE_EXEMPT
1769 {
1770 if (conf_parser_ctx.pass == 2)
1771 block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
1772 } | NEED_IDENT
1773 {
1774 if (conf_parser_ctx.pass == 2)
1775 block_state.flags.value |= CONF_FLAGS_NEED_IDENTD;
1776 } | CAN_FLOOD
1777 {
1778 if (conf_parser_ctx.pass == 2)
1779 block_state.flags.value |= CONF_FLAGS_CAN_FLOOD;
1780 } | NO_TILDE
1781 {
1782 if (conf_parser_ctx.pass == 2)
1783 block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1784 } | RESV_EXEMPT
1785 {
1786 if (conf_parser_ctx.pass == 2)
1787 block_state.flags.value |= CONF_FLAGS_EXEMPTRESV;
1788 } | T_WEBIRC
1789 {
1790 if (conf_parser_ctx.pass == 2)
1791 block_state.flags.value |= CONF_FLAGS_WEBIRC;
1792 } | NEED_PASSWORD
1793 {
1794 if (conf_parser_ctx.pass == 2)
1795 block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1796 };
1797
1798 auth_spoof: SPOOF '=' QSTRING ';'
1799 {
1800 if (conf_parser_ctx.pass != 2)
1801 break;
1802
1803 if (valid_hostname(yylval.string))
1804 {
1805 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1806 block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
1807 }
1808 else
1809 ilog(LOG_TYPE_IRCD, "Spoof either is too long or contains invalid characters. Ignoring it.");
1810 };
1811
1812 auth_redir_serv: REDIRSERV '=' QSTRING ';'
1813 {
1814 if (conf_parser_ctx.pass != 2)
1815 break;
1816
1817 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1818 block_state.flags.value |= CONF_FLAGS_REDIR;
1819 };
1820
1821 auth_redir_port: REDIRPORT '=' NUMBER ';'
1822 {
1823 if (conf_parser_ctx.pass != 2)
1824 break;
1825
1826 block_state.flags.value |= CONF_FLAGS_REDIR;
1827 block_state.port.value = $3;
1828 };
1829
1830
1831 /***************************************************************************
1832 * resv {} section
1833 ***************************************************************************/
1834 resv_entry: RESV
1835 {
1836 if (conf_parser_ctx.pass != 2)
1837 break;
1838
1839 reset_block_state();
1840 strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1841 } '{' resv_items '}' ';'
1842 {
1843 if (conf_parser_ctx.pass != 2)
1844 break;
1845
1846 resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1847 };
1848
1849 resv_items: resv_items resv_item | resv_item;
1850 resv_item: resv_mask | resv_reason | resv_exempt | error ';' ;
1851
1852 resv_mask: MASK '=' QSTRING ';'
1853 {
1854 if (conf_parser_ctx.pass == 2)
1855 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1856 };
1857
1858 resv_reason: REASON '=' QSTRING ';'
1859 {
1860 if (conf_parser_ctx.pass == 2)
1861 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1862 };
1863
1864 resv_exempt: EXEMPT '=' QSTRING ';'
1865 {
1866 if (conf_parser_ctx.pass == 2)
1867 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1868 };
1869
1870
1871 /***************************************************************************
1872 * service {} section
1873 ***************************************************************************/
1874 service_entry: T_SERVICE '{' service_items '}' ';';
1875
1876 service_items: service_items service_item | service_item;
1877 service_item: service_name | error;
1878
1879 service_name: NAME '=' QSTRING ';'
1880 {
1881 if (conf_parser_ctx.pass != 2)
1882 break;
1883
1884 if (valid_servname(yylval.string))
1885 {
1886 struct ServiceItem *service = service_make();
1887 service->name = xstrdup(yylval.string);
1888 }
1889 };
1890
1891
1892 /***************************************************************************
1893 * shared {} section, for sharing remote klines etc.
1894 ***************************************************************************/
1895 shared_entry: T_SHARED
1896 {
1897 if (conf_parser_ctx.pass != 2)
1898 break;
1899
1900 reset_block_state();
1901
1902 strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1903 strlcpy(block_state.user.buf, "*", sizeof(block_state.user.buf));
1904 strlcpy(block_state.host.buf, "*", sizeof(block_state.host.buf));
1905 block_state.flags.value = SHARED_ALL;
1906 } '{' shared_items '}' ';'
1907 {
1908 if (conf_parser_ctx.pass != 2)
1909 break;
1910
1911 struct SharedItem *shared = shared_make();
1912 shared->type = block_state.flags.value;
1913 shared->server = xstrdup(block_state.name.buf);
1914 shared->user = xstrdup(block_state.user.buf);
1915 shared->host = xstrdup(block_state.host.buf);
1916 };
1917
1918 shared_items: shared_items shared_item | shared_item;
1919 shared_item: shared_name | shared_user | shared_type | error ';' ;
1920
1921 shared_name: NAME '=' QSTRING ';'
1922 {
1923 if (conf_parser_ctx.pass == 2)
1924 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1925 };
1926
1927 shared_user: USER '=' QSTRING ';'
1928 {
1929 if (conf_parser_ctx.pass == 2)
1930 {
1931 struct split_nuh_item nuh;
1932
1933 nuh.nuhmask = yylval.string;
1934 nuh.nickptr = NULL;
1935 nuh.userptr = block_state.user.buf;
1936 nuh.hostptr = block_state.host.buf;
1937
1938 nuh.nicksize = 0;
1939 nuh.usersize = sizeof(block_state.user.buf);
1940 nuh.hostsize = sizeof(block_state.host.buf);
1941
1942 split_nuh(&nuh);
1943 }
1944 };
1945
1946 shared_type: TYPE
1947 {
1948 if (conf_parser_ctx.pass == 2)
1949 block_state.flags.value = 0;
1950 } '=' shared_types ';' ;
1951
1952 shared_types: shared_types ',' shared_type_item | shared_type_item;
1953 shared_type_item: KLINE
1954 {
1955 if (conf_parser_ctx.pass == 2)
1956 block_state.flags.value |= SHARED_KLINE;
1957 } | UNKLINE
1958 {
1959 if (conf_parser_ctx.pass == 2)
1960 block_state.flags.value |= SHARED_UNKLINE;
1961 } | T_DLINE
1962 {
1963 if (conf_parser_ctx.pass == 2)
1964 block_state.flags.value |= SHARED_DLINE;
1965 } | T_UNDLINE
1966 {
1967 if (conf_parser_ctx.pass == 2)
1968 block_state.flags.value |= SHARED_UNDLINE;
1969 } | XLINE
1970 {
1971 if (conf_parser_ctx.pass == 2)
1972 block_state.flags.value |= SHARED_XLINE;
1973 } | T_UNXLINE
1974 {
1975 if (conf_parser_ctx.pass == 2)
1976 block_state.flags.value |= SHARED_UNXLINE;
1977 } | RESV
1978 {
1979 if (conf_parser_ctx.pass == 2)
1980 block_state.flags.value |= SHARED_RESV;
1981 } | T_UNRESV
1982 {
1983 if (conf_parser_ctx.pass == 2)
1984 block_state.flags.value |= SHARED_UNRESV;
1985 } | T_LOCOPS
1986 {
1987 if (conf_parser_ctx.pass == 2)
1988 block_state.flags.value |= SHARED_LOCOPS;
1989 } | T_ALL
1990 {
1991 if (conf_parser_ctx.pass == 2)
1992 block_state.flags.value = SHARED_ALL;
1993 };
1994
1995
1996 /***************************************************************************
1997 * cluster {} section
1998 ***************************************************************************/
1999 cluster_entry: T_CLUSTER
2000 {
2001 if (conf_parser_ctx.pass != 2)
2002 break;
2003
2004 reset_block_state();
2005
2006 strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
2007 block_state.flags.value = CLUSTER_ALL;
2008 } '{' cluster_items '}' ';'
2009 {
2010 if (conf_parser_ctx.pass != 2)
2011 break;
2012
2013 struct ClusterItem *cluster = cluster_make();
2014 cluster->type = block_state.flags.value;
2015 cluster->server = xstrdup(block_state.name.buf);
2016 };
2017
2018 cluster_items: cluster_items cluster_item | cluster_item;
2019 cluster_item: cluster_name | cluster_type | error ';' ;
2020
2021 cluster_name: NAME '=' QSTRING ';'
2022 {
2023 if (conf_parser_ctx.pass == 2)
2024 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2025 };
2026
2027 cluster_type: TYPE
2028 {
2029 if (conf_parser_ctx.pass == 2)
2030 block_state.flags.value = 0;
2031 } '=' cluster_types ';' ;
2032
2033 cluster_types: cluster_types ',' cluster_type_item | cluster_type_item;
2034 cluster_type_item: KLINE
2035 {
2036 if (conf_parser_ctx.pass == 2)
2037 block_state.flags.value |= CLUSTER_KLINE;
2038 } | UNKLINE
2039 {
2040 if (conf_parser_ctx.pass == 2)
2041 block_state.flags.value |= CLUSTER_UNKLINE;
2042 } | T_DLINE
2043 {
2044 if (conf_parser_ctx.pass == 2)
2045 block_state.flags.value |= CLUSTER_DLINE;
2046 } | T_UNDLINE
2047 {
2048 if (conf_parser_ctx.pass == 2)
2049 block_state.flags.value |= CLUSTER_UNDLINE;
2050 } | XLINE
2051 {
2052 if (conf_parser_ctx.pass == 2)
2053 block_state.flags.value |= CLUSTER_XLINE;
2054 } | T_UNXLINE
2055 {
2056 if (conf_parser_ctx.pass == 2)
2057 block_state.flags.value |= CLUSTER_UNXLINE;
2058 } | RESV
2059 {
2060 if (conf_parser_ctx.pass == 2)
2061 block_state.flags.value |= CLUSTER_RESV;
2062 } | T_UNRESV
2063 {
2064 if (conf_parser_ctx.pass == 2)
2065 block_state.flags.value |= CLUSTER_UNRESV;
2066 } | T_LOCOPS
2067 {
2068 if (conf_parser_ctx.pass == 2)
2069 block_state.flags.value |= CLUSTER_LOCOPS;
2070 } | T_ALL
2071 {
2072 if (conf_parser_ctx.pass == 2)
2073 block_state.flags.value = CLUSTER_ALL;
2074 };
2075
2076
2077 /***************************************************************************
2078 * connect {} section
2079 ***************************************************************************/
2080 connect_entry: CONNECT
2081 {
2082
2083 if (conf_parser_ctx.pass != 2)
2084 break;
2085
2086 reset_block_state();
2087 block_state.aftype.value = AF_INET;
2088 block_state.port.value = PORTNUM;
2089 } '{' connect_items '}' ';'
2090 {
2091 struct MaskItem *conf = NULL;
2092 struct addrinfo hints, *res;
2093
2094 if (conf_parser_ctx.pass != 2)
2095 break;
2096
2097 if (!block_state.name.buf[0] ||
2098 !block_state.host.buf[0])
2099 break;
2100
2101 if (!block_state.rpass.buf[0] ||
2102 !block_state.spass.buf[0])
2103 break;
2104
2105 if (has_wildcards(block_state.name.buf) ||
2106 has_wildcards(block_state.host.buf))
2107 break;
2108
2109 conf = conf_make(CONF_SERVER);
2110 conf->port = block_state.port.value;
2111 conf->flags = block_state.flags.value;
2112 conf->aftype = block_state.aftype.value;
2113 conf->host = xstrdup(block_state.host.buf);
2114 conf->name = xstrdup(block_state.name.buf);
2115 conf->passwd = xstrdup(block_state.rpass.buf);
2116 conf->spasswd = xstrdup(block_state.spass.buf);
2117
2118 if (block_state.cert.buf[0])
2119 conf->certfp = xstrdup(block_state.cert.buf);
2120
2121 if (block_state.ciph.buf[0])
2122 conf->cipher_list = xstrdup(block_state.ciph.buf);
2123
2124 dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2125 dlinkMoveList(&block_state.hub.list, &conf->hub_list);
2126
2127 if (block_state.bind.buf[0])
2128 {
2129 memset(&hints, 0, sizeof(hints));
2130
2131 hints.ai_family = AF_UNSPEC;
2132 hints.ai_socktype = SOCK_STREAM;
2133 hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2134
2135 if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2136 ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2137 else
2138 {
2139 assert(res);
2140
2141 memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2142 conf->bind.ss.ss_family = res->ai_family;
2143 conf->bind.ss_len = res->ai_addrlen;
2144 freeaddrinfo(res);
2145 }
2146 }
2147
2148 conf_add_class_to_conf(conf, block_state.class.buf);
2149 lookup_confhost(conf);
2150 };
2151
2152 connect_items: connect_items connect_item | connect_item;
2153 connect_item: connect_name |
2154 connect_host |
2155 connect_vhost |
2156 connect_send_password |
2157 connect_accept_password |
2158 connect_ssl_certificate_fingerprint |
2159 connect_aftype |
2160 connect_port |
2161 connect_ssl_cipher_list |
2162 connect_flags |
2163 connect_hub_mask |
2164 connect_leaf_mask |
2165 connect_class |
2166 connect_encrypted |
2167 error ';' ;
2168
2169 connect_name: NAME '=' QSTRING ';'
2170 {
2171 if (conf_parser_ctx.pass == 2)
2172 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2173 };
2174
2175 connect_host: HOST '=' QSTRING ';'
2176 {
2177 if (conf_parser_ctx.pass == 2)
2178 strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2179 };
2180
2181 connect_vhost: VHOST '=' QSTRING ';'
2182 {
2183 if (conf_parser_ctx.pass == 2)
2184 strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2185 };
2186
2187 connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2188 {
2189 if (conf_parser_ctx.pass != 2)
2190 break;
2191
2192 if ($3[0] == ':')
2193 conf_error_report("Server passwords cannot begin with a colon");
2194 else if (strchr($3, ' '))
2195 conf_error_report("Server passwords cannot contain spaces");
2196 else
2197 strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
2198 };
2199
2200 connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2201 {
2202 if (conf_parser_ctx.pass != 2)
2203 break;
2204
2205 if ($3[0] == ':')
2206 conf_error_report("Server passwords cannot begin with a colon");
2207 else if (strchr($3, ' '))
2208 conf_error_report("Server passwords cannot contain spaces");
2209 else
2210 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2211 };
2212
2213 connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2214 {
2215 if (conf_parser_ctx.pass == 2)
2216 strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2217 };
2218
2219 connect_port: PORT '=' NUMBER ';'
2220 {
2221 if (conf_parser_ctx.pass == 2)
2222 block_state.port.value = $3;
2223 };
2224
2225 connect_aftype: AFTYPE '=' T_IPV4 ';'
2226 {
2227 if (conf_parser_ctx.pass == 2)
2228 block_state.aftype.value = AF_INET;
2229 } | AFTYPE '=' T_IPV6 ';'
2230 {
2231 if (conf_parser_ctx.pass == 2)
2232 block_state.aftype.value = AF_INET6;
2233 };
2234
2235 connect_flags: IRCD_FLAGS
2236 {
2237 block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2238 } '=' connect_flags_items ';';
2239
2240 connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2241 connect_flags_item: AUTOCONN
2242 {
2243 if (conf_parser_ctx.pass == 2)
2244 block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN;
2245 } | T_SSL
2246 {
2247 if (conf_parser_ctx.pass == 2)
2248 block_state.flags.value |= CONF_FLAGS_SSL;
2249 };
2250
2251 connect_encrypted: ENCRYPTED '=' TBOOL ';'
2252 {
2253 if (conf_parser_ctx.pass == 2)
2254 {
2255 if (yylval.number)
2256 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
2257 else
2258 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
2259 }
2260 };
2261
2262 connect_hub_mask: HUB_MASK '=' QSTRING ';'
2263 {
2264 if (conf_parser_ctx.pass == 2)
2265 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2266 };
2267
2268 connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2269 {
2270 if (conf_parser_ctx.pass == 2)
2271 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
2272 };
2273
2274 connect_class: CLASS '=' QSTRING ';'
2275 {
2276 if (conf_parser_ctx.pass == 2)
2277 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
2278 };
2279
2280 connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2281 {
2282 #ifdef HAVE_TLS
2283 if (conf_parser_ctx.pass == 2)
2284 strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2285 #else
2286 if (conf_parser_ctx.pass == 2)
2287 conf_error_report("Ignoring connect::ciphers -- no TLS support");
2288 #endif
2289 };
2290
2291
2292 /***************************************************************************
2293 * kill {} section
2294 ***************************************************************************/
2295 kill_entry: KILL
2296 {
2297 if (conf_parser_ctx.pass == 2)
2298 reset_block_state();
2299 } '{' kill_items '}' ';'
2300 {
2301 struct MaskItem *conf = NULL;
2302
2303 if (conf_parser_ctx.pass != 2)
2304 break;
2305
2306 if (!block_state.user.buf[0] ||
2307 !block_state.host.buf[0])
2308 break;
2309
2310 conf = conf_make(CONF_KLINE);
2311 conf->user = xstrdup(block_state.user.buf);
2312 conf->host = xstrdup(block_state.host.buf);
2313
2314 if (block_state.rpass.buf[0])
2315 conf->reason = xstrdup(block_state.rpass.buf);
2316 else
2317 conf->reason = xstrdup(CONF_NOREASON);
2318 add_conf_by_address(CONF_KLINE, conf);
2319 };
2320
2321 kill_items: kill_items kill_item | kill_item;
2322 kill_item: kill_user | kill_reason | error;
2323
2324 kill_user: USER '=' QSTRING ';'
2325 {
2326
2327 if (conf_parser_ctx.pass == 2)
2328 {
2329 struct split_nuh_item nuh;
2330
2331 nuh.nuhmask = yylval.string;
2332 nuh.nickptr = NULL;
2333 nuh.userptr = block_state.user.buf;
2334 nuh.hostptr = block_state.host.buf;
2335
2336 nuh.nicksize = 0;
2337 nuh.usersize = sizeof(block_state.user.buf);
2338 nuh.hostsize = sizeof(block_state.host.buf);
2339
2340 split_nuh(&nuh);
2341 }
2342 };
2343
2344 kill_reason: REASON '=' QSTRING ';'
2345 {
2346 if (conf_parser_ctx.pass == 2)
2347 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2348 };
2349
2350
2351 /***************************************************************************
2352 * deny {} section
2353 ***************************************************************************/
2354 deny_entry: DENY
2355 {
2356 if (conf_parser_ctx.pass == 2)
2357 reset_block_state();
2358 } '{' deny_items '}' ';'
2359 {
2360 struct MaskItem *conf = NULL;
2361
2362 if (conf_parser_ctx.pass != 2)
2363 break;
2364
2365 if (!block_state.addr.buf[0])
2366 break;
2367
2368 if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2369 {
2370 conf = conf_make(CONF_DLINE);
2371 conf->host = xstrdup(block_state.addr.buf);
2372
2373 if (block_state.rpass.buf[0])
2374 conf->reason = xstrdup(block_state.rpass.buf);
2375 else
2376 conf->reason = xstrdup(CONF_NOREASON);
2377 add_conf_by_address(CONF_DLINE, conf);
2378 }
2379 };
2380
2381 deny_items: deny_items deny_item | deny_item;
2382 deny_item: deny_ip | deny_reason | error;
2383
2384 deny_ip: IP '=' QSTRING ';'
2385 {
2386 if (conf_parser_ctx.pass == 2)
2387 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2388 };
2389
2390 deny_reason: REASON '=' QSTRING ';'
2391 {
2392 if (conf_parser_ctx.pass == 2)
2393 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2394 };
2395
2396
2397 /***************************************************************************
2398 * exempt {} section
2399 ***************************************************************************/
2400 exempt_entry: EXEMPT '{' exempt_items '}' ';';
2401
2402 exempt_items: exempt_items exempt_item | exempt_item;
2403 exempt_item: exempt_ip | error;
2404
2405 exempt_ip: IP '=' QSTRING ';'
2406 {
2407 if (conf_parser_ctx.pass == 2)
2408 {
2409 if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2410 {
2411 struct MaskItem *conf = conf_make(CONF_EXEMPT);
2412 conf->host = xstrdup(yylval.string);
2413
2414 add_conf_by_address(CONF_EXEMPT, conf);
2415 }
2416 }
2417 };
2418
2419 /***************************************************************************
2420 * gecos {} section
2421 ***************************************************************************/
2422 gecos_entry: GECOS
2423 {
2424 if (conf_parser_ctx.pass == 2)
2425 reset_block_state();
2426 } '{' gecos_items '}' ';'
2427 {
2428 if (conf_parser_ctx.pass != 2)
2429 break;
2430
2431 if (!block_state.name.buf[0])
2432 break;
2433
2434 struct GecosItem *gecos = gecos_make();
2435 gecos->mask = xstrdup(block_state.name.buf);
2436
2437 if (block_state.rpass.buf[0])
2438 gecos->reason = xstrdup(block_state.rpass.buf);
2439 else
2440 gecos->reason = xstrdup(CONF_NOREASON);
2441 };
2442
2443 gecos_items: gecos_items gecos_item | gecos_item;
2444 gecos_item: gecos_name | gecos_reason | error;
2445
2446 gecos_name: NAME '=' QSTRING ';'
2447 {
2448 if (conf_parser_ctx.pass == 2)
2449 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2450 };
2451
2452 gecos_reason: REASON '=' QSTRING ';'
2453 {
2454 if (conf_parser_ctx.pass == 2)
2455 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2456 };
2457
2458
2459 /***************************************************************************
2460 * general {} section
2461 ***************************************************************************/
2462 general_entry: GENERAL '{' general_items '}' ';';
2463
2464 general_items: general_items general_item | general_item;
2465 general_item: general_away_count |
2466 general_away_time |
2467 general_ignore_bogus_ts |
2468 general_failed_oper_notice |
2469 general_anti_nick_flood |
2470 general_max_nick_time |
2471 general_max_nick_changes |
2472 general_max_accept |
2473 general_whowas_history_length |
2474 general_anti_spam_exit_message_time |
2475 general_ts_warn_delta |
2476 general_ts_max_delta |
2477 general_kill_chase_time_limit |
2478 general_invisible_on_connect |
2479 general_warn_no_connect_block |
2480 general_dots_in_ident |
2481 general_stats_i_oper_only |
2482 general_stats_k_oper_only |
2483 general_stats_m_oper_only |
2484 general_stats_o_oper_only |
2485 general_stats_P_oper_only |
2486 general_stats_u_oper_only |
2487 general_pace_wait |
2488 general_pace_wait_simple |
2489 general_short_motd |
2490 general_no_oper_flood |
2491 general_oper_only_umodes |
2492 general_max_targets |
2493 general_oper_umodes |
2494 general_caller_id_wait |
2495 general_opers_bypass_callerid |
2496 general_default_floodcount |
2497 general_min_nonwildcard |
2498 general_min_nonwildcard_simple |
2499 general_throttle_count |
2500 general_throttle_time |
2501 general_ping_cookie |
2502 general_disable_auth |
2503 general_tkline_expire_notices |
2504 general_dline_min_cidr |
2505 general_dline_min_cidr6 |
2506 general_kline_min_cidr |
2507 general_kline_min_cidr6 |
2508 general_stats_e_disabled |
2509 general_max_watch |
2510 general_cycle_on_host_change |
2511 error;
2512
2513
2514 general_away_count: AWAY_COUNT '=' NUMBER ';'
2515 {
2516 ConfigGeneral.away_count = $3;
2517 };
2518
2519 general_away_time: AWAY_TIME '=' timespec ';'
2520 {
2521 ConfigGeneral.away_time = $3;
2522 };
2523
2524 general_max_watch: MAX_WATCH '=' NUMBER ';'
2525 {
2526 ConfigGeneral.max_watch = $3;
2527 };
2528
2529 general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';'
2530 {
2531 ConfigGeneral.whowas_history_length = $3;
2532 };
2533
2534 general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2535 {
2536 if (conf_parser_ctx.pass == 2)
2537 ConfigGeneral.cycle_on_host_change = yylval.number;
2538 };
2539
2540 general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2541 {
2542 ConfigGeneral.dline_min_cidr = $3;
2543 };
2544
2545 general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2546 {
2547 ConfigGeneral.dline_min_cidr6 = $3;
2548 };
2549
2550 general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2551 {
2552 ConfigGeneral.kline_min_cidr = $3;
2553 };
2554
2555 general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2556 {
2557 ConfigGeneral.kline_min_cidr6 = $3;
2558 };
2559
2560 general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2561 {
2562 ConfigGeneral.tkline_expire_notices = yylval.number;
2563 };
2564
2565 general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2566 {
2567 ConfigGeneral.kill_chase_time_limit = $3;
2568 };
2569
2570 general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2571 {
2572 ConfigGeneral.ignore_bogus_ts = yylval.number;
2573 };
2574
2575 general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2576 {
2577 ConfigGeneral.failed_oper_notice = yylval.number;
2578 };
2579
2580 general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2581 {
2582 ConfigGeneral.anti_nick_flood = yylval.number;
2583 };
2584
2585 general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2586 {
2587 ConfigGeneral.max_nick_time = $3;
2588 };
2589
2590 general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2591 {
2592 ConfigGeneral.max_nick_changes = $3;
2593 };
2594
2595 general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2596 {
2597 ConfigGeneral.max_accept = $3;
2598 };
2599
2600 general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2601 {
2602 ConfigGeneral.anti_spam_exit_message_time = $3;
2603 };
2604
2605 general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2606 {
2607 ConfigGeneral.ts_warn_delta = $3;
2608 };
2609
2610 general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2611 {
2612 if (conf_parser_ctx.pass == 2)
2613 ConfigGeneral.ts_max_delta = $3;
2614 };
2615
2616 general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2617 {
2618 ConfigGeneral.invisible_on_connect = yylval.number;
2619 };
2620
2621 general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2622 {
2623 ConfigGeneral.warn_no_connect_block = yylval.number;
2624 };
2625
2626 general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2627 {
2628 ConfigGeneral.stats_e_disabled = yylval.number;
2629 };
2630
2631 general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2632 {
2633 ConfigGeneral.stats_m_oper_only = yylval.number;
2634 };
2635
2636 general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2637 {
2638 ConfigGeneral.stats_o_oper_only = yylval.number;
2639 };
2640
2641 general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2642 {
2643 ConfigGeneral.stats_P_oper_only = yylval.number;
2644 };
2645
2646 general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2647 {
2648 ConfigGeneral.stats_u_oper_only = yylval.number;
2649 };
2650
2651 general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2652 {
2653 ConfigGeneral.stats_k_oper_only = 2 * yylval.number;
2654 } | STATS_K_OPER_ONLY '=' TMASKED ';'
2655 {
2656 ConfigGeneral.stats_k_oper_only = 1;
2657 };
2658
2659 general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2660 {
2661 ConfigGeneral.stats_i_oper_only = 2 * yylval.number;
2662 } | STATS_I_OPER_ONLY '=' TMASKED ';'
2663 {
2664 ConfigGeneral.stats_i_oper_only = 1;
2665 };
2666
2667 general_pace_wait: PACE_WAIT '=' timespec ';'
2668 {
2669 ConfigGeneral.pace_wait = $3;
2670 };
2671
2672 general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2673 {
2674 ConfigGeneral.caller_id_wait = $3;
2675 };
2676
2677 general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2678 {
2679 ConfigGeneral.opers_bypass_callerid = yylval.number;
2680 };
2681
2682 general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2683 {
2684 ConfigGeneral.pace_wait_simple = $3;
2685 };
2686
2687 general_short_motd: SHORT_MOTD '=' TBOOL ';'
2688 {
2689 ConfigGeneral.short_motd = yylval.number;
2690 };
2691
2692 general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2693 {
2694 ConfigGeneral.no_oper_flood = yylval.number;
2695 };
2696
2697 general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2698 {
2699 ConfigGeneral.dots_in_ident = $3;
2700 };
2701
2702 general_max_targets: MAX_TARGETS '=' NUMBER ';'
2703 {
2704 ConfigGeneral.max_targets = $3;
2705 };
2706
2707 general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2708 {
2709 ConfigGeneral.ping_cookie = yylval.number;
2710 };
2711
2712 general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2713 {
2714 ConfigGeneral.disable_auth = yylval.number;
2715 };
2716
2717 general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2718 {
2719 ConfigGeneral.throttle_count = $3;
2720 };
2721
2722 general_throttle_time: THROTTLE_TIME '=' timespec ';'
2723 {
2724 ConfigGeneral.throttle_time = $3;
2725 };
2726
2727 general_oper_umodes: OPER_UMODES
2728 {
2729 ConfigGeneral.oper_umodes = 0;
2730 } '=' umode_oitems ';' ;
2731
2732 umode_oitems: umode_oitems ',' umode_oitem | umode_oitem;
2733 umode_oitem: T_BOTS
2734 {
2735 ConfigGeneral.oper_umodes |= UMODE_BOTS;
2736 } | T_CCONN
2737 {
2738 ConfigGeneral.oper_umodes |= UMODE_CCONN;
2739 } | T_DEAF
2740 {
2741 ConfigGeneral.oper_umodes |= UMODE_DEAF;
2742 } | T_DEBUG
2743 {
2744 ConfigGeneral.oper_umodes |= UMODE_DEBUG;
2745 } | T_FULL
2746 {
2747 ConfigGeneral.oper_umodes |= UMODE_FULL;
2748 } | HIDDEN
2749 {
2750 ConfigGeneral.oper_umodes |= UMODE_HIDDEN;
2751 } | HIDE_CHANS
2752 {
2753 ConfigGeneral.oper_umodes |= UMODE_HIDECHANS;
2754 } | HIDE_IDLE
2755 {
2756 ConfigGeneral.oper_umodes |= UMODE_HIDEIDLE;
2757 } | T_SKILL
2758 {
2759 ConfigGeneral.oper_umodes |= UMODE_SKILL;
2760 } | T_NCHANGE
2761 {
2762 ConfigGeneral.oper_umodes |= UMODE_NCHANGE;
2763 } | T_REJ
2764 {
2765 ConfigGeneral.oper_umodes |= UMODE_REJ;
2766 } | T_UNAUTH
2767 {
2768 ConfigGeneral.oper_umodes |= UMODE_UNAUTH;
2769 } | T_SPY
2770 {
2771 ConfigGeneral.oper_umodes |= UMODE_SPY;
2772 } | T_EXTERNAL
2773 {
2774 ConfigGeneral.oper_umodes |= UMODE_EXTERNAL;
2775 } | T_SERVNOTICE
2776 {
2777 ConfigGeneral.oper_umodes |= UMODE_SERVNOTICE;
2778 } | T_INVISIBLE
2779 {
2780 ConfigGeneral.oper_umodes |= UMODE_INVISIBLE;
2781 } | T_WALLOP
2782 {
2783 ConfigGeneral.oper_umodes |= UMODE_WALLOP;
2784 } | T_SOFTCALLERID
2785 {
2786 ConfigGeneral.oper_umodes |= UMODE_SOFTCALLERID;
2787 } | T_CALLERID
2788 {
2789 ConfigGeneral.oper_umodes |= UMODE_CALLERID;
2790 } | T_LOCOPS
2791 {
2792 ConfigGeneral.oper_umodes |= UMODE_LOCOPS;
2793 } | T_NONONREG
2794 {
2795 ConfigGeneral.oper_umodes |= UMODE_REGONLY;
2796 } | T_FARCONNECT
2797 {
2798 ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2799 };
2800
2801 general_oper_only_umodes: OPER_ONLY_UMODES
2802 {
2803 ConfigGeneral.oper_only_umodes = 0;
2804 } '=' umode_items ';' ;
2805
2806 umode_items: umode_items ',' umode_item | umode_item;
2807 umode_item: T_BOTS
2808 {
2809 ConfigGeneral.oper_only_umodes |= UMODE_BOTS;
2810 } | T_CCONN
2811 {
2812 ConfigGeneral.oper_only_umodes |= UMODE_CCONN;
2813 } | T_DEAF
2814 {
2815 ConfigGeneral.oper_only_umodes |= UMODE_DEAF;
2816 } | T_DEBUG
2817 {
2818 ConfigGeneral.oper_only_umodes |= UMODE_DEBUG;
2819 } | T_FULL
2820 {
2821 ConfigGeneral.oper_only_umodes |= UMODE_FULL;
2822 } | T_SKILL
2823 {
2824 ConfigGeneral.oper_only_umodes |= UMODE_SKILL;
2825 } | HIDDEN
2826 {
2827 ConfigGeneral.oper_only_umodes |= UMODE_HIDDEN;
2828 } | T_NCHANGE
2829 {
2830 ConfigGeneral.oper_only_umodes |= UMODE_NCHANGE;
2831 } | T_REJ
2832 {
2833 ConfigGeneral.oper_only_umodes |= UMODE_REJ;
2834 } | T_UNAUTH
2835 {
2836 ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH;
2837 } | T_SPY
2838 {
2839 ConfigGeneral.oper_only_umodes |= UMODE_SPY;
2840 } | T_EXTERNAL
2841 {
2842 ConfigGeneral.oper_only_umodes |= UMODE_EXTERNAL;
2843 } | T_SERVNOTICE
2844 {
2845 ConfigGeneral.oper_only_umodes |= UMODE_SERVNOTICE;
2846 } | T_INVISIBLE
2847 {
2848 ConfigGeneral.oper_only_umodes |= UMODE_INVISIBLE;
2849 } | T_WALLOP
2850 {
2851 ConfigGeneral.oper_only_umodes |= UMODE_WALLOP;
2852 } | T_SOFTCALLERID
2853 {
2854 ConfigGeneral.oper_only_umodes |= UMODE_SOFTCALLERID;
2855 } | T_CALLERID
2856 {
2857 ConfigGeneral.oper_only_umodes |= UMODE_CALLERID;
2858 } | T_LOCOPS
2859 {
2860 ConfigGeneral.oper_only_umodes |= UMODE_LOCOPS;
2861 } | T_NONONREG
2862 {
2863 ConfigGeneral.oper_only_umodes |= UMODE_REGONLY;
2864 } | T_FARCONNECT
2865 {
2866 ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2867 };
2868
2869 general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2870 {
2871 ConfigGeneral.min_nonwildcard = $3;
2872 };
2873
2874 general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2875 {
2876 ConfigGeneral.min_nonwildcard_simple = $3;
2877 };
2878
2879 general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2880 {
2881 ConfigGeneral.default_floodcount = $3;
2882 };
2883
2884
2885 /***************************************************************************
2886 * channel {} section
2887 ***************************************************************************/
2888 channel_entry: CHANNEL '{' channel_items '}' ';';
2889
2890 channel_items: channel_items channel_item | channel_item;
2891 channel_item: channel_max_bans |
2892 channel_invite_client_count |
2893 channel_invite_client_time |
2894 channel_invite_delay_channel |
2895 channel_knock_client_count |
2896 channel_knock_client_time |
2897 channel_knock_delay_channel |
2898 channel_max_channels |
2899 channel_default_join_flood_count |
2900 channel_default_join_flood_time |
2901 channel_disable_fake_channels |
2902 error;
2903
2904 channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2905 {
2906 ConfigChannel.disable_fake_channels = yylval.number;
2907 };
2908
2909 channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2910 {
2911 ConfigChannel.invite_client_count = $3;
2912 };
2913
2914 channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2915 {
2916 ConfigChannel.invite_client_time = $3;
2917 };
2918
2919 channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';'
2920 {
2921 ConfigChannel.invite_delay_channel = $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_bans: MAX_BANS '=' NUMBER ';'
2945 {
2946 ConfigChannel.max_bans = $3;
2947 };
2948
2949 channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
2950 {
2951 ConfigChannel.default_join_flood_count = yylval.number;
2952 };
2953
2954 channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
2955 {
2956 ConfigChannel.default_join_flood_time = $3;
2957 };
2958
2959
2960 /***************************************************************************
2961 * serverhide {} section
2962 ***************************************************************************/
2963 serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';';
2964
2965 serverhide_items: serverhide_items serverhide_item | serverhide_item;
2966 serverhide_item: serverhide_flatten_links |
2967 serverhide_flatten_links_delay |
2968 serverhide_flatten_links_file |
2969 serverhide_disable_remote_commands |
2970 serverhide_hide_servers |
2971 serverhide_hide_services |
2972 serverhide_hidden |
2973 serverhide_hidden_name |
2974 serverhide_hide_server_ips |
2975 error;
2976
2977 serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
2978 {
2979 if (conf_parser_ctx.pass == 2)
2980 ConfigServerHide.flatten_links = yylval.number;
2981 };
2982
2983 serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';'
2984 {
2985 if (conf_parser_ctx.pass == 2)
2986 {
2987 if ($3 > 0)
2988 {
2989 event_write_links_file.when = $3;
2990 event_add(&event_write_links_file, NULL);
2991 }
2992 else
2993 event_delete(&event_write_links_file);
2994
2995 ConfigServerHide.flatten_links_delay = $3;
2996 }
2997 };
2998
2999 serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';'
3000 {
3001 if (conf_parser_ctx.pass == 2)
3002 {
3003 xfree(ConfigServerHide.flatten_links_file);
3004 ConfigServerHide.flatten_links_file = xstrdup(yylval.string);
3005 }
3006 };
3007
3008 serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
3009 {
3010 if (conf_parser_ctx.pass == 2)
3011 ConfigServerHide.disable_remote_commands = yylval.number;
3012 };
3013
3014 serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3015 {
3016 if (conf_parser_ctx.pass == 2)
3017 ConfigServerHide.hide_servers = yylval.number;
3018 };
3019
3020 serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
3021 {
3022 if (conf_parser_ctx.pass == 2)
3023 ConfigServerHide.hide_services = yylval.number;
3024 };
3025
3026 serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3027 {
3028 if (conf_parser_ctx.pass == 2)
3029 {
3030 xfree(ConfigServerHide.hidden_name);
3031 ConfigServerHide.hidden_name = xstrdup(yylval.string);
3032 }
3033 };
3034
3035 serverhide_hidden: HIDDEN '=' TBOOL ';'
3036 {
3037 if (conf_parser_ctx.pass == 2)
3038 ConfigServerHide.hidden = yylval.number;
3039 };
3040
3041 serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3042 {
3043 if (conf_parser_ctx.pass == 2)
3044 ConfigServerHide.hide_server_ips = yylval.number;
3045 };

Properties

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