/[svn]/ircd-hybrid-8/src/conf_parser.y
ViewVC logotype

Contents of /ircd-hybrid-8/src/conf_parser.y

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1542 - (show annotations)
Sat Sep 29 20:31:35 2012 UTC (7 years, 10 months ago) by michael
File size: 73876 byte(s)
- Fixed an off-by-one with spoofs. Spoofs are now also checked for
  invalid characters.

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

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28