ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/src/conf_parser.y
Revision: 1228
Committed: Mon Sep 19 09:38:38 2011 UTC (12 years, 6 months ago) by michael
Original Path: ircd-hybrid-8/src/ircd_parser.y
File size: 86160 byte(s)
Log Message:
- add 'restart'/'module' operator flags which allows better fine tuning
  whether or not an operator may have access to RESTART/MOD* commands
- ircd_parser.y: (oper{}): ensure yy_aconf->port is set to zero, before
  setting any privilege bits. Fixes odd behaviour with multiple 'flags'
  entries.
  Also removed ability to negate operator flags with a tilde '~'. Pretty
  useless since all operator privilege flags are set to zero by default.

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * ircd_parser.y: Parses the ircd configuration file.
4 *
5 * Copyright (C) 2005 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 %{
26
27 #define YY_NO_UNPUT
28 #include <sys/types.h>
29 #include <string.h>
30
31 #include "config.h"
32 #include "stdinc.h"
33 #include "ircd.h"
34 #include "list.h"
35 #include "s_conf.h"
36 #include "event.h"
37 #include "s_log.h"
38 #include "client.h" /* for UMODE_ALL only */
39 #include "irc_string.h"
40 #include "sprintf_irc.h"
41 #include "memory.h"
42 #include "modules.h"
43 #include "s_serv.h"
44 #include "hostmask.h"
45 #include "send.h"
46 #include "listener.h"
47 #include "resv.h"
48 #include "numeric.h"
49 #include "s_user.h"
50
51 #ifdef HAVE_LIBCRYPTO
52 #include <openssl/rsa.h>
53 #include <openssl/bio.h>
54 #include <openssl/pem.h>
55 #endif
56
57 static char *class_name = NULL;
58 static struct ConfItem *yy_conf = NULL;
59 static struct AccessItem *yy_aconf = NULL;
60 static struct MatchItem *yy_match_item = NULL;
61 static struct ClassItem *yy_class = NULL;
62 static char *yy_class_name = NULL;
63
64 static dlink_list col_conf_list = { NULL, NULL, 0 };
65 static dlink_list hub_conf_list = { NULL, NULL, 0 };
66 static dlink_list leaf_conf_list = { NULL, NULL, 0 };
67 static unsigned int listener_flags = 0;
68 static unsigned int regex_ban = 0;
69 static char userbuf[IRCD_BUFSIZE];
70 static char hostbuf[IRCD_BUFSIZE];
71 static char reasonbuf[REASONLEN + 1];
72 static char gecos_name[REALLEN * 4];
73
74 static char *resv_reason = NULL;
75 static char *listener_address = NULL;
76
77 struct CollectItem
78 {
79 dlink_node node;
80 char *name;
81 char *user;
82 char *host;
83 char *passwd;
84 int port;
85 int flags;
86 #ifdef HAVE_LIBCRYPTO
87 char *rsa_public_key_file;
88 RSA *rsa_public_key;
89 #endif
90 };
91
92 static void
93 free_collect_item(struct CollectItem *item)
94 {
95 MyFree(item->name);
96 MyFree(item->user);
97 MyFree(item->host);
98 MyFree(item->passwd);
99 #ifdef HAVE_LIBCRYPTO
100 MyFree(item->rsa_public_key_file);
101 #endif
102 MyFree(item);
103 }
104
105 static void
106 unhook_hub_leaf_confs(void)
107 {
108 dlink_node *ptr;
109 dlink_node *next_ptr;
110 struct CollectItem *yy_hconf;
111 struct CollectItem *yy_lconf;
112
113 DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
114 {
115 yy_hconf = ptr->data;
116 dlinkDelete(&yy_hconf->node, &hub_conf_list);
117 free_collect_item(yy_hconf);
118 }
119
120 DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
121 {
122 yy_lconf = ptr->data;
123 dlinkDelete(&yy_lconf->node, &leaf_conf_list);
124 free_collect_item(yy_lconf);
125 }
126 }
127
128 %}
129
130 %union {
131 int number;
132 char *string;
133 }
134
135 %token ACCEPT_PASSWORD
136 %token ACTION
137 %token ADMIN
138 %token AFTYPE
139 %token T_ALLOW
140 %token ANTI_NICK_FLOOD
141 %token ANTI_SPAM_EXIT_MESSAGE_TIME
142 %token AUTOCONN
143 %token T_BLOCK
144 %token BURST_AWAY
145 %token BURST_TOPICWHO
146 %token BYTES KBYTES MBYTES GBYTES TBYTES
147 %token CALLER_ID_WAIT
148 %token CAN_FLOOD
149 %token CHANNEL
150 %token CIDR_BITLEN_IPV4
151 %token CIDR_BITLEN_IPV6
152 %token CIPHER_PREFERENCE
153 %token CLASS
154 %token COMPRESSED
155 %token COMPRESSION_LEVEL
156 %token CONNECT
157 %token CONNECTFREQ
158 %token CRYPTLINK
159 %token DEFAULT_CIPHER_PREFERENCE
160 %token DEFAULT_FLOODCOUNT
161 %token DEFAULT_SPLIT_SERVER_COUNT
162 %token DEFAULT_SPLIT_USER_COUNT
163 %token DENY
164 %token DESCRIPTION
165 %token DIE
166 %token DISABLE_AUTH
167 %token DISABLE_FAKE_CHANNELS
168 %token DISABLE_HIDDEN
169 %token DISABLE_LOCAL_CHANNELS
170 %token DISABLE_REMOTE_COMMANDS
171 %token DOTS_IN_IDENT
172 %token DURATION
173 %token EGDPOOL_PATH
174 %token EMAIL
175 %token ENABLE
176 %token ENCRYPTED
177 %token EXCEED_LIMIT
178 %token EXEMPT
179 %token FAILED_OPER_NOTICE
180 %token IRCD_FLAGS
181 %token FLATTEN_LINKS
182 %token FFAILED_OPERLOG
183 %token FKILLLOG
184 %token FKLINELOG
185 %token FGLINELOG
186 %token FIOERRLOG
187 %token FOPERLOG
188 %token FOPERSPYLOG
189 %token FUSERLOG
190 %token GECOS
191 %token GENERAL
192 %token GLINE
193 %token GLINES
194 %token GLINE_EXEMPT
195 %token GLINE_LOG
196 %token GLINE_TIME
197 %token GLINE_MIN_CIDR
198 %token GLINE_MIN_CIDR6
199 %token GLOBAL_KILL
200 %token IRCD_AUTH
201 %token NEED_IDENT
202 %token HAVENT_READ_CONF
203 %token HIDDEN
204 %token HIDDEN_ADMIN
205 %token HIDDEN_NAME
206 %token HIDDEN_OPER
207 %token HIDE_SERVER_IPS
208 %token HIDE_SERVERS
209 %token HIDE_SPOOF_IPS
210 %token HOST
211 %token HUB
212 %token HUB_MASK
213 %token IGNORE_BOGUS_TS
214 %token INVISIBLE_ON_CONNECT
215 %token IP
216 %token KILL
217 %token KILL_CHASE_TIME_LIMIT
218 %token KLINE
219 %token KLINE_EXEMPT
220 %token KLINE_REASON
221 %token KLINE_WITH_REASON
222 %token KNOCK_DELAY
223 %token KNOCK_DELAY_CHANNEL
224 %token LEAF_MASK
225 %token LINKS_DELAY
226 %token LISTEN
227 %token T_LOG
228 %token LOGGING
229 %token LOG_LEVEL
230 %token MAX_ACCEPT
231 %token MAX_BANS
232 %token MAX_CHANS_PER_USER
233 %token MAX_GLOBAL
234 %token MAX_IDENT
235 %token MAX_LOCAL
236 %token MAX_NICK_CHANGES
237 %token MAX_NICK_TIME
238 %token MAX_NUMBER
239 %token MAX_TARGETS
240 %token MAX_WATCH
241 %token MESSAGE_LOCALE
242 %token MIN_NONWILDCARD
243 %token MIN_NONWILDCARD_SIMPLE
244 %token MODULE
245 %token MODULES
246 %token NAME
247 %token NEED_PASSWORD
248 %token NETWORK_DESC
249 %token NETWORK_NAME
250 %token NICK
251 %token NICK_CHANGES
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_IDENT
258 %token NUMBER_PER_CIDR
259 %token NUMBER_PER_IP
260 %token NUMBER_PER_IP_GLOBAL
261 %token OPERATOR
262 %token OPERS_BYPASS_CALLERID
263 %token OPER_LOG
264 %token OPER_ONLY_UMODES
265 %token OPER_PASS_RESV
266 %token OPER_SPY_T
267 %token OPER_UMODES
268 %token JOIN_FLOOD_COUNT
269 %token JOIN_FLOOD_TIME
270 %token PACE_WAIT
271 %token PACE_WAIT_SIMPLE
272 %token PASSWORD
273 %token PATH
274 %token PING_COOKIE
275 %token PING_TIME
276 %token PING_WARNING
277 %token PORT
278 %token QSTRING
279 %token QUIET_ON_BAN
280 %token REASON
281 %token REDIRPORT
282 %token REDIRSERV
283 %token REGEX_T
284 %token REHASH
285 %token TREJECT_HOLD_TIME
286 %token REMOTE
287 %token REMOTEBAN
288 %token RESTRICT_CHANNELS
289 %token RESTRICTED
290 %token RSA_PRIVATE_KEY_FILE
291 %token RSA_PUBLIC_KEY_FILE
292 %token SSL_CERTIFICATE_FILE
293 %token T_SSL_CONNECTION_METHOD
294 %token T_SSLV3
295 %token T_TLSV1
296 %token RESV
297 %token RESV_EXEMPT
298 %token SECONDS MINUTES HOURS DAYS WEEKS
299 %token SENDQ
300 %token SEND_PASSWORD
301 %token SERVERHIDE
302 %token SERVERINFO
303 %token SERVLINK_PATH
304 %token IRCD_SID
305 %token TKLINE_EXPIRE_NOTICES
306 %token T_SHARED
307 %token T_CLUSTER
308 %token TYPE
309 %token SHORT_MOTD
310 %token SILENT
311 %token SPOOF
312 %token SPOOF_NOTICE
313 %token STATS_E_DISABLED
314 %token STATS_I_OPER_ONLY
315 %token STATS_K_OPER_ONLY
316 %token STATS_O_OPER_ONLY
317 %token STATS_P_OPER_ONLY
318 %token TBOOL
319 %token TMASKED
320 %token T_REJECT
321 %token TS_MAX_DELTA
322 %token TS_WARN_DELTA
323 %token TWODOTS
324 %token T_ALL
325 %token T_BOTS
326 %token T_SOFTCALLERID
327 %token T_CALLERID
328 %token T_CCONN
329 %token T_CCONN_FULL
330 %token T_CLIENT_FLOOD
331 %token T_DEAF
332 %token T_DEBUG
333 %token T_DRONE
334 %token T_EXTERNAL
335 %token T_FULL
336 %token T_INVISIBLE
337 %token T_IPV4
338 %token T_IPV6
339 %token T_LOCOPS
340 %token T_LOGPATH
341 %token T_L_CRIT
342 %token T_L_DEBUG
343 %token T_L_ERROR
344 %token T_L_INFO
345 %token T_L_NOTICE
346 %token T_L_TRACE
347 %token T_L_WARN
348 %token T_MAX_CLIENTS
349 %token T_NCHANGE
350 %token T_OPERWALL
351 %token T_REJ
352 %token T_SERVER
353 %token T_SERVNOTICE
354 %token T_SKILL
355 %token T_SPY
356 %token T_SSL
357 %token T_UMODES
358 %token T_UNAUTH
359 %token T_UNRESV
360 %token T_UNXLINE
361 %token T_GLOBOPS
362 %token T_WALLOP
363 %token T_RESTART
364 %token T_SERVICE
365 %token T_SERVICES_NAME
366 %token THROTTLE_TIME
367 %token TOPICBURST
368 %token TRUE_NO_OPER_FLOOD
369 %token TKLINE
370 %token TXLINE
371 %token TRESV
372 %token UNKLINE
373 %token USER
374 %token USE_EGD
375 %token USE_EXCEPT
376 %token USE_INVEX
377 %token USE_KNOCK
378 %token USE_LOGGING
379 %token USE_WHOIS_ACTUALLY
380 %token VHOST
381 %token VHOST6
382 %token XLINE
383 %token WARN
384 %token WARN_NO_NLINE
385
386 %type <string> QSTRING
387 %type <number> NUMBER
388 %type <number> timespec
389 %type <number> timespec_
390 %type <number> sizespec
391 %type <number> sizespec_
392
393 %%
394 conf:
395 | conf conf_item
396 ;
397
398 conf_item: admin_entry
399 | logging_entry
400 | oper_entry
401 | channel_entry
402 | class_entry
403 | listen_entry
404 | auth_entry
405 | serverinfo_entry
406 | serverhide_entry
407 | resv_entry
408 | service_entry
409 | shared_entry
410 | cluster_entry
411 | connect_entry
412 | kill_entry
413 | deny_entry
414 | exempt_entry
415 | general_entry
416 | gline_entry
417 | gecos_entry
418 | modules_entry
419 | error ';'
420 | error '}'
421 ;
422
423
424 timespec_: { $$ = 0; } | timespec;
425 timespec: NUMBER timespec_
426 {
427 $$ = $1 + $2;
428 }
429 | NUMBER SECONDS timespec_
430 {
431 $$ = $1 + $3;
432 }
433 | NUMBER MINUTES timespec_
434 {
435 $$ = $1 * 60 + $3;
436 }
437 | NUMBER HOURS timespec_
438 {
439 $$ = $1 * 60 * 60 + $3;
440 }
441 | NUMBER DAYS timespec_
442 {
443 $$ = $1 * 60 * 60 * 24 + $3;
444 }
445 | NUMBER WEEKS timespec_
446 {
447 $$ = $1 * 60 * 60 * 24 * 7 + $3;
448 }
449 ;
450
451 sizespec_: { $$ = 0; } | sizespec;
452 sizespec: NUMBER sizespec_ { $$ = $1 + $2; }
453 | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
454 | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
455 | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
456 ;
457
458
459 /***************************************************************************
460 * section modules
461 ***************************************************************************/
462 modules_entry: MODULES
463 '{' modules_items '}' ';';
464
465 modules_items: modules_items modules_item | modules_item;
466 modules_item: modules_module | modules_path | error ';' ;
467
468 modules_module: MODULE '=' QSTRING ';'
469 {
470 if (conf_parser_ctx.pass == 2)
471 add_conf_module(libio_basename(yylval.string));
472 };
473
474 modules_path: PATH '=' QSTRING ';'
475 {
476 if (conf_parser_ctx.pass == 2)
477 mod_add_path(yylval.string);
478 };
479
480
481 serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
482
483 serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ;
484 serverinfo_item: serverinfo_name | serverinfo_vhost |
485 serverinfo_hub | serverinfo_description |
486 serverinfo_network_name | serverinfo_network_desc |
487 serverinfo_max_clients |
488 serverinfo_rsa_private_key_file | serverinfo_vhost6 |
489 serverinfo_sid | serverinfo_ssl_certificate_file |
490 serverinfo_ssl_connection_method |
491 error ';' ;
492
493
494 serverinfo_ssl_connection_method: T_SSL_CONNECTION_METHOD
495 {
496 #ifdef HAVE_LIBCRYPTO
497 if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
498 ServerInfo.tls_version = 0;
499 #endif
500 } '=' method_types ';'
501 {
502 #ifdef HAVE_LIBCRYPTO
503 if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
504 {
505 if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_SSLV3))
506 SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
507 if (!(ServerInfo.tls_version & CONF_SERVER_INFO_TLS_VERSION_TLSV1))
508 SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
509 }
510 #endif
511 };
512
513 method_types: method_types ',' method_type_item | method_type_item;
514 method_type_item: T_SSLV3
515 {
516 #ifdef HAVE_LIBCRYPTO
517 if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
518 ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_SSLV3;
519 #endif
520 } | T_TLSV1
521 {
522 #ifdef HAVE_LIBCRYPTO
523 if (conf_parser_ctx.boot && conf_parser_ctx.pass == 2)
524 ServerInfo.tls_version |= CONF_SERVER_INFO_TLS_VERSION_TLSV1;
525 #endif
526 };
527
528 serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
529 {
530 #ifdef HAVE_LIBCRYPTO
531 if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
532 {
533 if (!ServerInfo.rsa_private_key_file)
534 {
535 yyerror("No rsa_private_key_file specified, SSL disabled");
536 break;
537 }
538
539 if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
540 SSL_FILETYPE_PEM) <= 0)
541 {
542 yyerror(ERR_lib_error_string(ERR_get_error()));
543 break;
544 }
545
546 if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
547 SSL_FILETYPE_PEM) <= 0)
548 {
549 yyerror(ERR_lib_error_string(ERR_get_error()));
550 break;
551 }
552
553 if (!SSL_CTX_check_private_key(ServerInfo.server_ctx))
554 {
555 yyerror(ERR_lib_error_string(ERR_get_error()));
556 break;
557 }
558 }
559 #endif
560 };
561
562 serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
563 {
564 #ifdef HAVE_LIBCRYPTO
565 if (conf_parser_ctx.pass == 1)
566 {
567 BIO *file;
568
569 if (ServerInfo.rsa_private_key)
570 {
571 RSA_free(ServerInfo.rsa_private_key);
572 ServerInfo.rsa_private_key = NULL;
573 }
574
575 if (ServerInfo.rsa_private_key_file)
576 {
577 MyFree(ServerInfo.rsa_private_key_file);
578 ServerInfo.rsa_private_key_file = NULL;
579 }
580
581 DupString(ServerInfo.rsa_private_key_file, yylval.string);
582
583 if ((file = BIO_new_file(yylval.string, "r")) == NULL)
584 {
585 yyerror("File open failed, ignoring");
586 break;
587 }
588
589 ServerInfo.rsa_private_key = (RSA *)PEM_read_bio_RSAPrivateKey(file, NULL,
590 0, NULL);
591
592 BIO_set_close(file, BIO_CLOSE);
593 BIO_free(file);
594
595 if (ServerInfo.rsa_private_key == NULL)
596 {
597 yyerror("Couldn't extract key, ignoring");
598 break;
599 }
600
601 if (!RSA_check_key(ServerInfo.rsa_private_key))
602 {
603 RSA_free(ServerInfo.rsa_private_key);
604 ServerInfo.rsa_private_key = NULL;
605
606 yyerror("Invalid key, ignoring");
607 break;
608 }
609
610 /* require 2048 bit (256 byte) key */
611 if (RSA_size(ServerInfo.rsa_private_key) != 256)
612 {
613 RSA_free(ServerInfo.rsa_private_key);
614 ServerInfo.rsa_private_key = NULL;
615
616 yyerror("Not a 2048 bit key, ignoring");
617 }
618 }
619 #endif
620 };
621
622 serverinfo_name: NAME '=' QSTRING ';'
623 {
624 /* this isn't rehashable */
625 if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
626 {
627 if (valid_servname(yylval.string))
628 DupString(ServerInfo.name, yylval.string);
629 else
630 {
631 ilog(L_ERROR, "Ignoring serverinfo::name -- invalid name. Aborting.");
632 exit(0);
633 }
634 }
635 };
636
637 serverinfo_sid: IRCD_SID '=' QSTRING ';'
638 {
639 /* this isn't rehashable */
640 if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
641 {
642 if (valid_sid(yylval.string))
643 DupString(ServerInfo.sid, yylval.string);
644 else
645 {
646 ilog(L_ERROR, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
647 exit(0);
648 }
649 }
650 };
651
652 serverinfo_description: DESCRIPTION '=' QSTRING ';'
653 {
654 if (conf_parser_ctx.pass == 2)
655 {
656 MyFree(ServerInfo.description);
657 DupString(ServerInfo.description,yylval.string);
658 }
659 };
660
661 serverinfo_network_name: NETWORK_NAME '=' QSTRING ';'
662 {
663 if (conf_parser_ctx.pass == 2)
664 {
665 char *p;
666
667 if ((p = strchr(yylval.string, ' ')) != NULL)
668 p = '\0';
669
670 MyFree(ServerInfo.network_name);
671 DupString(ServerInfo.network_name, yylval.string);
672 }
673 };
674
675 serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
676 {
677 if (conf_parser_ctx.pass == 2)
678 {
679 MyFree(ServerInfo.network_desc);
680 DupString(ServerInfo.network_desc, yylval.string);
681 }
682 };
683
684 serverinfo_vhost: VHOST '=' QSTRING ';'
685 {
686 if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
687 {
688 struct addrinfo hints, *res;
689
690 memset(&hints, 0, sizeof(hints));
691
692 hints.ai_family = AF_UNSPEC;
693 hints.ai_socktype = SOCK_STREAM;
694 hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
695
696 if (getaddrinfo(yylval.string, NULL, &hints, &res))
697 ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
698 else
699 {
700 assert(res != NULL);
701
702 memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen);
703 ServerInfo.ip.ss.ss_family = res->ai_family;
704 ServerInfo.ip.ss_len = res->ai_addrlen;
705 freeaddrinfo(res);
706
707 ServerInfo.specific_ipv4_vhost = 1;
708 }
709 }
710 };
711
712 serverinfo_vhost6: VHOST6 '=' QSTRING ';'
713 {
714 #ifdef IPV6
715 if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
716 {
717 struct addrinfo hints, *res;
718
719 memset(&hints, 0, sizeof(hints));
720
721 hints.ai_family = AF_UNSPEC;
722 hints.ai_socktype = SOCK_STREAM;
723 hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
724
725 if (getaddrinfo(yylval.string, NULL, &hints, &res))
726 ilog(L_ERROR, "Invalid netmask for server vhost6(%s)", yylval.string);
727 else
728 {
729 assert(res != NULL);
730
731 memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen);
732 ServerInfo.ip6.ss.ss_family = res->ai_family;
733 ServerInfo.ip6.ss_len = res->ai_addrlen;
734 freeaddrinfo(res);
735
736 ServerInfo.specific_ipv6_vhost = 1;
737 }
738 }
739 #endif
740 };
741
742 serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
743 {
744 if (conf_parser_ctx.pass == 2)
745 {
746 recalc_fdlimit(NULL);
747
748 if ($3 < MAXCLIENTS_MIN)
749 {
750 char buf[IRCD_BUFSIZE];
751 ircsprintf(buf, "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
752 yyerror(buf);
753 }
754 else if ($3 > MAXCLIENTS_MAX)
755 {
756 char buf[IRCD_BUFSIZE];
757 ircsprintf(buf, "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
758 yyerror(buf);
759 }
760 else
761 ServerInfo.max_clients = $3;
762 }
763 };
764
765 serverinfo_hub: HUB '=' TBOOL ';'
766 {
767 if (conf_parser_ctx.pass == 2)
768 ServerInfo.hub = yylval.number;
769 };
770
771 /***************************************************************************
772 * admin section
773 ***************************************************************************/
774 admin_entry: ADMIN '{' admin_items '}' ';' ;
775
776 admin_items: admin_items admin_item | admin_item;
777 admin_item: admin_name | admin_description |
778 admin_email | error ';' ;
779
780 admin_name: NAME '=' QSTRING ';'
781 {
782 if (conf_parser_ctx.pass == 2)
783 {
784 MyFree(AdminInfo.name);
785 DupString(AdminInfo.name, yylval.string);
786 }
787 };
788
789 admin_email: EMAIL '=' QSTRING ';'
790 {
791 if (conf_parser_ctx.pass == 2)
792 {
793 MyFree(AdminInfo.email);
794 DupString(AdminInfo.email, yylval.string);
795 }
796 };
797
798 admin_description: DESCRIPTION '=' QSTRING ';'
799 {
800 if (conf_parser_ctx.pass == 2)
801 {
802 MyFree(AdminInfo.description);
803 DupString(AdminInfo.description, yylval.string);
804 }
805 };
806
807 /***************************************************************************
808 * section logging
809 ***************************************************************************/
810 /* XXX */
811 logging_entry: LOGGING '{' logging_items '}' ';' ;
812
813 logging_items: logging_items logging_item |
814 logging_item ;
815
816 logging_item: logging_path | logging_oper_log |
817 logging_log_level |
818 logging_use_logging | logging_fuserlog |
819 logging_foperlog | logging_fglinelog |
820 logging_fklinelog | logging_killlog |
821 logging_foperspylog | logging_ioerrlog |
822 logging_ffailed_operlog |
823 error ';' ;
824
825 logging_path: T_LOGPATH '=' QSTRING ';'
826 {
827 };
828
829 logging_oper_log: OPER_LOG '=' QSTRING ';'
830 {
831 };
832
833 logging_fuserlog: FUSERLOG '=' QSTRING ';'
834 {
835 if (conf_parser_ctx.pass == 2)
836 strlcpy(ConfigLoggingEntry.userlog, yylval.string,
837 sizeof(ConfigLoggingEntry.userlog));
838 };
839
840 logging_ffailed_operlog: FFAILED_OPERLOG '=' QSTRING ';'
841 {
842 if (conf_parser_ctx.pass == 2)
843 strlcpy(ConfigLoggingEntry.failed_operlog, yylval.string,
844 sizeof(ConfigLoggingEntry.failed_operlog));
845 };
846
847 logging_foperlog: FOPERLOG '=' QSTRING ';'
848 {
849 if (conf_parser_ctx.pass == 2)
850 strlcpy(ConfigLoggingEntry.operlog, yylval.string,
851 sizeof(ConfigLoggingEntry.operlog));
852 };
853
854 logging_foperspylog: FOPERSPYLOG '=' QSTRING ';'
855 {
856 if (conf_parser_ctx.pass == 2)
857 strlcpy(ConfigLoggingEntry.operspylog, yylval.string,
858 sizeof(ConfigLoggingEntry.operspylog));
859 };
860
861 logging_fglinelog: FGLINELOG '=' QSTRING ';'
862 {
863 if (conf_parser_ctx.pass == 2)
864 strlcpy(ConfigLoggingEntry.glinelog, yylval.string,
865 sizeof(ConfigLoggingEntry.glinelog));
866 };
867
868 logging_fklinelog: FKLINELOG '=' QSTRING ';'
869 {
870 if (conf_parser_ctx.pass == 2)
871 strlcpy(ConfigLoggingEntry.klinelog, yylval.string,
872 sizeof(ConfigLoggingEntry.klinelog));
873 };
874
875 logging_ioerrlog: FIOERRLOG '=' QSTRING ';'
876 {
877 if (conf_parser_ctx.pass == 2)
878 strlcpy(ConfigLoggingEntry.ioerrlog, yylval.string,
879 sizeof(ConfigLoggingEntry.ioerrlog));
880 };
881
882 logging_killlog: FKILLLOG '=' QSTRING ';'
883 {
884 if (conf_parser_ctx.pass == 2)
885 strlcpy(ConfigLoggingEntry.killlog, yylval.string,
886 sizeof(ConfigLoggingEntry.killlog));
887 };
888
889 logging_log_level: LOG_LEVEL '=' T_L_CRIT ';'
890 {
891 if (conf_parser_ctx.pass == 2)
892 set_log_level(L_CRIT);
893 } | LOG_LEVEL '=' T_L_ERROR ';'
894 {
895 if (conf_parser_ctx.pass == 2)
896 set_log_level(L_ERROR);
897 } | LOG_LEVEL '=' T_L_WARN ';'
898 {
899 if (conf_parser_ctx.pass == 2)
900 set_log_level(L_WARN);
901 } | LOG_LEVEL '=' T_L_NOTICE ';'
902 {
903 if (conf_parser_ctx.pass == 2)
904 set_log_level(L_NOTICE);
905 } | LOG_LEVEL '=' T_L_TRACE ';'
906 {
907 if (conf_parser_ctx.pass == 2)
908 set_log_level(L_TRACE);
909 } | LOG_LEVEL '=' T_L_INFO ';'
910 {
911 if (conf_parser_ctx.pass == 2)
912 set_log_level(L_INFO);
913 } | LOG_LEVEL '=' T_L_DEBUG ';'
914 {
915 if (conf_parser_ctx.pass == 2)
916 set_log_level(L_DEBUG);
917 };
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 /***************************************************************************
926 * section oper
927 ***************************************************************************/
928 oper_entry: OPERATOR
929 {
930 if (conf_parser_ctx.pass == 2)
931 {
932 yy_conf = make_conf_item(OPER_TYPE);
933 yy_aconf = map_to_conf(yy_conf);
934 SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */
935 }
936 else
937 {
938 MyFree(class_name);
939 class_name = NULL;
940 }
941 } oper_name_b '{' oper_items '}' ';'
942 {
943 if (conf_parser_ctx.pass == 2)
944 {
945 struct CollectItem *yy_tmp;
946 dlink_node *ptr;
947 dlink_node *next_ptr;
948
949 conf_add_class_to_conf(yy_conf, class_name);
950
951 /* Now, make sure there is a copy of the "base" given oper
952 * block in each of the collected copies
953 */
954
955 DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
956 {
957 struct AccessItem *new_aconf;
958 struct ConfItem *new_conf;
959 yy_tmp = ptr->data;
960
961 new_conf = make_conf_item(OPER_TYPE);
962 new_aconf = (struct AccessItem *)map_to_conf(new_conf);
963
964 new_aconf->flags = yy_aconf->flags;
965
966 if (yy_conf->name != NULL)
967 DupString(new_conf->name, yy_conf->name);
968 if (yy_tmp->user != NULL)
969 DupString(new_aconf->user, yy_tmp->user);
970 else
971 DupString(new_aconf->user, "*");
972 if (yy_tmp->host != NULL)
973 DupString(new_aconf->host, yy_tmp->host);
974 else
975 DupString(new_aconf->host, "*");
976 conf_add_class_to_conf(new_conf, class_name);
977 if (yy_aconf->passwd != NULL)
978 DupString(new_aconf->passwd, yy_aconf->passwd);
979
980 new_aconf->port = yy_aconf->port;
981 #ifdef HAVE_LIBCRYPTO
982 if (yy_aconf->rsa_public_key_file != NULL)
983 {
984 BIO *file;
985
986 DupString(new_aconf->rsa_public_key_file,
987 yy_aconf->rsa_public_key_file);
988
989 file = BIO_new_file(yy_aconf->rsa_public_key_file, "r");
990 new_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file,
991 NULL, 0, NULL);
992 BIO_set_close(file, BIO_CLOSE);
993 BIO_free(file);
994 }
995 #endif
996
997 #ifdef HAVE_LIBCRYPTO
998 if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key)
999 && yy_tmp->host)
1000 #else
1001 if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host)
1002 #endif
1003 {
1004 conf_add_class_to_conf(new_conf, class_name);
1005 if (yy_tmp->name != NULL)
1006 DupString(new_conf->name, yy_tmp->name);
1007 }
1008
1009 dlinkDelete(&yy_tmp->node, &col_conf_list);
1010 free_collect_item(yy_tmp);
1011 }
1012
1013 yy_conf = NULL;
1014 yy_aconf = NULL;
1015
1016
1017 MyFree(class_name);
1018 class_name = NULL;
1019 }
1020 };
1021
1022 oper_name_b: | oper_name_t;
1023 oper_items: oper_items oper_item | oper_item;
1024 oper_item: oper_name | oper_user | oper_password |
1025 oper_umodes | oper_class | oper_encrypted |
1026 oper_rsa_public_key_file | oper_flags | error ';' ;
1027
1028 oper_name: NAME '=' QSTRING ';'
1029 {
1030 if (conf_parser_ctx.pass == 2)
1031 {
1032 if (strlen(yylval.string) > OPERNICKLEN)
1033 yylval.string[OPERNICKLEN] = '\0';
1034
1035 MyFree(yy_conf->name);
1036 DupString(yy_conf->name, yylval.string);
1037 }
1038 };
1039
1040 oper_name_t: QSTRING
1041 {
1042 if (conf_parser_ctx.pass == 2)
1043 {
1044 if (strlen(yylval.string) > OPERNICKLEN)
1045 yylval.string[OPERNICKLEN] = '\0';
1046
1047 MyFree(yy_conf->name);
1048 DupString(yy_conf->name, yylval.string);
1049 }
1050 };
1051
1052 oper_user: USER '=' QSTRING ';'
1053 {
1054 if (conf_parser_ctx.pass == 2)
1055 {
1056 struct split_nuh_item nuh;
1057
1058 nuh.nuhmask = yylval.string;
1059 nuh.nickptr = NULL;
1060 nuh.userptr = userbuf;
1061 nuh.hostptr = hostbuf;
1062
1063 nuh.nicksize = 0;
1064 nuh.usersize = sizeof(userbuf);
1065 nuh.hostsize = sizeof(hostbuf);
1066
1067 split_nuh(&nuh);
1068
1069 if (yy_aconf->user == NULL)
1070 {
1071 DupString(yy_aconf->user, userbuf);
1072 DupString(yy_aconf->host, hostbuf);
1073 }
1074 else
1075 {
1076 struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1077
1078 DupString(yy_tmp->user, userbuf);
1079 DupString(yy_tmp->host, hostbuf);
1080
1081 dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1082 }
1083 }
1084 };
1085
1086 oper_password: PASSWORD '=' QSTRING ';'
1087 {
1088 if (conf_parser_ctx.pass == 2)
1089 {
1090 if (yy_aconf->passwd != NULL)
1091 memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1092
1093 MyFree(yy_aconf->passwd);
1094 DupString(yy_aconf->passwd, yylval.string);
1095 }
1096 };
1097
1098 oper_encrypted: ENCRYPTED '=' TBOOL ';'
1099 {
1100 if (conf_parser_ctx.pass == 2)
1101 {
1102 if (yylval.number)
1103 SetConfEncrypted(yy_aconf);
1104 else
1105 ClearConfEncrypted(yy_aconf);
1106 }
1107 };
1108
1109 oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1110 {
1111 #ifdef HAVE_LIBCRYPTO
1112 if (conf_parser_ctx.pass == 2)
1113 {
1114 BIO *file;
1115
1116 if (yy_aconf->rsa_public_key != NULL)
1117 {
1118 RSA_free(yy_aconf->rsa_public_key);
1119 yy_aconf->rsa_public_key = NULL;
1120 }
1121
1122 if (yy_aconf->rsa_public_key_file != NULL)
1123 {
1124 MyFree(yy_aconf->rsa_public_key_file);
1125 yy_aconf->rsa_public_key_file = NULL;
1126 }
1127
1128 DupString(yy_aconf->rsa_public_key_file, yylval.string);
1129 file = BIO_new_file(yylval.string, "r");
1130
1131 if (file == NULL)
1132 {
1133 yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
1134 break;
1135 }
1136
1137 yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
1138
1139 if (yy_aconf->rsa_public_key == NULL)
1140 {
1141 yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
1142 break;
1143 }
1144
1145 BIO_set_close(file, BIO_CLOSE);
1146 BIO_free(file);
1147 }
1148 #endif /* HAVE_LIBCRYPTO */
1149 };
1150
1151 oper_class: CLASS '=' QSTRING ';'
1152 {
1153 if (conf_parser_ctx.pass == 2)
1154 {
1155 MyFree(class_name);
1156 DupString(class_name, yylval.string);
1157 }
1158 };
1159
1160 oper_umodes: T_UMODES
1161 {
1162 if (conf_parser_ctx.pass == 2)
1163 yy_aconf->modes = 0;
1164 } '=' oper_umodes_items ';' ;
1165
1166 oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1167 oper_umodes_item: T_BOTS
1168 {
1169 if (conf_parser_ctx.pass == 2)
1170 yy_aconf->modes |= UMODE_BOTS;
1171 } | T_CCONN
1172 {
1173 if (conf_parser_ctx.pass == 2)
1174 yy_aconf->modes |= UMODE_CCONN;
1175 } | T_CCONN_FULL
1176 {
1177 if (conf_parser_ctx.pass == 2)
1178 yy_aconf->modes |= UMODE_CCONN_FULL;
1179 } | T_DEAF
1180 {
1181 if (conf_parser_ctx.pass == 2)
1182 yy_aconf->modes |= UMODE_DEAF;
1183 } | T_DEBUG
1184 {
1185 if (conf_parser_ctx.pass == 2)
1186 yy_aconf->modes |= UMODE_DEBUG;
1187 } | T_FULL
1188 {
1189 if (conf_parser_ctx.pass == 2)
1190 yy_aconf->modes |= UMODE_FULL;
1191 } | T_SKILL
1192 {
1193 if (conf_parser_ctx.pass == 2)
1194 yy_aconf->modes |= UMODE_SKILL;
1195 } | T_NCHANGE
1196 {
1197 if (conf_parser_ctx.pass == 2)
1198 yy_aconf->modes |= UMODE_NCHANGE;
1199 } | T_REJ
1200 {
1201 if (conf_parser_ctx.pass == 2)
1202 yy_aconf->modes |= UMODE_REJ;
1203 } | T_UNAUTH
1204 {
1205 if (conf_parser_ctx.pass == 2)
1206 yy_aconf->modes |= UMODE_UNAUTH;
1207 } | T_SPY
1208 {
1209 if (conf_parser_ctx.pass == 2)
1210 yy_aconf->modes |= UMODE_SPY;
1211 } | T_EXTERNAL
1212 {
1213 if (conf_parser_ctx.pass == 2)
1214 yy_aconf->modes |= UMODE_EXTERNAL;
1215 } | T_OPERWALL
1216 {
1217 if (conf_parser_ctx.pass == 2)
1218 yy_aconf->modes |= UMODE_OPERWALL;
1219 } | T_SERVNOTICE
1220 {
1221 if (conf_parser_ctx.pass == 2)
1222 yy_aconf->modes |= UMODE_SERVNOTICE;
1223 } | T_INVISIBLE
1224 {
1225 if (conf_parser_ctx.pass == 2)
1226 yy_aconf->modes |= UMODE_INVISIBLE;
1227 } | T_WALLOP
1228 {
1229 if (conf_parser_ctx.pass == 2)
1230 yy_aconf->modes |= UMODE_WALLOP;
1231 } | T_SOFTCALLERID
1232 {
1233 if (conf_parser_ctx.pass == 2)
1234 yy_aconf->modes |= UMODE_SOFTCALLERID;
1235 } | T_CALLERID
1236 {
1237 if (conf_parser_ctx.pass == 2)
1238 yy_aconf->modes |= UMODE_CALLERID;
1239 } | T_LOCOPS
1240 {
1241 if (conf_parser_ctx.pass == 2)
1242 yy_aconf->modes |= UMODE_LOCOPS;
1243 };
1244
1245 oper_flags: IRCD_FLAGS
1246 {
1247 if (conf_parser_ctx.pass == 2)
1248 yy_aconf->port = 0;
1249 } '=' oper_flags_items ';';
1250
1251 oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1252 oper_flags_item: GLOBAL_KILL
1253 {
1254 if (conf_parser_ctx.pass == 2)
1255 yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1256 } | REMOTE
1257 {
1258 if (conf_parser_ctx.pass == 2)
1259 yy_aconf->port |= OPER_FLAG_REMOTE;
1260 } | KLINE
1261 {
1262 if (conf_parser_ctx.pass == 2)
1263 yy_aconf->port |= OPER_FLAG_K;
1264 } | UNKLINE
1265 {
1266 if (conf_parser_ctx.pass == 2)
1267 yy_aconf->port |= OPER_FLAG_UNKLINE;
1268 } | XLINE
1269 {
1270 if (conf_parser_ctx.pass == 2)
1271 yy_aconf->port |= OPER_FLAG_X;
1272 } | GLINE
1273 {
1274 if (conf_parser_ctx.pass == 2)
1275 yy_aconf->port |= OPER_FLAG_GLINE;
1276 } | DIE
1277 {
1278 if (conf_parser_ctx.pass == 2)
1279 yy_aconf->port |= OPER_FLAG_DIE;
1280 } | T_RESTART
1281 {
1282 if (conf_parser_ctx.pass == 2)
1283 yy_aconf->port |= OPER_FLAG_RESTART;
1284 } | REHASH
1285 {
1286 if (conf_parser_ctx.pass == 2)
1287 yy_aconf->port |= OPER_FLAG_REHASH;
1288 } | ADMIN
1289 {
1290 if (conf_parser_ctx.pass == 2)
1291 yy_aconf->port |= OPER_FLAG_ADMIN;
1292 } | HIDDEN_ADMIN
1293 {
1294 if (conf_parser_ctx.pass == 2)
1295 yy_aconf->port |= OPER_FLAG_HIDDEN_ADMIN;
1296 } | NICK_CHANGES
1297 {
1298 if (conf_parser_ctx.pass == 2)
1299 yy_aconf->port |= OPER_FLAG_N;
1300 } | T_OPERWALL
1301 {
1302 if (conf_parser_ctx.pass == 2)
1303 yy_aconf->port |= OPER_FLAG_OPERWALL;
1304 } | T_GLOBOPS
1305 {
1306 if (conf_parser_ctx.pass == 2)
1307 yy_aconf->port |= OPER_FLAG_GLOBOPS;
1308 } | OPER_SPY_T
1309 {
1310 if (conf_parser_ctx.pass == 2)
1311 yy_aconf->port |= OPER_FLAG_OPER_SPY;
1312 } | HIDDEN_OPER
1313 {
1314 if (conf_parser_ctx.pass == 2)
1315 yy_aconf->port |= OPER_FLAG_HIDDEN_OPER;
1316 } | REMOTEBAN
1317 {
1318 if (conf_parser_ctx.pass == 2)
1319 yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1320 } | MODULE
1321 {
1322 if (conf_parser_ctx.pass == 2)
1323 yy_aconf->port |= OPER_FLAG_MODULE;
1324 };
1325
1326
1327 /***************************************************************************
1328 * section class
1329 ***************************************************************************/
1330 class_entry: CLASS
1331 {
1332 if (conf_parser_ctx.pass == 1)
1333 {
1334 yy_conf = make_conf_item(CLASS_TYPE);
1335 yy_class = map_to_conf(yy_conf);
1336 }
1337 } class_name_b '{' class_items '}' ';'
1338 {
1339 if (conf_parser_ctx.pass == 1)
1340 {
1341 struct ConfItem *cconf = NULL;
1342 struct ClassItem *class = NULL;
1343
1344 if (yy_class_name == NULL)
1345 delete_conf_item(yy_conf);
1346 else
1347 {
1348 cconf = find_exact_name_conf(CLASS_TYPE, yy_class_name, NULL, NULL);
1349
1350 if (cconf != NULL) /* The class existed already */
1351 {
1352 int user_count = 0;
1353
1354 rebuild_cidr_class(cconf, yy_class);
1355
1356 class = map_to_conf(cconf);
1357
1358 user_count = class->curr_user_count;
1359 memcpy(class, yy_class, sizeof(*class));
1360 class->curr_user_count = user_count;
1361 class->active = 1;
1362
1363 delete_conf_item(yy_conf);
1364
1365 MyFree(cconf->name); /* Allows case change of class name */
1366 cconf->name = yy_class_name;
1367 }
1368 else /* Brand new class */
1369 {
1370 MyFree(yy_conf->name); /* just in case it was allocated */
1371 yy_conf->name = yy_class_name;
1372 yy_class->active = 1;
1373 }
1374 }
1375
1376 yy_class_name = NULL;
1377 }
1378 };
1379
1380 class_name_b: | class_name_t;
1381
1382 class_items: class_items class_item | class_item;
1383 class_item: class_name |
1384 class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
1385 class_ping_time |
1386 class_ping_warning |
1387 class_number_per_cidr |
1388 class_number_per_ip |
1389 class_connectfreq |
1390 class_max_number |
1391 class_max_global |
1392 class_max_local |
1393 class_max_ident |
1394 class_sendq |
1395 error ';' ;
1396
1397 class_name: NAME '=' QSTRING ';'
1398 {
1399 if (conf_parser_ctx.pass == 1)
1400 {
1401 MyFree(yy_class_name);
1402 DupString(yy_class_name, yylval.string);
1403 }
1404 };
1405
1406 class_name_t: QSTRING
1407 {
1408 if (conf_parser_ctx.pass == 1)
1409 {
1410 MyFree(yy_class_name);
1411 DupString(yy_class_name, yylval.string);
1412 }
1413 };
1414
1415 class_ping_time: PING_TIME '=' timespec ';'
1416 {
1417 if (conf_parser_ctx.pass == 1)
1418 PingFreq(yy_class) = $3;
1419 };
1420
1421 class_ping_warning: PING_WARNING '=' timespec ';'
1422 {
1423 if (conf_parser_ctx.pass == 1)
1424 PingWarning(yy_class) = $3;
1425 };
1426
1427 class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1428 {
1429 if (conf_parser_ctx.pass == 1)
1430 MaxPerIp(yy_class) = $3;
1431 };
1432
1433 class_connectfreq: CONNECTFREQ '=' timespec ';'
1434 {
1435 if (conf_parser_ctx.pass == 1)
1436 ConFreq(yy_class) = $3;
1437 };
1438
1439 class_max_number: MAX_NUMBER '=' NUMBER ';'
1440 {
1441 if (conf_parser_ctx.pass == 1)
1442 MaxTotal(yy_class) = $3;
1443 };
1444
1445 class_max_global: MAX_GLOBAL '=' NUMBER ';'
1446 {
1447 if (conf_parser_ctx.pass == 1)
1448 MaxGlobal(yy_class) = $3;
1449 };
1450
1451 class_max_local: MAX_LOCAL '=' NUMBER ';'
1452 {
1453 if (conf_parser_ctx.pass == 1)
1454 MaxLocal(yy_class) = $3;
1455 };
1456
1457 class_max_ident: MAX_IDENT '=' NUMBER ';'
1458 {
1459 if (conf_parser_ctx.pass == 1)
1460 MaxIdent(yy_class) = $3;
1461 };
1462
1463 class_sendq: SENDQ '=' sizespec ';'
1464 {
1465 if (conf_parser_ctx.pass == 1)
1466 MaxSendq(yy_class) = $3;
1467 };
1468
1469 class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1470 {
1471 if (conf_parser_ctx.pass == 1)
1472 CidrBitlenIPV4(yy_class) = $3;
1473 };
1474
1475 class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1476 {
1477 if (conf_parser_ctx.pass == 1)
1478 CidrBitlenIPV6(yy_class) = $3;
1479 };
1480
1481 class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1482 {
1483 if (conf_parser_ctx.pass == 1)
1484 NumberPerCidr(yy_class) = $3;
1485 };
1486
1487 /***************************************************************************
1488 * section listen
1489 ***************************************************************************/
1490 listen_entry: LISTEN
1491 {
1492 if (conf_parser_ctx.pass == 2)
1493 {
1494 listener_address = NULL;
1495 listener_flags = 0;
1496 }
1497 } '{' listen_items '}' ';'
1498 {
1499 if (conf_parser_ctx.pass == 2)
1500 {
1501 MyFree(listener_address);
1502 listener_address = NULL;
1503 }
1504 };
1505
1506 listen_flags: IRCD_FLAGS
1507 {
1508 listener_flags = 0;
1509 } '=' listen_flags_items ';';
1510
1511 listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1512 listen_flags_item: T_SSL
1513 {
1514 if (conf_parser_ctx.pass == 2)
1515 listener_flags |= LISTENER_SSL;
1516 } | HIDDEN
1517 {
1518 if (conf_parser_ctx.pass == 2)
1519 listener_flags |= LISTENER_HIDDEN;
1520 } | T_SERVER
1521 {
1522 if (conf_parser_ctx.pass == 2)
1523 listener_flags |= LISTENER_SERVER;
1524 };
1525
1526
1527
1528 listen_items: listen_items listen_item | listen_item;
1529 listen_item: listen_port | listen_flags | listen_address | listen_host | error ';';
1530
1531 listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1532
1533 port_items: port_items ',' port_item | port_item;
1534
1535 port_item: NUMBER
1536 {
1537 if (conf_parser_ctx.pass == 2)
1538 {
1539 if ((listener_flags & LISTENER_SSL))
1540 #ifdef HAVE_LIBCRYPTO
1541 if (!ServerInfo.server_ctx)
1542 #endif
1543 {
1544 yyerror("SSL not available - port closed");
1545 break;
1546 }
1547 add_listener($1, listener_address, listener_flags);
1548 }
1549 } | NUMBER TWODOTS NUMBER
1550 {
1551 if (conf_parser_ctx.pass == 2)
1552 {
1553 int i;
1554
1555 if ((listener_flags & LISTENER_SSL))
1556 #ifdef HAVE_LIBCRYPTO
1557 if (!ServerInfo.server_ctx)
1558 #endif
1559 {
1560 yyerror("SSL not available - port closed");
1561 break;
1562 }
1563
1564 for (i = $1; i <= $3; ++i)
1565 add_listener(i, listener_address, listener_flags);
1566 }
1567 };
1568
1569 listen_address: IP '=' QSTRING ';'
1570 {
1571 if (conf_parser_ctx.pass == 2)
1572 {
1573 MyFree(listener_address);
1574 DupString(listener_address, yylval.string);
1575 }
1576 };
1577
1578 listen_host: HOST '=' QSTRING ';'
1579 {
1580 if (conf_parser_ctx.pass == 2)
1581 {
1582 MyFree(listener_address);
1583 DupString(listener_address, yylval.string);
1584 }
1585 };
1586
1587 /***************************************************************************
1588 * section auth
1589 ***************************************************************************/
1590 auth_entry: IRCD_AUTH
1591 {
1592 if (conf_parser_ctx.pass == 2)
1593 {
1594 yy_conf = make_conf_item(CLIENT_TYPE);
1595 yy_aconf = map_to_conf(yy_conf);
1596 }
1597 else
1598 {
1599 MyFree(class_name);
1600 class_name = NULL;
1601 }
1602 } '{' auth_items '}' ';'
1603 {
1604 if (conf_parser_ctx.pass == 2)
1605 {
1606 struct CollectItem *yy_tmp = NULL;
1607 dlink_node *ptr = NULL, *next_ptr = NULL;
1608
1609 if (yy_aconf->user && yy_aconf->host)
1610 {
1611 conf_add_class_to_conf(yy_conf, class_name);
1612 add_conf_by_address(CONF_CLIENT, yy_aconf);
1613 }
1614 else
1615 delete_conf_item(yy_conf);
1616
1617 /* copy over settings from first struct */
1618 DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
1619 {
1620 struct AccessItem *new_aconf;
1621 struct ConfItem *new_conf;
1622
1623 new_conf = make_conf_item(CLIENT_TYPE);
1624 new_aconf = map_to_conf(new_conf);
1625
1626 yy_tmp = ptr->data;
1627
1628 assert(yy_tmp->user && yy_tmp->host);
1629
1630 if (yy_aconf->passwd != NULL)
1631 DupString(new_aconf->passwd, yy_aconf->passwd);
1632 if (yy_conf->name != NULL)
1633 DupString(new_conf->name, yy_conf->name);
1634 if (yy_aconf->passwd != NULL)
1635 DupString(new_aconf->passwd, yy_aconf->passwd);
1636
1637 new_aconf->flags = yy_aconf->flags;
1638 new_aconf->port = yy_aconf->port;
1639
1640 DupString(new_aconf->user, yy_tmp->user);
1641 collapse(new_aconf->user);
1642
1643 DupString(new_aconf->host, yy_tmp->host);
1644 collapse(new_aconf->host);
1645
1646 conf_add_class_to_conf(new_conf, class_name);
1647 add_conf_by_address(CONF_CLIENT, new_aconf);
1648 dlinkDelete(&yy_tmp->node, &col_conf_list);
1649 free_collect_item(yy_tmp);
1650 }
1651
1652 MyFree(class_name);
1653 class_name = NULL;
1654 yy_conf = NULL;
1655 yy_aconf = NULL;
1656 }
1657 };
1658
1659 auth_items: auth_items auth_item | auth_item;
1660 auth_item: auth_user | auth_passwd | auth_class | auth_flags |
1661 auth_spoof | auth_redir_serv | auth_redir_port |
1662 auth_encrypted | error ';' ;
1663
1664 auth_user: USER '=' QSTRING ';'
1665 {
1666 if (conf_parser_ctx.pass == 2)
1667 {
1668 struct CollectItem *yy_tmp = NULL;
1669 struct split_nuh_item nuh;
1670
1671 nuh.nuhmask = yylval.string;
1672 nuh.nickptr = NULL;
1673 nuh.userptr = userbuf;
1674 nuh.hostptr = hostbuf;
1675
1676 nuh.nicksize = 0;
1677 nuh.usersize = sizeof(userbuf);
1678 nuh.hostsize = sizeof(hostbuf);
1679
1680 split_nuh(&nuh);
1681
1682 if (yy_aconf->user == NULL)
1683 {
1684 DupString(yy_aconf->user, userbuf);
1685 DupString(yy_aconf->host, hostbuf);
1686 }
1687 else
1688 {
1689 yy_tmp = MyMalloc(sizeof(struct CollectItem));
1690
1691 DupString(yy_tmp->user, userbuf);
1692 DupString(yy_tmp->host, hostbuf);
1693
1694 dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1695 }
1696 }
1697 };
1698
1699 /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1700
1701 auth_passwd: PASSWORD '=' QSTRING ';'
1702 {
1703 if (conf_parser_ctx.pass == 2)
1704 {
1705 /* be paranoid */
1706 if (yy_aconf->passwd != NULL)
1707 memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1708
1709 MyFree(yy_aconf->passwd);
1710 DupString(yy_aconf->passwd, yylval.string);
1711 }
1712 };
1713
1714 auth_class: CLASS '=' QSTRING ';'
1715 {
1716 if (conf_parser_ctx.pass == 2)
1717 {
1718 MyFree(class_name);
1719 DupString(class_name, yylval.string);
1720 }
1721 };
1722
1723 auth_encrypted: ENCRYPTED '=' TBOOL ';'
1724 {
1725 if (conf_parser_ctx.pass == 2)
1726 {
1727 if (yylval.number)
1728 SetConfEncrypted(yy_aconf);
1729 else
1730 ClearConfEncrypted(yy_aconf);
1731 }
1732 };
1733
1734 auth_flags: IRCD_FLAGS
1735 {
1736 } '=' auth_flags_items ';';
1737
1738 auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1739 auth_flags_item: SPOOF_NOTICE
1740 {
1741 if (conf_parser_ctx.pass == 2)
1742 yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1743 } | EXCEED_LIMIT
1744 {
1745 if (conf_parser_ctx.pass == 2)
1746 yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1747 } | KLINE_EXEMPT
1748 {
1749 if (conf_parser_ctx.pass == 2)
1750 yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1751 } | NEED_IDENT
1752 {
1753 if (conf_parser_ctx.pass == 2)
1754 yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1755 } | CAN_FLOOD
1756 {
1757 if (conf_parser_ctx.pass == 2)
1758 yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1759 } | NO_TILDE
1760 {
1761 if (conf_parser_ctx.pass == 2)
1762 yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1763 } | GLINE_EXEMPT
1764 {
1765 if (conf_parser_ctx.pass == 2)
1766 yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1767 } | RESV_EXEMPT
1768 {
1769 if (conf_parser_ctx.pass == 2)
1770 yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1771 } | NEED_PASSWORD
1772 {
1773 if (conf_parser_ctx.pass == 2)
1774 yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1775 };
1776
1777 /* XXX - need check for illegal hostnames here */
1778 auth_spoof: SPOOF '=' QSTRING ';'
1779 {
1780 if (conf_parser_ctx.pass == 2)
1781 {
1782 MyFree(yy_conf->name);
1783
1784 if (strlen(yylval.string) < HOSTLEN)
1785 {
1786 DupString(yy_conf->name, yylval.string);
1787 yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
1788 }
1789 else
1790 {
1791 ilog(L_ERROR, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1792 yy_conf->name = NULL;
1793 }
1794 }
1795 };
1796
1797 auth_redir_serv: REDIRSERV '=' QSTRING ';'
1798 {
1799 if (conf_parser_ctx.pass == 2)
1800 {
1801 yy_aconf->flags |= CONF_FLAGS_REDIR;
1802 MyFree(yy_conf->name);
1803 DupString(yy_conf->name, yylval.string);
1804 }
1805 };
1806
1807 auth_redir_port: REDIRPORT '=' NUMBER ';'
1808 {
1809 if (conf_parser_ctx.pass == 2)
1810 {
1811 yy_aconf->flags |= CONF_FLAGS_REDIR;
1812 yy_aconf->port = $3;
1813 }
1814 };
1815
1816
1817 /***************************************************************************
1818 * section resv
1819 ***************************************************************************/
1820 resv_entry: RESV
1821 {
1822 if (conf_parser_ctx.pass == 2)
1823 {
1824 MyFree(resv_reason);
1825 resv_reason = NULL;
1826 }
1827 } '{' resv_items '}' ';'
1828 {
1829 if (conf_parser_ctx.pass == 2)
1830 {
1831 MyFree(resv_reason);
1832 resv_reason = NULL;
1833 }
1834 };
1835
1836 resv_items: resv_items resv_item | resv_item;
1837 resv_item: resv_creason | resv_channel | resv_nick | error ';' ;
1838
1839 resv_creason: REASON '=' QSTRING ';'
1840 {
1841 if (conf_parser_ctx.pass == 2)
1842 {
1843 MyFree(resv_reason);
1844 DupString(resv_reason, yylval.string);
1845 }
1846 };
1847
1848 resv_channel: CHANNEL '=' QSTRING ';'
1849 {
1850 if (conf_parser_ctx.pass == 2)
1851 {
1852 if (IsChanPrefix(*yylval.string))
1853 {
1854 char def_reason[] = "No reason";
1855
1856 create_channel_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
1857 }
1858 }
1859 /* ignore it for now.. but we really should make a warning if
1860 * its an erroneous name --fl_ */
1861 };
1862
1863 resv_nick: NICK '=' QSTRING ';'
1864 {
1865 if (conf_parser_ctx.pass == 2)
1866 {
1867 char def_reason[] = "No reason";
1868
1869 create_nick_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
1870 }
1871 };
1872
1873 /***************************************************************************
1874 * section service
1875 ***************************************************************************/
1876 service_entry: T_SERVICE '{' service_items '}' ';';
1877
1878 service_items: service_items service_item | service_item;
1879 service_item: service_name | error;
1880
1881 service_name: NAME '=' QSTRING ';'
1882 {
1883 if (conf_parser_ctx.pass == 2)
1884 {
1885 if (valid_servname(yylval.string))
1886 {
1887 yy_conf = make_conf_item(SERVICE_TYPE);
1888 DupString(yy_conf->name, yylval.string);
1889 }
1890 }
1891 };
1892
1893 /***************************************************************************
1894 * section shared, for sharing remote klines etc.
1895 ***************************************************************************/
1896 shared_entry: T_SHARED
1897 {
1898 if (conf_parser_ctx.pass == 2)
1899 {
1900 yy_conf = make_conf_item(ULINE_TYPE);
1901 yy_match_item = map_to_conf(yy_conf);
1902 yy_match_item->action = SHARED_ALL;
1903 }
1904 } '{' shared_items '}' ';'
1905 {
1906 if (conf_parser_ctx.pass == 2)
1907 {
1908 yy_conf = NULL;
1909 }
1910 };
1911
1912 shared_items: shared_items shared_item | shared_item;
1913 shared_item: shared_name | shared_user | shared_type | error ';' ;
1914
1915 shared_name: NAME '=' QSTRING ';'
1916 {
1917 if (conf_parser_ctx.pass == 2)
1918 {
1919 MyFree(yy_conf->name);
1920 DupString(yy_conf->name, yylval.string);
1921 }
1922 };
1923
1924 shared_user: USER '=' QSTRING ';'
1925 {
1926 if (conf_parser_ctx.pass == 2)
1927 {
1928 struct split_nuh_item nuh;
1929
1930 nuh.nuhmask = yylval.string;
1931 nuh.nickptr = NULL;
1932 nuh.userptr = userbuf;
1933 nuh.hostptr = hostbuf;
1934
1935 nuh.nicksize = 0;
1936 nuh.usersize = sizeof(userbuf);
1937 nuh.hostsize = sizeof(hostbuf);
1938
1939 split_nuh(&nuh);
1940
1941 DupString(yy_match_item->user, userbuf);
1942 DupString(yy_match_item->host, hostbuf);
1943 }
1944 };
1945
1946 shared_type: TYPE
1947 {
1948 if (conf_parser_ctx.pass == 2)
1949 yy_match_item->action = 0;
1950 } '=' shared_types ';' ;
1951
1952 shared_types: shared_types ',' shared_type_item | shared_type_item;
1953 shared_type_item: KLINE
1954 {
1955 if (conf_parser_ctx.pass == 2)
1956 yy_match_item->action |= SHARED_KLINE;
1957 } | TKLINE
1958 {
1959 if (conf_parser_ctx.pass == 2)
1960 yy_match_item->action |= SHARED_TKLINE;
1961 } | UNKLINE
1962 {
1963 if (conf_parser_ctx.pass == 2)
1964 yy_match_item->action |= SHARED_UNKLINE;
1965 } | XLINE
1966 {
1967 if (conf_parser_ctx.pass == 2)
1968 yy_match_item->action |= SHARED_XLINE;
1969 } | TXLINE
1970 {
1971 if (conf_parser_ctx.pass == 2)
1972 yy_match_item->action |= SHARED_TXLINE;
1973 } | T_UNXLINE
1974 {
1975 if (conf_parser_ctx.pass == 2)
1976 yy_match_item->action |= SHARED_UNXLINE;
1977 } | RESV
1978 {
1979 if (conf_parser_ctx.pass == 2)
1980 yy_match_item->action |= SHARED_RESV;
1981 } | TRESV
1982 {
1983 if (conf_parser_ctx.pass == 2)
1984 yy_match_item->action |= SHARED_TRESV;
1985 } | T_UNRESV
1986 {
1987 if (conf_parser_ctx.pass == 2)
1988 yy_match_item->action |= SHARED_UNRESV;
1989 } | T_LOCOPS
1990 {
1991 if (conf_parser_ctx.pass == 2)
1992 yy_match_item->action |= SHARED_LOCOPS;
1993 } | T_ALL
1994 {
1995 if (conf_parser_ctx.pass == 2)
1996 yy_match_item->action = SHARED_ALL;
1997 };
1998
1999 /***************************************************************************
2000 * section cluster
2001 ***************************************************************************/
2002 cluster_entry: T_CLUSTER
2003 {
2004 if (conf_parser_ctx.pass == 2)
2005 {
2006 yy_conf = make_conf_item(CLUSTER_TYPE);
2007 yy_conf->flags = SHARED_ALL;
2008 }
2009 } '{' cluster_items '}' ';'
2010 {
2011 if (conf_parser_ctx.pass == 2)
2012 {
2013 if (yy_conf->name == NULL)
2014 DupString(yy_conf->name, "*");
2015 yy_conf = NULL;
2016 }
2017 };
2018
2019 cluster_items: cluster_items cluster_item | cluster_item;
2020 cluster_item: cluster_name | cluster_type | error ';' ;
2021
2022 cluster_name: NAME '=' QSTRING ';'
2023 {
2024 if (conf_parser_ctx.pass == 2)
2025 DupString(yy_conf->name, yylval.string);
2026 };
2027
2028 cluster_type: TYPE
2029 {
2030 if (conf_parser_ctx.pass == 2)
2031 yy_conf->flags = 0;
2032 } '=' cluster_types ';' ;
2033
2034 cluster_types: cluster_types ',' cluster_type_item | cluster_type_item;
2035 cluster_type_item: KLINE
2036 {
2037 if (conf_parser_ctx.pass == 2)
2038 yy_conf->flags |= SHARED_KLINE;
2039 } | TKLINE
2040 {
2041 if (conf_parser_ctx.pass == 2)
2042 yy_conf->flags |= SHARED_TKLINE;
2043 } | UNKLINE
2044 {
2045 if (conf_parser_ctx.pass == 2)
2046 yy_conf->flags |= SHARED_UNKLINE;
2047 } | XLINE
2048 {
2049 if (conf_parser_ctx.pass == 2)
2050 yy_conf->flags |= SHARED_XLINE;
2051 } | TXLINE
2052 {
2053 if (conf_parser_ctx.pass == 2)
2054 yy_conf->flags |= SHARED_TXLINE;
2055 } | T_UNXLINE
2056 {
2057 if (conf_parser_ctx.pass == 2)
2058 yy_conf->flags |= SHARED_UNXLINE;
2059 } | RESV
2060 {
2061 if (conf_parser_ctx.pass == 2)
2062 yy_conf->flags |= SHARED_RESV;
2063 } | TRESV
2064 {
2065 if (conf_parser_ctx.pass == 2)
2066 yy_conf->flags |= SHARED_TRESV;
2067 } | T_UNRESV
2068 {
2069 if (conf_parser_ctx.pass == 2)
2070 yy_conf->flags |= SHARED_UNRESV;
2071 } | T_LOCOPS
2072 {
2073 if (conf_parser_ctx.pass == 2)
2074 yy_conf->flags |= SHARED_LOCOPS;
2075 } | T_ALL
2076 {
2077 if (conf_parser_ctx.pass == 2)
2078 yy_conf->flags = SHARED_ALL;
2079 };
2080
2081 /***************************************************************************
2082 * section connect
2083 ***************************************************************************/
2084 connect_entry: CONNECT
2085 {
2086 if (conf_parser_ctx.pass == 2)
2087 {
2088 yy_conf = make_conf_item(SERVER_TYPE);
2089 yy_aconf = (struct AccessItem *)map_to_conf(yy_conf);
2090 yy_aconf->passwd = NULL;
2091 /* defaults */
2092 yy_aconf->port = PORTNUM;
2093
2094 if (ConfigFileEntry.burst_away)
2095 yy_aconf->flags = CONF_FLAGS_BURST_AWAY;
2096 }
2097 else
2098 {
2099 MyFree(class_name);
2100 class_name = NULL;
2101 }
2102 } connect_name_b '{' connect_items '}' ';'
2103 {
2104 if (conf_parser_ctx.pass == 2)
2105 {
2106 struct CollectItem *yy_hconf=NULL;
2107 struct CollectItem *yy_lconf=NULL;
2108 dlink_node *ptr;
2109 dlink_node *next_ptr;
2110 #ifdef HAVE_LIBCRYPTO
2111 if (yy_aconf->host &&
2112 ((yy_aconf->passwd && yy_aconf->spasswd) ||
2113 (yy_aconf->rsa_public_key && IsConfCryptLink(yy_aconf))))
2114 #else /* !HAVE_LIBCRYPTO */
2115 if (yy_aconf->host && !IsConfCryptLink(yy_aconf) &&
2116 yy_aconf->passwd && yy_aconf->spasswd)
2117 #endif /* !HAVE_LIBCRYPTO */
2118 {
2119 if (conf_add_server(yy_conf, class_name) == -1)
2120 {
2121 delete_conf_item(yy_conf);
2122 yy_conf = NULL;
2123 yy_aconf = NULL;
2124 }
2125 }
2126 else
2127 {
2128 /* Even if yy_conf ->name is NULL
2129 * should still unhook any hub/leaf confs still pending
2130 */
2131 unhook_hub_leaf_confs();
2132
2133 if (yy_conf->name != NULL)
2134 {
2135 #ifndef HAVE_LIBCRYPTO
2136 if (IsConfCryptLink(yy_aconf))
2137 yyerror("Ignoring connect block -- no OpenSSL support");
2138 #else
2139 if (IsConfCryptLink(yy_aconf) && !yy_aconf->rsa_public_key)
2140 yyerror("Ignoring connect block -- missing key");
2141 #endif
2142 if (yy_aconf->host == NULL)
2143 yyerror("Ignoring connect block -- missing host");
2144 else if (!IsConfCryptLink(yy_aconf) &&
2145 (!yy_aconf->passwd || !yy_aconf->spasswd))
2146 yyerror("Ignoring connect block -- missing password");
2147 }
2148
2149
2150 /* XXX
2151 * This fixes a try_connections() core (caused by invalid class_ptr
2152 * pointers) reported by metalrock. That's an ugly fix, but there
2153 * is currently no better way. The entire config subsystem needs an
2154 * rewrite ASAP. make_conf_item() shouldn't really add things onto
2155 * a doubly linked list immediately without any sanity checks! -Michael
2156 */
2157 delete_conf_item(yy_conf);
2158
2159 yy_aconf = NULL;
2160 yy_conf = NULL;
2161 }
2162
2163 /*
2164 * yy_conf is still pointing at the server that is having
2165 * a connect block built for it. This means, y_aconf->name
2166 * points to the actual irc name this server will be known as.
2167 * Now this new server has a set or even just one hub_mask (or leaf_mask)
2168 * given in the link list at yy_hconf. Fill in the HUB confs
2169 * from this link list now.
2170 */
2171 DLINK_FOREACH_SAFE(ptr, next_ptr, hub_conf_list.head)
2172 {
2173 struct ConfItem *new_hub_conf;
2174 struct MatchItem *match_item;
2175
2176 yy_hconf = ptr->data;
2177
2178 /* yy_conf == NULL is a fatal error for this connect block! */
2179 if ((yy_conf != NULL) && (yy_conf->name != NULL))
2180 {
2181 new_hub_conf = make_conf_item(HUB_TYPE);
2182 match_item = (struct MatchItem *)map_to_conf(new_hub_conf);
2183 DupString(new_hub_conf->name, yy_conf->name);
2184 if (yy_hconf->user != NULL)
2185 DupString(match_item->user, yy_hconf->user);
2186 else
2187 DupString(match_item->user, "*");
2188 if (yy_hconf->host != NULL)
2189 DupString(match_item->host, yy_hconf->host);
2190 else
2191 DupString(match_item->host, "*");
2192 }
2193 dlinkDelete(&yy_hconf->node, &hub_conf_list);
2194 free_collect_item(yy_hconf);
2195 }
2196
2197 /* Ditto for the LEAF confs */
2198
2199 DLINK_FOREACH_SAFE(ptr, next_ptr, leaf_conf_list.head)
2200 {
2201 struct ConfItem *new_leaf_conf;
2202 struct MatchItem *match_item;
2203
2204 yy_lconf = ptr->data;
2205
2206 if ((yy_conf != NULL) && (yy_conf->name != NULL))
2207 {
2208 new_leaf_conf = make_conf_item(LEAF_TYPE);
2209 match_item = (struct MatchItem *)map_to_conf(new_leaf_conf);
2210 DupString(new_leaf_conf->name, yy_conf->name);
2211 if (yy_lconf->user != NULL)
2212 DupString(match_item->user, yy_lconf->user);
2213 else
2214 DupString(match_item->user, "*");
2215 if (yy_lconf->host != NULL)
2216 DupString(match_item->host, yy_lconf->host);
2217 else
2218 DupString(match_item->host, "*");
2219 }
2220 dlinkDelete(&yy_lconf->node, &leaf_conf_list);
2221 free_collect_item(yy_lconf);
2222 }
2223 MyFree(class_name);
2224 class_name = NULL;
2225 yy_conf = NULL;
2226 yy_aconf = NULL;
2227 }
2228 };
2229
2230 connect_name_b: | connect_name_t;
2231 connect_items: connect_items connect_item | connect_item;
2232 connect_item: connect_name | connect_host | connect_vhost |
2233 connect_send_password | connect_accept_password |
2234 connect_aftype | connect_port |
2235 connect_flags | connect_hub_mask | connect_leaf_mask |
2236 connect_class | connect_encrypted |
2237 connect_rsa_public_key_file | connect_cipher_preference |
2238 error ';' ;
2239
2240 connect_name: NAME '=' QSTRING ';'
2241 {
2242 if (conf_parser_ctx.pass == 2)
2243 {
2244 if (yy_conf->name != NULL)
2245 yyerror("Multiple connect name entry");
2246
2247 MyFree(yy_conf->name);
2248 DupString(yy_conf->name, yylval.string);
2249 }
2250 };
2251
2252 connect_name_t: QSTRING
2253 {
2254 if (conf_parser_ctx.pass == 2)
2255 {
2256 if (yy_conf->name != NULL)
2257 yyerror("Multiple connect name entry");
2258
2259 MyFree(yy_conf->name);
2260 DupString(yy_conf->name, yylval.string);
2261 }
2262 };
2263
2264 connect_host: HOST '=' QSTRING ';'
2265 {
2266 if (conf_parser_ctx.pass == 2)
2267 {
2268 MyFree(yy_aconf->host);
2269 DupString(yy_aconf->host, yylval.string);
2270 }
2271 };
2272
2273 connect_vhost: VHOST '=' QSTRING ';'
2274 {
2275 if (conf_parser_ctx.pass == 2)
2276 {
2277 struct addrinfo hints, *res;
2278
2279 memset(&hints, 0, sizeof(hints));
2280
2281 hints.ai_family = AF_UNSPEC;
2282 hints.ai_socktype = SOCK_STREAM;
2283 hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2284
2285 if (getaddrinfo(yylval.string, NULL, &hints, &res))
2286 ilog(L_ERROR, "Invalid netmask for server vhost(%s)", yylval.string);
2287 else
2288 {
2289 assert(res != NULL);
2290
2291 memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen);
2292 yy_aconf->my_ipnum.ss.ss_family = res->ai_family;
2293 yy_aconf->my_ipnum.ss_len = res->ai_addrlen;
2294 freeaddrinfo(res);
2295 }
2296 }
2297 };
2298
2299 connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2300 {
2301 if (conf_parser_ctx.pass == 2)
2302 {
2303 if ($3[0] == ':')
2304 yyerror("Server passwords cannot begin with a colon");
2305 else if (strchr($3, ' ') != NULL)
2306 yyerror("Server passwords cannot contain spaces");
2307 else {
2308 if (yy_aconf->spasswd != NULL)
2309 memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2310
2311 MyFree(yy_aconf->spasswd);
2312 DupString(yy_aconf->spasswd, yylval.string);
2313 }
2314 }
2315 };
2316
2317 connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2318 {
2319 if (conf_parser_ctx.pass == 2)
2320 {
2321 if ($3[0] == ':')
2322 yyerror("Server passwords cannot begin with a colon");
2323 else if (strchr($3, ' ') != NULL)
2324 yyerror("Server passwords cannot contain spaces");
2325 else {
2326 if (yy_aconf->passwd != NULL)
2327 memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2328
2329 MyFree(yy_aconf->passwd);
2330 DupString(yy_aconf->passwd, yylval.string);
2331 }
2332 }
2333 };
2334
2335 connect_port: PORT '=' NUMBER ';'
2336 {
2337 if (conf_parser_ctx.pass == 2)
2338 yy_aconf->port = $3;
2339 };
2340
2341 connect_aftype: AFTYPE '=' T_IPV4 ';'
2342 {
2343 if (conf_parser_ctx.pass == 2)
2344 yy_aconf->aftype = AF_INET;
2345 } | AFTYPE '=' T_IPV6 ';'
2346 {
2347 #ifdef IPV6
2348 if (conf_parser_ctx.pass == 2)
2349 yy_aconf->aftype = AF_INET6;
2350 #endif
2351 };
2352
2353 connect_flags: IRCD_FLAGS
2354 {
2355 } '=' connect_flags_items ';';
2356
2357 connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2358 connect_flags_item: COMPRESSED
2359 {
2360 if (conf_parser_ctx.pass == 2)
2361 #ifndef HAVE_LIBZ
2362 yyerror("Ignoring flags = compressed; -- no zlib support");
2363 #else
2364 {
2365 SetConfCompressed(yy_aconf);
2366 }
2367 #endif
2368 } | CRYPTLINK
2369 {
2370 if (conf_parser_ctx.pass == 2)
2371 SetConfCryptLink(yy_aconf);
2372 } | AUTOCONN
2373 {
2374 if (conf_parser_ctx.pass == 2)
2375 SetConfAllowAutoConn(yy_aconf);
2376 } | BURST_AWAY
2377 {
2378 if (conf_parser_ctx.pass == 2)
2379 SetConfAwayBurst(yy_aconf);
2380 } | TOPICBURST
2381 {
2382 if (conf_parser_ctx.pass == 2)
2383 SetConfTopicBurst(yy_aconf);
2384 };
2385
2386 connect_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
2387 {
2388 #ifdef HAVE_LIBCRYPTO
2389 if (conf_parser_ctx.pass == 2)
2390 {
2391 BIO *file;
2392
2393 if (yy_aconf->rsa_public_key != NULL)
2394 {
2395 RSA_free(yy_aconf->rsa_public_key);
2396 yy_aconf->rsa_public_key = NULL;
2397 }
2398
2399 if (yy_aconf->rsa_public_key_file != NULL)
2400 {
2401 MyFree(yy_aconf->rsa_public_key_file);
2402 yy_aconf->rsa_public_key_file = NULL;
2403 }
2404
2405 DupString(yy_aconf->rsa_public_key_file, yylval.string);
2406
2407 if ((file = BIO_new_file(yylval.string, "r")) == NULL)
2408 {
2409 yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
2410 break;
2411 }
2412
2413 yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
2414
2415 if (yy_aconf->rsa_public_key == NULL)
2416 {
2417 yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
2418 break;
2419 }
2420
2421 BIO_set_close(file, BIO_CLOSE);
2422 BIO_free(file);
2423 }
2424 #endif /* HAVE_LIBCRYPTO */
2425 };
2426
2427 connect_encrypted: ENCRYPTED '=' TBOOL ';'
2428 {
2429 if (conf_parser_ctx.pass == 2)
2430 {
2431 if (yylval.number)
2432 yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
2433 else
2434 yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED;
2435 }
2436 };
2437
2438 connect_hub_mask: HUB_MASK '=' QSTRING ';'
2439 {
2440 if (conf_parser_ctx.pass == 2)
2441 {
2442 struct CollectItem *yy_tmp;
2443
2444 yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2445 DupString(yy_tmp->host, yylval.string);
2446 DupString(yy_tmp->user, "*");
2447 dlinkAdd(yy_tmp, &yy_tmp->node, &hub_conf_list);
2448 }
2449 };
2450
2451 connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2452 {
2453 if (conf_parser_ctx.pass == 2)
2454 {
2455 struct CollectItem *yy_tmp;
2456
2457 yy_tmp = (struct CollectItem *)MyMalloc(sizeof(struct CollectItem));
2458 DupString(yy_tmp->host, yylval.string);
2459 DupString(yy_tmp->user, "*");
2460 dlinkAdd(yy_tmp, &yy_tmp->node, &leaf_conf_list);
2461 }
2462 };
2463
2464 connect_class: CLASS '=' QSTRING ';'
2465 {
2466 if (conf_parser_ctx.pass == 2)
2467 {
2468 MyFree(class_name);
2469 DupString(class_name, yylval.string);
2470 }
2471 };
2472
2473 connect_cipher_preference: CIPHER_PREFERENCE '=' QSTRING ';'
2474 {
2475 #ifdef HAVE_LIBCRYPTO
2476 if (conf_parser_ctx.pass == 2)
2477 {
2478 struct EncCapability *ecap;
2479 const char *cipher_name;
2480 int found = 0;
2481
2482 yy_aconf->cipher_preference = NULL;
2483 cipher_name = yylval.string;
2484
2485 for (ecap = CipherTable; ecap->name; ecap++)
2486 {
2487 if ((irccmp(ecap->name, cipher_name) == 0) &&
2488 (ecap->cap & CAP_ENC_MASK))
2489 {
2490 yy_aconf->cipher_preference = ecap;
2491 found = 1;
2492 break;
2493 }
2494 }
2495
2496 if (!found)
2497 yyerror("Invalid cipher");
2498 }
2499 #else
2500 if (conf_parser_ctx.pass == 2)
2501 yyerror("Ignoring cipher_preference -- no OpenSSL support");
2502 #endif
2503 };
2504
2505 /***************************************************************************
2506 * section kill
2507 ***************************************************************************/
2508 kill_entry: KILL
2509 {
2510 if (conf_parser_ctx.pass == 2)
2511 {
2512 userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2513 regex_ban = 0;
2514 }
2515 } '{' kill_items '}' ';'
2516 {
2517 if (conf_parser_ctx.pass == 2)
2518 {
2519 if (userbuf[0] && hostbuf[0])
2520 {
2521 if (regex_ban)
2522 {
2523 #ifdef HAVE_LIBPCRE
2524 void *exp_user = NULL;
2525 void *exp_host = NULL;
2526 const char *errptr = NULL;
2527
2528 if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2529 !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2530 {
2531 ilog(L_ERROR, "Failed to add regular expression based K-Line: %s",
2532 errptr);
2533 break;
2534 }
2535
2536 yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE));
2537 yy_aconf->regexuser = exp_user;
2538 yy_aconf->regexhost = exp_host;
2539
2540 DupString(yy_aconf->user, userbuf);
2541 DupString(yy_aconf->host, hostbuf);
2542
2543 if (reasonbuf[0])
2544 DupString(yy_aconf->reason, reasonbuf);
2545 else
2546 DupString(yy_aconf->reason, "No reason");
2547 #else
2548 ilog(L_ERROR, "Failed to add regular expression based K-Line: no PCRE support");
2549 break;
2550 #endif
2551 }
2552 else
2553 {
2554 yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2555
2556 DupString(yy_aconf->user, userbuf);
2557 DupString(yy_aconf->host, hostbuf);
2558
2559 if (reasonbuf[0])
2560 DupString(yy_aconf->reason, reasonbuf);
2561 else
2562 DupString(yy_aconf->reason, "No reason");
2563 add_conf_by_address(CONF_KILL, yy_aconf);
2564 }
2565 }
2566
2567 yy_aconf = NULL;
2568 }
2569 };
2570
2571 kill_type: TYPE
2572 {
2573 } '=' kill_type_items ';';
2574
2575 kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2576 kill_type_item: REGEX_T
2577 {
2578 if (conf_parser_ctx.pass == 2)
2579 regex_ban = 1;
2580 };
2581
2582 kill_items: kill_items kill_item | kill_item;
2583 kill_item: kill_user | kill_reason | kill_type | error;
2584
2585 kill_user: USER '=' QSTRING ';'
2586 {
2587 if (conf_parser_ctx.pass == 2)
2588 {
2589 struct split_nuh_item nuh;
2590
2591 nuh.nuhmask = yylval.string;
2592 nuh.nickptr = NULL;
2593 nuh.userptr = userbuf;
2594 nuh.hostptr = hostbuf;
2595
2596 nuh.nicksize = 0;
2597 nuh.usersize = sizeof(userbuf);
2598 nuh.hostsize = sizeof(hostbuf);
2599
2600 split_nuh(&nuh);
2601 }
2602 };
2603
2604 kill_reason: REASON '=' QSTRING ';'
2605 {
2606 if (conf_parser_ctx.pass == 2)
2607 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2608 };
2609
2610 /***************************************************************************
2611 * section deny
2612 ***************************************************************************/
2613 deny_entry: DENY
2614 {
2615 if (conf_parser_ctx.pass == 2)
2616 hostbuf[0] = reasonbuf[0] = '\0';
2617 } '{' deny_items '}' ';'
2618 {
2619 if (conf_parser_ctx.pass == 2)
2620 {
2621 if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
2622 {
2623 yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2624 DupString(yy_aconf->host, hostbuf);
2625
2626 if (reasonbuf[0])
2627 DupString(yy_aconf->reason, reasonbuf);
2628 else
2629 DupString(yy_aconf->reason, "No reason");
2630 add_conf_by_address(CONF_DLINE, yy_aconf);
2631 yy_aconf = NULL;
2632 }
2633 }
2634 };
2635
2636 deny_items: deny_items deny_item | deny_item;
2637 deny_item: deny_ip | deny_reason | error;
2638
2639 deny_ip: IP '=' QSTRING ';'
2640 {
2641 if (conf_parser_ctx.pass == 2)
2642 strlcpy(hostbuf, yylval.string, sizeof(hostbuf));
2643 };
2644
2645 deny_reason: REASON '=' QSTRING ';'
2646 {
2647 if (conf_parser_ctx.pass == 2)
2648 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2649 };
2650
2651 /***************************************************************************
2652 * section exempt
2653 ***************************************************************************/
2654 exempt_entry: EXEMPT '{' exempt_items '}' ';';
2655
2656 exempt_items: exempt_items exempt_item | exempt_item;
2657 exempt_item: exempt_ip | error;
2658
2659 exempt_ip: IP '=' QSTRING ';'
2660 {
2661 if (conf_parser_ctx.pass == 2)
2662 {
2663 if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2664 {
2665 yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE));
2666 DupString(yy_aconf->host, yylval.string);
2667
2668 add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
2669 yy_aconf = NULL;
2670 }
2671 }
2672 };
2673
2674 /***************************************************************************
2675 * section gecos
2676 ***************************************************************************/
2677 gecos_entry: GECOS
2678 {
2679 if (conf_parser_ctx.pass == 2)
2680 {
2681 regex_ban = 0;
2682 reasonbuf[0] = gecos_name[0] = '\0';
2683 }
2684 } '{' gecos_items '}' ';'
2685 {
2686 if (conf_parser_ctx.pass == 2)
2687 {
2688 if (gecos_name[0])
2689 {
2690 if (regex_ban)
2691 {
2692 #ifdef HAVE_LIBPCRE
2693 void *exp_p = NULL;
2694 const char *errptr = NULL;
2695
2696 if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2697 {
2698 ilog(L_ERROR, "Failed to add regular expression based X-Line: %s",
2699 errptr);
2700 break;
2701 }
2702
2703 yy_conf = make_conf_item(RXLINE_TYPE);
2704 yy_conf->regexpname = exp_p;
2705 #else
2706 ilog(L_ERROR, "Failed to add regular expression based X-Line: no PCRE support");
2707 break;
2708 #endif
2709 }
2710 else
2711 yy_conf = make_conf_item(XLINE_TYPE);
2712
2713 yy_match_item = map_to_conf(yy_conf);
2714 DupString(yy_conf->name, gecos_name);
2715
2716 if (reasonbuf[0])
2717 DupString(yy_match_item->reason, reasonbuf);
2718 else
2719 DupString(yy_match_item->reason, "No reason");
2720 }
2721 }
2722 };
2723
2724 gecos_flags: TYPE
2725 {
2726 } '=' gecos_flags_items ';';
2727
2728 gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2729 gecos_flags_item: REGEX_T
2730 {
2731 if (conf_parser_ctx.pass == 2)
2732 regex_ban = 1;
2733 };
2734
2735 gecos_items: gecos_items gecos_item | gecos_item;
2736 gecos_item: gecos_name | gecos_reason | gecos_flags | error;
2737
2738 gecos_name: NAME '=' QSTRING ';'
2739 {
2740 if (conf_parser_ctx.pass == 2)
2741 strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
2742 };
2743
2744 gecos_reason: REASON '=' QSTRING ';'
2745 {
2746 if (conf_parser_ctx.pass == 2)
2747 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2748 };
2749
2750 /***************************************************************************
2751 * section general
2752 ***************************************************************************/
2753 general_entry: GENERAL
2754 '{' general_items '}' ';';
2755
2756 general_items: general_items general_item | general_item;
2757 general_item: general_hide_spoof_ips | general_ignore_bogus_ts |
2758 general_failed_oper_notice | general_anti_nick_flood |
2759 general_max_nick_time | general_max_nick_changes |
2760 general_max_accept | general_anti_spam_exit_message_time |
2761 general_ts_warn_delta | general_ts_max_delta |
2762 general_kill_chase_time_limit | general_kline_with_reason |
2763 general_kline_reason | general_invisible_on_connect |
2764 general_warn_no_nline | general_dots_in_ident |
2765 general_stats_o_oper_only | general_stats_k_oper_only |
2766 general_pace_wait | general_stats_i_oper_only |
2767 general_pace_wait_simple | general_stats_P_oper_only |
2768 general_short_motd | general_no_oper_flood |
2769 general_true_no_oper_flood | general_oper_pass_resv |
2770 general_message_locale |
2771 general_oper_only_umodes | general_max_targets |
2772 general_use_egd | general_egdpool_path |
2773 general_oper_umodes | general_caller_id_wait |
2774 general_opers_bypass_callerid | general_default_floodcount |
2775 general_min_nonwildcard | general_min_nonwildcard_simple |
2776 general_servlink_path | general_disable_remote_commands |
2777 general_default_cipher_preference |
2778 general_compression_level | general_client_flood |
2779 general_throttle_time | general_havent_read_conf |
2780 general_ping_cookie |
2781 general_disable_auth | general_burst_away |
2782 general_tkline_expire_notices | general_gline_min_cidr |
2783 general_gline_min_cidr6 | general_use_whois_actually |
2784 general_reject_hold_time | general_stats_e_disabled |
2785 general_max_watch | general_services_name |
2786 error;
2787
2788
2789 general_max_watch: MAX_WATCH '=' NUMBER ';'
2790 {
2791 ConfigFileEntry.max_watch = $3;
2792 };
2793
2794 general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2795 {
2796 ConfigFileEntry.gline_min_cidr = $3;
2797 };
2798
2799 general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2800 {
2801 ConfigFileEntry.gline_min_cidr6 = $3;
2802 };
2803
2804 general_burst_away: BURST_AWAY '=' TBOOL ';'
2805 {
2806 ConfigFileEntry.burst_away = yylval.number;
2807 };
2808
2809 general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2810 {
2811 ConfigFileEntry.use_whois_actually = yylval.number;
2812 };
2813
2814 general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';'
2815 {
2816 GlobalSetOptions.rejecttime = yylval.number;
2817 };
2818
2819 general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2820 {
2821 ConfigFileEntry.tkline_expire_notices = yylval.number;
2822 };
2823
2824 general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2825 {
2826 ConfigFileEntry.kill_chase_time_limit = $3;
2827 };
2828
2829 general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2830 {
2831 ConfigFileEntry.hide_spoof_ips = yylval.number;
2832 };
2833
2834 general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2835 {
2836 ConfigFileEntry.ignore_bogus_ts = yylval.number;
2837 };
2838
2839 general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2840 {
2841 ConfigFileEntry.disable_remote = yylval.number;
2842 };
2843
2844 general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2845 {
2846 ConfigFileEntry.failed_oper_notice = yylval.number;
2847 };
2848
2849 general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2850 {
2851 ConfigFileEntry.anti_nick_flood = yylval.number;
2852 };
2853
2854 general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2855 {
2856 ConfigFileEntry.max_nick_time = $3;
2857 };
2858
2859 general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2860 {
2861 ConfigFileEntry.max_nick_changes = $3;
2862 };
2863
2864 general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2865 {
2866 ConfigFileEntry.max_accept = $3;
2867 };
2868
2869 general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2870 {
2871 ConfigFileEntry.anti_spam_exit_message_time = $3;
2872 };
2873
2874 general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2875 {
2876 ConfigFileEntry.ts_warn_delta = $3;
2877 };
2878
2879 general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2880 {
2881 if (conf_parser_ctx.pass == 2)
2882 ConfigFileEntry.ts_max_delta = $3;
2883 };
2884
2885 general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2886 {
2887 if (($3 > 0) && conf_parser_ctx.pass == 1)
2888 {
2889 ilog(L_CRIT, "You haven't read your config file properly.");
2890 ilog(L_CRIT, "There is a line in the example conf that will kill your server if not removed.");
2891 ilog(L_CRIT, "Consider actually reading/editing the conf file, and removing this line.");
2892 exit(0);
2893 }
2894 };
2895
2896 general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
2897 {
2898 ConfigFileEntry.kline_with_reason = yylval.number;
2899 };
2900
2901 general_kline_reason: KLINE_REASON '=' QSTRING ';'
2902 {
2903 if (conf_parser_ctx.pass == 2)
2904 {
2905 MyFree(ConfigFileEntry.kline_reason);
2906 DupString(ConfigFileEntry.kline_reason, yylval.string);
2907 }
2908 };
2909
2910 general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2911 {
2912 ConfigFileEntry.invisible_on_connect = yylval.number;
2913 };
2914
2915 general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';'
2916 {
2917 ConfigFileEntry.warn_no_nline = yylval.number;
2918 };
2919
2920 general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2921 {
2922 ConfigFileEntry.stats_e_disabled = yylval.number;
2923 };
2924
2925 general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2926 {
2927 ConfigFileEntry.stats_o_oper_only = yylval.number;
2928 };
2929
2930 general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2931 {
2932 ConfigFileEntry.stats_P_oper_only = yylval.number;
2933 };
2934
2935 general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2936 {
2937 ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2938 } | STATS_K_OPER_ONLY '=' TMASKED ';'
2939 {
2940 ConfigFileEntry.stats_k_oper_only = 1;
2941 };
2942
2943 general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2944 {
2945 ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2946 } | STATS_I_OPER_ONLY '=' TMASKED ';'
2947 {
2948 ConfigFileEntry.stats_i_oper_only = 1;
2949 };
2950
2951 general_pace_wait: PACE_WAIT '=' timespec ';'
2952 {
2953 ConfigFileEntry.pace_wait = $3;
2954 };
2955
2956 general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2957 {
2958 ConfigFileEntry.caller_id_wait = $3;
2959 };
2960
2961 general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2962 {
2963 ConfigFileEntry.opers_bypass_callerid = yylval.number;
2964 };
2965
2966 general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2967 {
2968 ConfigFileEntry.pace_wait_simple = $3;
2969 };
2970
2971 general_short_motd: SHORT_MOTD '=' TBOOL ';'
2972 {
2973 ConfigFileEntry.short_motd = yylval.number;
2974 };
2975
2976 general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2977 {
2978 ConfigFileEntry.no_oper_flood = yylval.number;
2979 };
2980
2981 general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2982 {
2983 ConfigFileEntry.true_no_oper_flood = yylval.number;
2984 };
2985
2986 general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2987 {
2988 ConfigFileEntry.oper_pass_resv = yylval.number;
2989 };
2990
2991 general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
2992 {
2993 if (conf_parser_ctx.pass == 2)
2994 {
2995 if (strlen(yylval.string) > LOCALE_LENGTH-2)
2996 yylval.string[LOCALE_LENGTH-1] = '\0';
2997
2998 set_locale(yylval.string);
2999 }
3000 };
3001
3002 general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
3003 {
3004 ConfigFileEntry.dots_in_ident = $3;
3005 };
3006
3007 general_max_targets: MAX_TARGETS '=' NUMBER ';'
3008 {
3009 ConfigFileEntry.max_targets = $3;
3010 };
3011
3012 general_servlink_path: SERVLINK_PATH '=' QSTRING ';'
3013 {
3014 if (conf_parser_ctx.pass == 2)
3015 {
3016 MyFree(ConfigFileEntry.servlink_path);
3017 DupString(ConfigFileEntry.servlink_path, yylval.string);
3018 }
3019 };
3020
3021 general_default_cipher_preference: DEFAULT_CIPHER_PREFERENCE '=' QSTRING ';'
3022 {
3023 #ifdef HAVE_LIBCRYPTO
3024 if (conf_parser_ctx.pass == 2)
3025 {
3026 struct EncCapability *ecap;
3027 const char *cipher_name;
3028 int found = 0;
3029
3030 ConfigFileEntry.default_cipher_preference = NULL;
3031 cipher_name = yylval.string;
3032
3033 for (ecap = CipherTable; ecap->name; ecap++)
3034 {
3035 if ((irccmp(ecap->name, cipher_name) == 0) &&
3036 (ecap->cap & CAP_ENC_MASK))
3037 {
3038 ConfigFileEntry.default_cipher_preference = ecap;
3039 found = 1;
3040 break;
3041 }
3042 }
3043
3044 if (!found)
3045 yyerror("Invalid cipher");
3046 }
3047 #else
3048 if (conf_parser_ctx.pass == 2)
3049 yyerror("Ignoring default_cipher_preference -- no OpenSSL support");
3050 #endif
3051 };
3052
3053 general_compression_level: COMPRESSION_LEVEL '=' NUMBER ';'
3054 {
3055 if (conf_parser_ctx.pass == 2)
3056 {
3057 ConfigFileEntry.compression_level = $3;
3058 #ifndef HAVE_LIBZ
3059 yyerror("Ignoring compression_level -- no zlib support");
3060 #else
3061 if ((ConfigFileEntry.compression_level < 1) ||
3062 (ConfigFileEntry.compression_level > 9))
3063 {
3064 yyerror("Ignoring invalid compression_level, using default");
3065 ConfigFileEntry.compression_level = 0;
3066 }
3067 #endif
3068 }
3069 };
3070
3071 general_use_egd: USE_EGD '=' TBOOL ';'
3072 {
3073 ConfigFileEntry.use_egd = yylval.number;
3074 };
3075
3076 general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
3077 {
3078 if (conf_parser_ctx.pass == 2)
3079 {
3080 MyFree(ConfigFileEntry.egdpool_path);
3081 DupString(ConfigFileEntry.egdpool_path, yylval.string);
3082 }
3083 };
3084
3085 general_services_name: T_SERVICES_NAME '=' QSTRING ';'
3086 {
3087 if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
3088 {
3089 MyFree(ConfigFileEntry.service_name);
3090 DupString(ConfigFileEntry.service_name, yylval.string);
3091 }
3092 };
3093
3094 general_ping_cookie: PING_COOKIE '=' TBOOL ';'
3095 {
3096 ConfigFileEntry.ping_cookie = yylval.number;
3097 };
3098
3099 general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
3100 {
3101 ConfigFileEntry.disable_auth = yylval.number;
3102 };
3103
3104 general_throttle_time: THROTTLE_TIME '=' timespec ';'
3105 {
3106 ConfigFileEntry.throttle_time = yylval.number;
3107 };
3108
3109 general_oper_umodes: OPER_UMODES
3110 {
3111 ConfigFileEntry.oper_umodes = 0;
3112 } '=' umode_oitems ';' ;
3113
3114 umode_oitems: umode_oitems ',' umode_oitem | umode_oitem;
3115 umode_oitem: T_BOTS
3116 {
3117 ConfigFileEntry.oper_umodes |= UMODE_BOTS;
3118 } | T_CCONN
3119 {
3120 ConfigFileEntry.oper_umodes |= UMODE_CCONN;
3121 } | T_CCONN_FULL
3122 {
3123 ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
3124 } | T_DEAF
3125 {
3126 ConfigFileEntry.oper_umodes |= UMODE_DEAF;
3127 } | T_DEBUG
3128 {
3129 ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
3130 } | T_FULL
3131 {
3132 ConfigFileEntry.oper_umodes |= UMODE_FULL;
3133 } | T_SKILL
3134 {
3135 ConfigFileEntry.oper_umodes |= UMODE_SKILL;
3136 } | T_NCHANGE
3137 {
3138 ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
3139 } | T_REJ
3140 {
3141 ConfigFileEntry.oper_umodes |= UMODE_REJ;
3142 } | T_UNAUTH
3143 {
3144 ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
3145 } | T_SPY
3146 {
3147 ConfigFileEntry.oper_umodes |= UMODE_SPY;
3148 } | T_EXTERNAL
3149 {
3150 ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
3151 } | T_OPERWALL
3152 {
3153 ConfigFileEntry.oper_umodes |= UMODE_OPERWALL;
3154 } | T_SERVNOTICE
3155 {
3156 ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
3157 } | T_INVISIBLE
3158 {
3159 ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
3160 } | T_WALLOP
3161 {
3162 ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
3163 } | T_SOFTCALLERID
3164 {
3165 ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
3166 } | T_CALLERID
3167 {
3168 ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
3169 } | T_LOCOPS
3170 {
3171 ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
3172 };
3173
3174 general_oper_only_umodes: OPER_ONLY_UMODES
3175 {
3176 ConfigFileEntry.oper_only_umodes = 0;
3177 } '=' umode_items ';' ;
3178
3179 umode_items: umode_items ',' umode_item | umode_item;
3180 umode_item: T_BOTS
3181 {
3182 ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
3183 } | T_CCONN
3184 {
3185 ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
3186 } | T_CCONN_FULL
3187 {
3188 ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
3189 } | T_DEAF
3190 {
3191 ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
3192 } | T_DEBUG
3193 {
3194 ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
3195 } | T_FULL
3196 {
3197 ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
3198 } | T_SKILL
3199 {
3200 ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
3201 } | T_NCHANGE
3202 {
3203 ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
3204 } | T_REJ
3205 {
3206 ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
3207 } | T_UNAUTH
3208 {
3209 ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
3210 } | T_SPY
3211 {
3212 ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
3213 } | T_EXTERNAL
3214 {
3215 ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
3216 } | T_OPERWALL
3217 {
3218 ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL;
3219 } | T_SERVNOTICE
3220 {
3221 ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
3222 } | T_INVISIBLE
3223 {
3224 ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
3225 } | T_WALLOP
3226 {
3227 ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
3228 } | T_SOFTCALLERID
3229 {
3230 ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
3231 } | T_CALLERID
3232 {
3233 ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
3234 } | T_LOCOPS
3235 {
3236 ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
3237 };
3238
3239 general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
3240 {
3241 ConfigFileEntry.min_nonwildcard = $3;
3242 };
3243
3244 general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
3245 {
3246 ConfigFileEntry.min_nonwildcard_simple = $3;
3247 };
3248
3249 general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
3250 {
3251 ConfigFileEntry.default_floodcount = $3;
3252 };
3253
3254 general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
3255 {
3256 ConfigFileEntry.client_flood = $3;
3257 };
3258
3259
3260 /***************************************************************************
3261 * section glines
3262 ***************************************************************************/
3263 gline_entry: GLINES
3264 {
3265 if (conf_parser_ctx.pass == 2)
3266 {
3267 yy_conf = make_conf_item(GDENY_TYPE);
3268 yy_aconf = map_to_conf(yy_conf);
3269 }
3270 } '{' gline_items '}' ';'
3271 {
3272 if (conf_parser_ctx.pass == 2)
3273 {
3274 /*
3275 * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
3276 * end we will have one extra, so we should free it.
3277 */
3278 if (yy_conf->name == NULL || yy_aconf->user == NULL)
3279 {
3280 delete_conf_item(yy_conf);
3281 yy_conf = NULL;
3282 yy_aconf = NULL;
3283 }
3284 }
3285 };
3286
3287 gline_items: gline_items gline_item | gline_item;
3288 gline_item: gline_enable |
3289 gline_duration |
3290 gline_logging |
3291 gline_user |
3292 gline_server |
3293 gline_action |
3294 error;
3295
3296 gline_enable: ENABLE '=' TBOOL ';'
3297 {
3298 if (conf_parser_ctx.pass == 2)
3299 ConfigFileEntry.glines = yylval.number;
3300 };
3301
3302 gline_duration: DURATION '=' timespec ';'
3303 {
3304 if (conf_parser_ctx.pass == 2)
3305 ConfigFileEntry.gline_time = $3;
3306 };
3307
3308 gline_logging: LOGGING
3309 {
3310 if (conf_parser_ctx.pass == 2)
3311 ConfigFileEntry.gline_logging = 0;
3312 } '=' gline_logging_types ';';
3313 gline_logging_types: gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3314 gline_logging_type_item: T_REJECT
3315 {
3316 if (conf_parser_ctx.pass == 2)
3317 ConfigFileEntry.gline_logging |= GDENY_REJECT;
3318 } | T_BLOCK
3319 {
3320 if (conf_parser_ctx.pass == 2)
3321 ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3322 };
3323
3324 gline_user: USER '=' QSTRING ';'
3325 {
3326 if (conf_parser_ctx.pass == 2)
3327 {
3328 struct split_nuh_item nuh;
3329
3330 nuh.nuhmask = yylval.string;
3331 nuh.nickptr = NULL;
3332 nuh.userptr = userbuf;
3333 nuh.hostptr = hostbuf;
3334
3335 nuh.nicksize = 0;
3336 nuh.usersize = sizeof(userbuf);
3337 nuh.hostsize = sizeof(hostbuf);
3338
3339 split_nuh(&nuh);
3340
3341 if (yy_aconf->user == NULL)
3342 {
3343 DupString(yy_aconf->user, userbuf);
3344 DupString(yy_aconf->host, hostbuf);
3345 }
3346 else
3347 {
3348 struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3349
3350 DupString(yy_tmp->user, userbuf);
3351 DupString(yy_tmp->host, hostbuf);
3352
3353 dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3354 }
3355 }
3356 };
3357
3358 gline_server: NAME '=' QSTRING ';'
3359 {
3360 if (conf_parser_ctx.pass == 2)
3361 {
3362 MyFree(yy_conf->name);
3363 DupString(yy_conf->name, yylval.string);
3364 }
3365 };
3366
3367 gline_action: ACTION
3368 {
3369 if (conf_parser_ctx.pass == 2)
3370 yy_aconf->flags = 0;
3371 } '=' gdeny_types ';'
3372 {
3373 if (conf_parser_ctx.pass == 2)
3374 {
3375 struct CollectItem *yy_tmp = NULL;
3376 dlink_node *ptr, *next_ptr;
3377
3378 DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3379 {
3380 struct AccessItem *new_aconf;
3381 struct ConfItem *new_conf;
3382
3383 yy_tmp = ptr->data;
3384 new_conf = make_conf_item(GDENY_TYPE);
3385 new_aconf = map_to_conf(new_conf);
3386
3387 new_aconf->flags = yy_aconf->flags;
3388
3389 if (yy_conf->name != NULL)
3390 DupString(new_conf->name, yy_conf->name);
3391 else
3392 DupString(new_conf->name, "*");
3393 if (yy_aconf->user != NULL)
3394 DupString(new_aconf->user, yy_tmp->user);
3395 else
3396 DupString(new_aconf->user, "*");
3397 if (yy_aconf->host != NULL)
3398 DupString(new_aconf->host, yy_tmp->host);
3399 else
3400 DupString(new_aconf->host, "*");
3401
3402 dlinkDelete(&yy_tmp->node, &col_conf_list);
3403 }
3404
3405 /*
3406 * In case someone has fed us with more than one action= after user/name
3407 * which would leak memory -Michael
3408 */
3409 if (yy_conf->name == NULL || yy_aconf->user == NULL)
3410 delete_conf_item(yy_conf);
3411
3412 yy_conf = make_conf_item(GDENY_TYPE);
3413 yy_aconf = map_to_conf(yy_conf);
3414 }
3415 };
3416
3417 gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3418 gdeny_type_item: T_REJECT
3419 {
3420 if (conf_parser_ctx.pass == 2)
3421 yy_aconf->flags |= GDENY_REJECT;
3422 } | T_BLOCK
3423 {
3424 if (conf_parser_ctx.pass == 2)
3425 yy_aconf->flags |= GDENY_BLOCK;
3426 };
3427
3428 /***************************************************************************
3429 * section channel
3430 ***************************************************************************/
3431 channel_entry: CHANNEL
3432 '{' channel_items '}' ';';
3433
3434 channel_items: channel_items channel_item | channel_item;
3435 channel_item: channel_disable_local_channels | channel_use_except |
3436 channel_use_invex | channel_use_knock |
3437 channel_max_bans | channel_knock_delay |
3438 channel_knock_delay_channel | channel_max_chans_per_user |
3439 channel_quiet_on_ban | channel_default_split_user_count |
3440 channel_default_split_server_count |
3441 channel_no_create_on_split | channel_restrict_channels |
3442 channel_no_join_on_split | channel_burst_topicwho |
3443 channel_jflood_count | channel_jflood_time |
3444 channel_disable_fake_channels | error;
3445
3446 channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
3447 {
3448 ConfigChannel.disable_fake_channels = yylval.number;
3449 };
3450
3451 channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3452 {
3453 ConfigChannel.restrict_channels = yylval.number;
3454 };
3455
3456 channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
3457 {
3458 ConfigChannel.disable_local_channels = yylval.number;
3459 };
3460
3461 channel_use_except: USE_EXCEPT '=' TBOOL ';'
3462 {
3463 ConfigChannel.use_except = yylval.number;
3464 };
3465
3466 channel_use_invex: USE_INVEX '=' TBOOL ';'
3467 {
3468 ConfigChannel.use_invex = yylval.number;
3469 };
3470
3471 channel_use_knock: USE_KNOCK '=' TBOOL ';'
3472 {
3473 ConfigChannel.use_knock = yylval.number;
3474 };
3475
3476 channel_knock_delay: KNOCK_DELAY '=' timespec ';'
3477 {
3478 ConfigChannel.knock_delay = $3;
3479 };
3480
3481 channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
3482 {
3483 ConfigChannel.knock_delay_channel = $3;
3484 };
3485
3486 channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3487 {
3488 ConfigChannel.max_chans_per_user = $3;
3489 };
3490
3491 channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
3492 {
3493 ConfigChannel.quiet_on_ban = yylval.number;
3494 };
3495
3496 channel_max_bans: MAX_BANS '=' NUMBER ';'
3497 {
3498 ConfigChannel.max_bans = $3;
3499 };
3500
3501 channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
3502 {
3503 ConfigChannel.default_split_user_count = $3;
3504 };
3505
3506 channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
3507 {
3508 ConfigChannel.default_split_server_count = $3;
3509 };
3510
3511 channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
3512 {
3513 ConfigChannel.no_create_on_split = yylval.number;
3514 };
3515
3516 channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
3517 {
3518 ConfigChannel.no_join_on_split = yylval.number;
3519 };
3520
3521 channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
3522 {
3523 ConfigChannel.burst_topicwho = yylval.number;
3524 };
3525
3526 channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3527 {
3528 GlobalSetOptions.joinfloodcount = yylval.number;
3529 };
3530
3531 channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
3532 {
3533 GlobalSetOptions.joinfloodtime = yylval.number;
3534 };
3535
3536 /***************************************************************************
3537 * section serverhide
3538 ***************************************************************************/
3539 serverhide_entry: SERVERHIDE
3540 '{' serverhide_items '}' ';';
3541
3542 serverhide_items: serverhide_items serverhide_item | serverhide_item;
3543 serverhide_item: serverhide_flatten_links | serverhide_hide_servers |
3544 serverhide_links_delay |
3545 serverhide_disable_hidden |
3546 serverhide_hidden | serverhide_hidden_name |
3547 serverhide_hide_server_ips |
3548 error;
3549
3550 serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3551 {
3552 if (conf_parser_ctx.pass == 2)
3553 ConfigServerHide.flatten_links = yylval.number;
3554 };
3555
3556 serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3557 {
3558 if (conf_parser_ctx.pass == 2)
3559 ConfigServerHide.hide_servers = yylval.number;
3560 };
3561
3562 serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3563 {
3564 if (conf_parser_ctx.pass == 2)
3565 {
3566 MyFree(ConfigServerHide.hidden_name);
3567 DupString(ConfigServerHide.hidden_name, yylval.string);
3568 }
3569 };
3570
3571 serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3572 {
3573 if (conf_parser_ctx.pass == 2)
3574 {
3575 if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3576 {
3577 eventAddIsh("write_links_file", write_links_file, NULL, $3);
3578 ConfigServerHide.links_disabled = 0;
3579 }
3580
3581 ConfigServerHide.links_delay = $3;
3582 }
3583 };
3584
3585 serverhide_hidden: HIDDEN '=' TBOOL ';'
3586 {
3587 if (conf_parser_ctx.pass == 2)
3588 ConfigServerHide.hidden = yylval.number;
3589 };
3590
3591 serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3592 {
3593 if (conf_parser_ctx.pass == 2)
3594 ConfigServerHide.disable_hidden = yylval.number;
3595 };
3596
3597 serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3598 {
3599 if (conf_parser_ctx.pass == 2)
3600 ConfigServerHide.hide_server_ips = yylval.number;
3601 };

Properties

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