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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1216 - (show annotations)
Tue Sep 13 18:22:31 2011 UTC (9 years ago) by michael
File size: 88492 byte(s)
- add 'globops' to operflags

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

Properties

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

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