ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1736
Committed: Sun Jan 13 09:31:46 2013 UTC (13 years, 8 months ago) by michael
File size: 71425 byte(s)
Log Message:
- Forward-port -r1732 [Dropped support for linux rt signals]

File Contents

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

Properties

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