/[svn]/ircd-hybrid/trunk/src/conf_parser.y
ViewVC logotype

Contents of /ircd-hybrid/trunk/src/conf_parser.y

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1651 - (show annotations)
Sun Nov 11 10:54:51 2012 UTC (7 years, 8 months ago) by michael
File size: 71247 byte(s)
- Fixed class blocks not getting default values set properly
- bison 2.6.5

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

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28