ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1264
Committed: Tue Jan 17 12:30:57 2012 UTC (12 years, 2 months ago) by michael
Original Path: ircd-hybrid-8/src/ircd_parser.y
File size: 84700 byte(s)
Log Message:
- remove general::burst_away configuration directive. AWAY burst will have to
  be controlled via connect::flags explicitly.

File Contents

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

Properties

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