ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1490
Committed: Sat Jul 28 19:33:23 2012 UTC (11 years, 8 months ago) by michael
Original Path: ircd-hybrid-8/src/conf_parser.y
File size: 74756 byte(s)
Log Message:
- removed serverhide::disable_hidden configuration option
- update NEWS

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

Properties

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