ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 6008
Committed: Sat May 30 19:18:21 2015 UTC (10 years, 2 months ago) by michael
File size: 78525 byte(s)
Log Message:
- conf_parser.y: always rebuild CIDR lists	

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

Properties

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