ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/src/conf_parser.y
Revision: 1516
Committed: Thu Aug 30 15:08:36 2012 UTC (13 years, 10 months ago) by michael
Original Path: ircd-hybrid-8/src/conf_parser.y
File size: 74375 byte(s)
Log Message:
- Removed general::client_flood configuration option and added the
  new 'recvq' configuration directive to class{} blocks.
  The max size of a receive queue can be seen in "STATS Y" for each class
- Update NEWS

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

Properties

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