ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.0.x/src/conf_parser.y
Revision: 1732
Committed: Fri Jan 11 12:57:19 2013 UTC (13 years, 6 months ago) by michael
File size: 73221 byte(s)
Log Message:
- Dropped support for linux rt signals

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

Properties

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