ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1736
Committed: Sun Jan 13 09:31:46 2013 UTC (13 years, 8 months ago) by michael
File size: 71425 byte(s)
Log Message:
- Forward-port -r1732 [Dropped support for linux rt signals]

File Contents

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

Properties

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