ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1946
Committed: Sun May 5 10:21:40 2013 UTC (13 years, 5 months ago) by michael
File size: 72209 byte(s)
Log Message:
- Removed channel::quiet_on_ban configuration option. This feature is
  now enabled by default

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

Properties

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