ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 3513
Committed: Mon May 12 16:28:29 2014 UTC (12 years, 4 months ago) by michael
File size: 77348 byte(s)
Log Message:
- Added usermode +p which hides channel list in WHOIS

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

Properties

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