ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 4121
Committed: Tue Jul 1 17:01:33 2014 UTC (12 years, 3 months ago) by michael
File size: 79196 byte(s)
Error occurred while calculating annotation data.
Log Message:
- conf_parser.y: fixed stupid bug. no comment there...

File Contents

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

Properties

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