ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1992
Committed: Fri May 10 18:32:26 2013 UTC (13 years, 2 months ago) by michael
File size: 72422 byte(s)
Log Message:
- Removed unused OFLAG_OPER_SPY definition

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

Properties

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