ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 6597
Committed: Thu Oct 22 17:23:06 2015 UTC (9 years, 10 months ago) by michael
File size: 77088 byte(s)
Log Message:
- Renamed serverhide::links_delay configuration directive to serverhide::flatten_links_delay

File Contents

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

Properties

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