ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1520
Committed: Wed Sep 5 15:50:02 2012 UTC (11 years, 7 months ago) by michael
Original Path: ircd-hybrid-8/src/conf_parser.y
File size: 73886 byte(s)
Log Message:
- removed unused terminal symbols

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

Properties

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