ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 2196
Committed: Tue Jun 4 18:30:12 2013 UTC (10 years, 9 months ago) by michael
File size: 73731 byte(s)
Log Message:
- Moved disable_remote_command configuration directive from
  general{} block to serverhide{] block

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

Properties

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