ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 5556
Committed: Fri Feb 13 19:25:36 2015 UTC (11 years, 7 months ago) by michael
File size: 80134 byte(s)
Error occurred while calculating annotation data.
Log Message:
- Added oper::whois configuration option which allows to override the default
  RPL_WHOISOPERATOR numeric string shown in /whois.

File Contents

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

Properties

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