ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1715
Committed: Mon Dec 24 15:19:32 2012 UTC (13 years, 9 months ago) by michael
File size: 71362 byte(s)
Log Message:
- Improved WEBIRC authentication; added 'webirc' to auth::flags

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

Properties

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