ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 3869
Committed: Thu Jun 5 22:19:27 2014 UTC (11 years, 2 months ago) by michael
File size: 77588 byte(s)
Log Message:
- Removed OPERWALL. Use GLOBOPS instead.

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

Properties

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