ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1753
Committed: Wed Jan 16 19:30:51 2013 UTC (13 years, 8 months ago) by michael
File size: 72804 byte(s)
Log Message:
- conf_parser.y: fixed warning introduced by previous commit

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

Properties

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