ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 4989
Committed: Mon Dec 8 20:07:36 2014 UTC (11 years, 9 months ago) by michael
File size: 79410 byte(s)
Log Message:
- The general::true_no_oper_flood configuration option has been deprecated.
  Operators still can have higher 'flood' limits with no_oper_flood = yes;
  hoewever, they are no longer allowed to bypass RecvQ limits.

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

Properties

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