ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1301
Committed: Sat Mar 10 21:47:17 2012 UTC (12 years ago) by michael
Original Path: ircd-hybrid-8/src/ircd_parser.y
File size: 84199 byte(s)
Log Message:
- add 'dline' and 'undline' operator flags
- implement remote dlines mainly for services purposes, but can be used
  by operators as well
- update example configuration files; remove invalid shared::flags entries

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

Properties

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