ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 3892
Committed: Fri Jun 6 18:42:41 2014 UTC (12 years, 1 month ago) by michael
File size: 77756 byte(s)
Log Message:
- conf_parser.y: fixed stupid bug that has successfully has hidden itself since Feb 5, 2002

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

Properties

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