ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1628
Committed: Thu Nov 1 21:08:56 2012 UTC (11 years, 5 months ago) by michael
File size: 72989 byte(s)
Log Message:
- flesh out new *line database handling
- simplify temporary bans

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

Properties

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