ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 3762
Committed: Sun Jun 1 19:35:16 2014 UTC (12 years, 4 months ago) by michael
File size: 77702 byte(s)
Log Message:
- Added INVITE flood protection/throttling as requested by Adam. This basically
  works similar as the KNOCK throttling algorithm.

File Contents

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

Properties

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