ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1632
Committed: Sun Nov 4 15:37:10 2012 UTC (11 years, 5 months ago) by michael
File size: 71825 byte(s)
Log Message:
- Initial rewrite of the configuration subsystem

File Contents

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

Properties

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