ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1383
Committed: Tue May 1 11:18:22 2012 UTC (14 years, 5 months ago) by michael
Original Path: ircd-hybrid-8/src/conf_parser.y
File size: 78561 byte(s)
Log Message:
- Cleanup/rewrite Hub/Leaf-mask configuration. Hub and Leaf configuration items
  are no longer separately attached to Client structures.

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 BURST_TOPICWHO
126     %token BYTES KBYTES MBYTES GBYTES TBYTES
127     %token CALLER_ID_WAIT
128     %token CAN_FLOOD
129     %token CHANNEL
130     %token CIDR_BITLEN_IPV4
131     %token CIDR_BITLEN_IPV6
132     %token CLASS
133     %token CONNECT
134     %token CONNECTFREQ
135     %token DEFAULT_FLOODCOUNT
136     %token DEFAULT_SPLIT_SERVER_COUNT
137     %token DEFAULT_SPLIT_USER_COUNT
138     %token DENY
139     %token DESCRIPTION
140     %token DIE
141     %token DISABLE_AUTH
142 michael 632 %token DISABLE_FAKE_CHANNELS
143 adx 30 %token DISABLE_HIDDEN
144     %token DISABLE_LOCAL_CHANNELS
145     %token DISABLE_REMOTE_COMMANDS
146     %token DOTS_IN_IDENT
147     %token DURATION
148     %token EGDPOOL_PATH
149     %token EMAIL
150     %token ENABLE
151     %token ENCRYPTED
152     %token EXCEED_LIMIT
153     %token EXEMPT
154     %token FAILED_OPER_NOTICE
155     %token IRCD_FLAGS
156     %token FLATTEN_LINKS
157     %token GECOS
158     %token GENERAL
159     %token GLINE
160     %token GLINES
161     %token GLINE_EXEMPT
162     %token GLINE_TIME
163     %token GLINE_MIN_CIDR
164     %token GLINE_MIN_CIDR6
165     %token GLOBAL_KILL
166     %token IRCD_AUTH
167     %token NEED_IDENT
168     %token HAVENT_READ_CONF
169     %token HIDDEN
170     %token HIDDEN_NAME
171     %token HIDE_SERVER_IPS
172     %token HIDE_SERVERS
173     %token HIDE_SPOOF_IPS
174     %token HOST
175     %token HUB
176     %token HUB_MASK
177     %token IGNORE_BOGUS_TS
178     %token INVISIBLE_ON_CONNECT
179     %token IP
180     %token KILL
181     %token KILL_CHASE_TIME_LIMIT
182     %token KLINE
183     %token KLINE_EXEMPT
184     %token KLINE_REASON
185     %token KLINE_WITH_REASON
186     %token KNOCK_DELAY
187     %token KNOCK_DELAY_CHANNEL
188     %token LEAF_MASK
189     %token LINKS_DELAY
190     %token LISTEN
191     %token T_LOG
192     %token MAX_ACCEPT
193     %token MAX_BANS
194     %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     %token T_SKILL
311     %token T_SPY
312     %token T_SSL
313 michael 56 %token T_UMODES
314 adx 30 %token T_UNAUTH
315 michael 1301 %token T_UNDLINE
316 michael 1250 %token T_UNLIMITED
317 adx 30 %token T_UNRESV
318     %token T_UNXLINE
319 michael 1216 %token T_GLOBOPS
320 adx 30 %token T_WALLOP
321 michael 1228 %token T_RESTART
322 michael 1157 %token T_SERVICE
323 michael 1176 %token T_SERVICES_NAME
324 adx 30 %token THROTTLE_TIME
325     %token TOPICBURST
326     %token TRUE_NO_OPER_FLOOD
327     %token TKLINE
328     %token TXLINE
329     %token TRESV
330     %token UNKLINE
331     %token USER
332     %token USE_EGD
333     %token USE_EXCEPT
334     %token USE_INVEX
335     %token USE_KNOCK
336     %token USE_LOGGING
337     %token USE_WHOIS_ACTUALLY
338     %token VHOST
339     %token VHOST6
340     %token XLINE
341     %token WARN
342     %token WARN_NO_NLINE
343 michael 1247 %token T_SIZE
344     %token T_FILE
345 adx 30
346     %type <string> QSTRING
347     %type <number> NUMBER
348     %type <number> timespec
349     %type <number> timespec_
350     %type <number> sizespec
351     %type <number> sizespec_
352    
353     %%
354     conf:
355     | conf conf_item
356     ;
357    
358     conf_item: admin_entry
359     | logging_entry
360     | oper_entry
361     | channel_entry
362     | class_entry
363     | listen_entry
364     | auth_entry
365     | serverinfo_entry
366     | serverhide_entry
367     | resv_entry
368 michael 1157 | service_entry
369 adx 30 | shared_entry
370     | cluster_entry
371     | connect_entry
372     | kill_entry
373     | deny_entry
374     | exempt_entry
375     | general_entry
376     | gline_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     new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->ipnum,
943     &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     yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->ipnum,
1028     &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     } | MODULE
1281 adx 30 {
1282 michael 967 if (conf_parser_ctx.pass == 2)
1283 michael 1228 yy_aconf->port |= OPER_FLAG_MODULE;
1284 adx 30 };
1285    
1286    
1287     /***************************************************************************
1288     * section class
1289     ***************************************************************************/
1290     class_entry: CLASS
1291     {
1292 michael 967 if (conf_parser_ctx.pass == 1)
1293 adx 30 {
1294     yy_conf = make_conf_item(CLASS_TYPE);
1295 michael 671 yy_class = map_to_conf(yy_conf);
1296 adx 30 }
1297 michael 1285 } '{' class_items '}' ';'
1298 adx 30 {
1299 michael 967 if (conf_parser_ctx.pass == 1)
1300 adx 30 {
1301 michael 671 struct ConfItem *cconf = NULL;
1302 adx 30 struct ClassItem *class = NULL;
1303    
1304     if (yy_class_name == NULL)
1305     delete_conf_item(yy_conf);
1306     else
1307     {
1308 michael 1285 cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1309 adx 30
1310     if (cconf != NULL) /* The class existed already */
1311     {
1312 michael 671 int user_count = 0;
1313    
1314 adx 30 rebuild_cidr_class(cconf, yy_class);
1315 michael 671
1316     class = map_to_conf(cconf);
1317    
1318     user_count = class->curr_user_count;
1319     memcpy(class, yy_class, sizeof(*class));
1320     class->curr_user_count = user_count;
1321     class->active = 1;
1322    
1323 adx 30 delete_conf_item(yy_conf);
1324    
1325     MyFree(cconf->name); /* Allows case change of class name */
1326     cconf->name = yy_class_name;
1327     }
1328     else /* Brand new class */
1329     {
1330     MyFree(yy_conf->name); /* just in case it was allocated */
1331     yy_conf->name = yy_class_name;
1332 michael 671 yy_class->active = 1;
1333 adx 30 }
1334     }
1335 michael 671
1336 adx 30 yy_class_name = NULL;
1337     }
1338     };
1339    
1340     class_items: class_items class_item | class_item;
1341     class_item: class_name |
1342     class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
1343     class_ping_time |
1344     class_ping_warning |
1345     class_number_per_cidr |
1346     class_number_per_ip |
1347     class_connectfreq |
1348     class_max_number |
1349     class_max_global |
1350     class_max_local |
1351     class_max_ident |
1352     class_sendq |
1353     error ';' ;
1354    
1355     class_name: NAME '=' QSTRING ';'
1356     {
1357 michael 967 if (conf_parser_ctx.pass == 1)
1358 adx 30 {
1359     MyFree(yy_class_name);
1360     DupString(yy_class_name, yylval.string);
1361     }
1362     };
1363    
1364     class_ping_time: PING_TIME '=' timespec ';'
1365     {
1366 michael 967 if (conf_parser_ctx.pass == 1)
1367 michael 1377 yy_class->ping_freq = $3;
1368 adx 30 };
1369    
1370     class_ping_warning: PING_WARNING '=' timespec ';'
1371     {
1372 michael 967 if (conf_parser_ctx.pass == 1)
1373 michael 1377 yy_class->ping_warning = $3;
1374 adx 30 };
1375    
1376     class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1377     {
1378 michael 967 if (conf_parser_ctx.pass == 1)
1379 michael 1377 yy_class->max_perip = $3;
1380 adx 30 };
1381    
1382     class_connectfreq: CONNECTFREQ '=' timespec ';'
1383     {
1384 michael 967 if (conf_parser_ctx.pass == 1)
1385 michael 1377 yy_class->con_freq = $3;
1386 adx 30 };
1387    
1388     class_max_number: MAX_NUMBER '=' NUMBER ';'
1389     {
1390 michael 967 if (conf_parser_ctx.pass == 1)
1391 michael 1377 yy_class->max_total = $3;
1392 adx 30 };
1393    
1394     class_max_global: MAX_GLOBAL '=' NUMBER ';'
1395     {
1396 michael 967 if (conf_parser_ctx.pass == 1)
1397 michael 1377 yy_class->max_global = $3;
1398 adx 30 };
1399    
1400     class_max_local: MAX_LOCAL '=' NUMBER ';'
1401     {
1402 michael 967 if (conf_parser_ctx.pass == 1)
1403 michael 1377 yy_class->max_local = $3;
1404 adx 30 };
1405    
1406     class_max_ident: MAX_IDENT '=' NUMBER ';'
1407     {
1408 michael 967 if (conf_parser_ctx.pass == 1)
1409 michael 1377 yy_class->max_ident = $3;
1410 adx 30 };
1411    
1412     class_sendq: SENDQ '=' sizespec ';'
1413     {
1414 michael 967 if (conf_parser_ctx.pass == 1)
1415 michael 1377 yy_class->max_sendq = $3;
1416 adx 30 };
1417    
1418     class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1419     {
1420 michael 967 if (conf_parser_ctx.pass == 1)
1421 michael 1377 yy_class->cidr_bitlen_ipv4 = $3;
1422 adx 30 };
1423    
1424     class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1425     {
1426 michael 967 if (conf_parser_ctx.pass == 1)
1427 michael 1377 yy_class->cidr_bitlen_ipv6 = $3;
1428 adx 30 };
1429    
1430     class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1431     {
1432 michael 967 if (conf_parser_ctx.pass == 1)
1433 michael 1377 yy_class->number_per_cidr = $3;
1434 adx 30 };
1435    
1436     /***************************************************************************
1437     * section listen
1438     ***************************************************************************/
1439     listen_entry: LISTEN
1440     {
1441 michael 967 if (conf_parser_ctx.pass == 2)
1442 adx 30 {
1443     listener_address = NULL;
1444     listener_flags = 0;
1445     }
1446     } '{' listen_items '}' ';'
1447     {
1448 michael 967 if (conf_parser_ctx.pass == 2)
1449 adx 30 {
1450     MyFree(listener_address);
1451     listener_address = NULL;
1452     }
1453     };
1454    
1455     listen_flags: IRCD_FLAGS
1456     {
1457 michael 440 listener_flags = 0;
1458 adx 30 } '=' listen_flags_items ';';
1459    
1460     listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1461     listen_flags_item: T_SSL
1462     {
1463 michael 967 if (conf_parser_ctx.pass == 2)
1464 adx 30 listener_flags |= LISTENER_SSL;
1465     } | HIDDEN
1466     {
1467 michael 967 if (conf_parser_ctx.pass == 2)
1468 adx 30 listener_flags |= LISTENER_HIDDEN;
1469 michael 900 } | T_SERVER
1470     {
1471 michael 967 if (conf_parser_ctx.pass == 2)
1472 michael 900 listener_flags |= LISTENER_SERVER;
1473 adx 30 };
1474    
1475 michael 900
1476    
1477 adx 30 listen_items: listen_items listen_item | listen_item;
1478 michael 440 listen_item: listen_port | listen_flags | listen_address | listen_host | error ';';
1479 adx 30
1480 michael 440 listen_port: PORT '=' port_items { listener_flags = 0; } ';';
1481 adx 30
1482     port_items: port_items ',' port_item | port_item;
1483    
1484     port_item: NUMBER
1485     {
1486 michael 967 if (conf_parser_ctx.pass == 2)
1487 adx 30 {
1488     if ((listener_flags & LISTENER_SSL))
1489     #ifdef HAVE_LIBCRYPTO
1490 michael 967 if (!ServerInfo.server_ctx)
1491 adx 30 #endif
1492     {
1493     yyerror("SSL not available - port closed");
1494     break;
1495     }
1496     add_listener($1, listener_address, listener_flags);
1497     }
1498     } | NUMBER TWODOTS NUMBER
1499     {
1500 michael 967 if (conf_parser_ctx.pass == 2)
1501 adx 30 {
1502     int i;
1503    
1504     if ((listener_flags & LISTENER_SSL))
1505     #ifdef HAVE_LIBCRYPTO
1506 michael 967 if (!ServerInfo.server_ctx)
1507 adx 30 #endif
1508     {
1509     yyerror("SSL not available - port closed");
1510     break;
1511     }
1512    
1513     for (i = $1; i <= $3; ++i)
1514     add_listener(i, listener_address, listener_flags);
1515     }
1516     };
1517    
1518     listen_address: IP '=' QSTRING ';'
1519     {
1520 michael 967 if (conf_parser_ctx.pass == 2)
1521 adx 30 {
1522     MyFree(listener_address);
1523     DupString(listener_address, yylval.string);
1524     }
1525     };
1526    
1527     listen_host: HOST '=' QSTRING ';'
1528     {
1529 michael 967 if (conf_parser_ctx.pass == 2)
1530 adx 30 {
1531     MyFree(listener_address);
1532     DupString(listener_address, yylval.string);
1533     }
1534     };
1535    
1536     /***************************************************************************
1537     * section auth
1538     ***************************************************************************/
1539     auth_entry: IRCD_AUTH
1540     {
1541 michael 967 if (conf_parser_ctx.pass == 2)
1542 adx 30 {
1543     yy_conf = make_conf_item(CLIENT_TYPE);
1544     yy_aconf = map_to_conf(yy_conf);
1545     }
1546     else
1547     {
1548     MyFree(class_name);
1549     class_name = NULL;
1550     }
1551     } '{' auth_items '}' ';'
1552     {
1553 michael 967 if (conf_parser_ctx.pass == 2)
1554 adx 30 {
1555     struct CollectItem *yy_tmp = NULL;
1556     dlink_node *ptr = NULL, *next_ptr = NULL;
1557    
1558     if (yy_aconf->user && yy_aconf->host)
1559     {
1560     conf_add_class_to_conf(yy_conf, class_name);
1561     add_conf_by_address(CONF_CLIENT, yy_aconf);
1562     }
1563     else
1564     delete_conf_item(yy_conf);
1565    
1566     /* copy over settings from first struct */
1567     DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
1568     {
1569     struct AccessItem *new_aconf;
1570     struct ConfItem *new_conf;
1571    
1572     new_conf = make_conf_item(CLIENT_TYPE);
1573     new_aconf = map_to_conf(new_conf);
1574    
1575     yy_tmp = ptr->data;
1576    
1577     assert(yy_tmp->user && yy_tmp->host);
1578    
1579     if (yy_aconf->passwd != NULL)
1580     DupString(new_aconf->passwd, yy_aconf->passwd);
1581     if (yy_conf->name != NULL)
1582     DupString(new_conf->name, yy_conf->name);
1583     if (yy_aconf->passwd != NULL)
1584     DupString(new_aconf->passwd, yy_aconf->passwd);
1585    
1586     new_aconf->flags = yy_aconf->flags;
1587     new_aconf->port = yy_aconf->port;
1588    
1589     DupString(new_aconf->user, yy_tmp->user);
1590     collapse(new_aconf->user);
1591    
1592     DupString(new_aconf->host, yy_tmp->host);
1593     collapse(new_aconf->host);
1594    
1595     conf_add_class_to_conf(new_conf, class_name);
1596     add_conf_by_address(CONF_CLIENT, new_aconf);
1597     dlinkDelete(&yy_tmp->node, &col_conf_list);
1598     free_collect_item(yy_tmp);
1599     }
1600    
1601     MyFree(class_name);
1602     class_name = NULL;
1603     yy_conf = NULL;
1604     yy_aconf = NULL;
1605     }
1606     };
1607    
1608     auth_items: auth_items auth_item | auth_item;
1609     auth_item: auth_user | auth_passwd | auth_class | auth_flags |
1610 michael 1076 auth_spoof | auth_redir_serv | auth_redir_port |
1611     auth_encrypted | error ';' ;
1612 adx 30
1613     auth_user: USER '=' QSTRING ';'
1614     {
1615 michael 967 if (conf_parser_ctx.pass == 2)
1616 adx 30 {
1617 michael 593 struct CollectItem *yy_tmp = NULL;
1618     struct split_nuh_item nuh;
1619 adx 30
1620 michael 593 nuh.nuhmask = yylval.string;
1621     nuh.nickptr = NULL;
1622     nuh.userptr = userbuf;
1623     nuh.hostptr = hostbuf;
1624    
1625     nuh.nicksize = 0;
1626     nuh.usersize = sizeof(userbuf);
1627     nuh.hostsize = sizeof(hostbuf);
1628    
1629     split_nuh(&nuh);
1630    
1631 adx 30 if (yy_aconf->user == NULL)
1632 michael 593 {
1633     DupString(yy_aconf->user, userbuf);
1634     DupString(yy_aconf->host, hostbuf);
1635     }
1636 adx 30 else
1637     {
1638     yy_tmp = MyMalloc(sizeof(struct CollectItem));
1639 michael 593
1640     DupString(yy_tmp->user, userbuf);
1641     DupString(yy_tmp->host, hostbuf);
1642    
1643 adx 30 dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1644     }
1645     }
1646     };
1647    
1648     /* XXX - IP/IPV6 tags don't exist anymore - put IP/IPV6 into user. */
1649    
1650     auth_passwd: PASSWORD '=' QSTRING ';'
1651     {
1652 michael 967 if (conf_parser_ctx.pass == 2)
1653 adx 30 {
1654     /* be paranoid */
1655     if (yy_aconf->passwd != NULL)
1656     memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1657    
1658     MyFree(yy_aconf->passwd);
1659     DupString(yy_aconf->passwd, yylval.string);
1660     }
1661     };
1662    
1663     auth_class: CLASS '=' QSTRING ';'
1664     {
1665 michael 967 if (conf_parser_ctx.pass == 2)
1666 adx 30 {
1667     MyFree(class_name);
1668     DupString(class_name, yylval.string);
1669     }
1670     };
1671    
1672     auth_encrypted: ENCRYPTED '=' TBOOL ';'
1673     {
1674 michael 967 if (conf_parser_ctx.pass == 2)
1675 adx 30 {
1676     if (yylval.number)
1677     SetConfEncrypted(yy_aconf);
1678     else
1679     ClearConfEncrypted(yy_aconf);
1680     }
1681     };
1682    
1683     auth_flags: IRCD_FLAGS
1684     {
1685     } '=' auth_flags_items ';';
1686    
1687     auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1688 michael 1228 auth_flags_item: SPOOF_NOTICE
1689 adx 30 {
1690 michael 967 if (conf_parser_ctx.pass == 2)
1691 michael 1228 yy_aconf->flags |= CONF_FLAGS_SPOOF_NOTICE;
1692 adx 30 } | EXCEED_LIMIT
1693     {
1694 michael 967 if (conf_parser_ctx.pass == 2)
1695 michael 1228 yy_aconf->flags |= CONF_FLAGS_NOLIMIT;
1696 adx 30 } | KLINE_EXEMPT
1697     {
1698 michael 967 if (conf_parser_ctx.pass == 2)
1699 michael 1228 yy_aconf->flags |= CONF_FLAGS_EXEMPTKLINE;
1700 adx 30 } | NEED_IDENT
1701     {
1702 michael 967 if (conf_parser_ctx.pass == 2)
1703 michael 1228 yy_aconf->flags |= CONF_FLAGS_NEED_IDENTD;
1704 adx 30 } | CAN_FLOOD
1705     {
1706 michael 967 if (conf_parser_ctx.pass == 2)
1707 michael 1228 yy_aconf->flags |= CONF_FLAGS_CAN_FLOOD;
1708 adx 30 } | NO_TILDE
1709     {
1710 michael 967 if (conf_parser_ctx.pass == 2)
1711 michael 1228 yy_aconf->flags |= CONF_FLAGS_NO_TILDE;
1712 adx 30 } | GLINE_EXEMPT
1713     {
1714 michael 967 if (conf_parser_ctx.pass == 2)
1715 michael 1228 yy_aconf->flags |= CONF_FLAGS_EXEMPTGLINE;
1716 adx 30 } | RESV_EXEMPT
1717     {
1718 michael 967 if (conf_parser_ctx.pass == 2)
1719 michael 1228 yy_aconf->flags |= CONF_FLAGS_EXEMPTRESV;
1720 adx 30 } | NEED_PASSWORD
1721     {
1722 michael 967 if (conf_parser_ctx.pass == 2)
1723 michael 1228 yy_aconf->flags |= CONF_FLAGS_NEED_PASSWORD;
1724 adx 30 };
1725    
1726     /* XXX - need check for illegal hostnames here */
1727     auth_spoof: SPOOF '=' QSTRING ';'
1728     {
1729 michael 967 if (conf_parser_ctx.pass == 2)
1730 adx 30 {
1731     MyFree(yy_conf->name);
1732    
1733     if (strlen(yylval.string) < HOSTLEN)
1734     {
1735     DupString(yy_conf->name, yylval.string);
1736     yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
1737     }
1738     else
1739     {
1740 michael 1247 ilog(LOG_TYPE_IRCD, "Spoofs must be less than %d..ignoring it", HOSTLEN);
1741 adx 30 yy_conf->name = NULL;
1742     }
1743     }
1744     };
1745    
1746     auth_redir_serv: REDIRSERV '=' QSTRING ';'
1747     {
1748 michael 967 if (conf_parser_ctx.pass == 2)
1749 adx 30 {
1750     yy_aconf->flags |= CONF_FLAGS_REDIR;
1751     MyFree(yy_conf->name);
1752     DupString(yy_conf->name, yylval.string);
1753     }
1754     };
1755    
1756     auth_redir_port: REDIRPORT '=' NUMBER ';'
1757     {
1758 michael 967 if (conf_parser_ctx.pass == 2)
1759 adx 30 {
1760     yy_aconf->flags |= CONF_FLAGS_REDIR;
1761     yy_aconf->port = $3;
1762     }
1763     };
1764    
1765    
1766     /***************************************************************************
1767     * section resv
1768     ***************************************************************************/
1769     resv_entry: RESV
1770     {
1771 michael 967 if (conf_parser_ctx.pass == 2)
1772 adx 30 {
1773     MyFree(resv_reason);
1774     resv_reason = NULL;
1775     }
1776     } '{' resv_items '}' ';'
1777     {
1778 michael 967 if (conf_parser_ctx.pass == 2)
1779 adx 30 {
1780     MyFree(resv_reason);
1781     resv_reason = NULL;
1782     }
1783     };
1784    
1785     resv_items: resv_items resv_item | resv_item;
1786     resv_item: resv_creason | resv_channel | resv_nick | error ';' ;
1787    
1788     resv_creason: REASON '=' QSTRING ';'
1789     {
1790 michael 967 if (conf_parser_ctx.pass == 2)
1791 adx 30 {
1792     MyFree(resv_reason);
1793     DupString(resv_reason, yylval.string);
1794     }
1795     };
1796    
1797     resv_channel: CHANNEL '=' QSTRING ';'
1798     {
1799 michael 967 if (conf_parser_ctx.pass == 2)
1800 adx 30 {
1801     if (IsChanPrefix(*yylval.string))
1802     {
1803     char def_reason[] = "No reason";
1804    
1805     create_channel_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
1806     }
1807     }
1808     /* ignore it for now.. but we really should make a warning if
1809     * its an erroneous name --fl_ */
1810     };
1811    
1812     resv_nick: NICK '=' QSTRING ';'
1813     {
1814 michael 967 if (conf_parser_ctx.pass == 2)
1815 adx 30 {
1816     char def_reason[] = "No reason";
1817    
1818     create_nick_resv(yylval.string, resv_reason != NULL ? resv_reason : def_reason, 1);
1819     }
1820     };
1821    
1822     /***************************************************************************
1823 michael 1157 * section service
1824     ***************************************************************************/
1825     service_entry: T_SERVICE '{' service_items '}' ';';
1826    
1827     service_items: service_items service_item | service_item;
1828     service_item: service_name | error;
1829    
1830     service_name: NAME '=' QSTRING ';'
1831     {
1832     if (conf_parser_ctx.pass == 2)
1833     {
1834     if (valid_servname(yylval.string))
1835     {
1836     yy_conf = make_conf_item(SERVICE_TYPE);
1837     DupString(yy_conf->name, yylval.string);
1838     }
1839     }
1840     };
1841    
1842     /***************************************************************************
1843 adx 30 * section shared, for sharing remote klines etc.
1844     ***************************************************************************/
1845     shared_entry: T_SHARED
1846     {
1847 michael 967 if (conf_parser_ctx.pass == 2)
1848 adx 30 {
1849     yy_conf = make_conf_item(ULINE_TYPE);
1850     yy_match_item = map_to_conf(yy_conf);
1851     yy_match_item->action = SHARED_ALL;
1852     }
1853     } '{' shared_items '}' ';'
1854     {
1855 michael 967 if (conf_parser_ctx.pass == 2)
1856 adx 30 {
1857     yy_conf = NULL;
1858     }
1859     };
1860    
1861     shared_items: shared_items shared_item | shared_item;
1862     shared_item: shared_name | shared_user | shared_type | error ';' ;
1863    
1864     shared_name: NAME '=' QSTRING ';'
1865     {
1866 michael 967 if (conf_parser_ctx.pass == 2)
1867 adx 30 {
1868     MyFree(yy_conf->name);
1869     DupString(yy_conf->name, yylval.string);
1870     }
1871     };
1872    
1873     shared_user: USER '=' QSTRING ';'
1874     {
1875 michael 967 if (conf_parser_ctx.pass == 2)
1876 adx 30 {
1877 michael 593 struct split_nuh_item nuh;
1878    
1879     nuh.nuhmask = yylval.string;
1880     nuh.nickptr = NULL;
1881     nuh.userptr = userbuf;
1882     nuh.hostptr = hostbuf;
1883    
1884     nuh.nicksize = 0;
1885     nuh.usersize = sizeof(userbuf);
1886     nuh.hostsize = sizeof(hostbuf);
1887    
1888     split_nuh(&nuh);
1889    
1890     DupString(yy_match_item->user, userbuf);
1891     DupString(yy_match_item->host, hostbuf);
1892 adx 30 }
1893     };
1894    
1895     shared_type: TYPE
1896     {
1897 michael 967 if (conf_parser_ctx.pass == 2)
1898 adx 30 yy_match_item->action = 0;
1899     } '=' shared_types ';' ;
1900    
1901     shared_types: shared_types ',' shared_type_item | shared_type_item;
1902     shared_type_item: KLINE
1903     {
1904 michael 967 if (conf_parser_ctx.pass == 2)
1905 adx 30 yy_match_item->action |= SHARED_KLINE;
1906 michael 1301 } | UNKLINE
1907 adx 30 {
1908 michael 967 if (conf_parser_ctx.pass == 2)
1909 michael 1301 yy_match_item->action |= SHARED_UNKLINE;
1910     } | T_DLINE
1911 adx 30 {
1912 michael 967 if (conf_parser_ctx.pass == 2)
1913 michael 1301 yy_match_item->action |= SHARED_DLINE;
1914     } | T_UNDLINE
1915     {
1916     if (conf_parser_ctx.pass == 2)
1917     yy_match_item->action |= SHARED_UNDLINE;
1918 adx 30 } | XLINE
1919     {
1920 michael 967 if (conf_parser_ctx.pass == 2)
1921 adx 30 yy_match_item->action |= SHARED_XLINE;
1922     } | T_UNXLINE
1923     {
1924 michael 967 if (conf_parser_ctx.pass == 2)
1925 adx 30 yy_match_item->action |= SHARED_UNXLINE;
1926     } | RESV
1927     {
1928 michael 967 if (conf_parser_ctx.pass == 2)
1929 adx 30 yy_match_item->action |= SHARED_RESV;
1930     } | T_UNRESV
1931     {
1932 michael 967 if (conf_parser_ctx.pass == 2)
1933 adx 30 yy_match_item->action |= SHARED_UNRESV;
1934     } | T_LOCOPS
1935     {
1936 michael 967 if (conf_parser_ctx.pass == 2)
1937 adx 30 yy_match_item->action |= SHARED_LOCOPS;
1938     } | T_ALL
1939     {
1940 michael 967 if (conf_parser_ctx.pass == 2)
1941 adx 30 yy_match_item->action = SHARED_ALL;
1942     };
1943    
1944     /***************************************************************************
1945     * section cluster
1946     ***************************************************************************/
1947     cluster_entry: T_CLUSTER
1948     {
1949 michael 967 if (conf_parser_ctx.pass == 2)
1950 adx 30 {
1951     yy_conf = make_conf_item(CLUSTER_TYPE);
1952     yy_conf->flags = SHARED_ALL;
1953     }
1954     } '{' cluster_items '}' ';'
1955     {
1956 michael 967 if (conf_parser_ctx.pass == 2)
1957 adx 30 {
1958     if (yy_conf->name == NULL)
1959     DupString(yy_conf->name, "*");
1960     yy_conf = NULL;
1961     }
1962     };
1963    
1964     cluster_items: cluster_items cluster_item | cluster_item;
1965     cluster_item: cluster_name | cluster_type | error ';' ;
1966    
1967     cluster_name: NAME '=' QSTRING ';'
1968     {
1969 michael 967 if (conf_parser_ctx.pass == 2)
1970 adx 30 DupString(yy_conf->name, yylval.string);
1971     };
1972    
1973     cluster_type: TYPE
1974     {
1975 michael 967 if (conf_parser_ctx.pass == 2)
1976 adx 30 yy_conf->flags = 0;
1977     } '=' cluster_types ';' ;
1978    
1979     cluster_types: cluster_types ',' cluster_type_item | cluster_type_item;
1980     cluster_type_item: KLINE
1981     {
1982 michael 967 if (conf_parser_ctx.pass == 2)
1983 adx 30 yy_conf->flags |= SHARED_KLINE;
1984 michael 1301 } | UNKLINE
1985 adx 30 {
1986 michael 967 if (conf_parser_ctx.pass == 2)
1987 michael 1301 yy_conf->flags |= SHARED_UNKLINE;
1988     } | T_DLINE
1989 adx 30 {
1990 michael 967 if (conf_parser_ctx.pass == 2)
1991 michael 1301 yy_conf->flags |= SHARED_DLINE;
1992     } | T_UNDLINE
1993     {
1994     if (conf_parser_ctx.pass == 2)
1995     yy_conf->flags |= SHARED_UNDLINE;
1996 adx 30 } | XLINE
1997     {
1998 michael 967 if (conf_parser_ctx.pass == 2)
1999 adx 30 yy_conf->flags |= SHARED_XLINE;
2000     } | T_UNXLINE
2001     {
2002 michael 967 if (conf_parser_ctx.pass == 2)
2003 adx 30 yy_conf->flags |= SHARED_UNXLINE;
2004     } | RESV
2005     {
2006 michael 967 if (conf_parser_ctx.pass == 2)
2007 adx 30 yy_conf->flags |= SHARED_RESV;
2008     } | T_UNRESV
2009     {
2010 michael 967 if (conf_parser_ctx.pass == 2)
2011 adx 30 yy_conf->flags |= SHARED_UNRESV;
2012     } | T_LOCOPS
2013     {
2014 michael 967 if (conf_parser_ctx.pass == 2)
2015 adx 30 yy_conf->flags |= SHARED_LOCOPS;
2016     } | T_ALL
2017     {
2018 michael 967 if (conf_parser_ctx.pass == 2)
2019 adx 30 yy_conf->flags = SHARED_ALL;
2020     };
2021    
2022     /***************************************************************************
2023     * section connect
2024     ***************************************************************************/
2025     connect_entry: CONNECT
2026     {
2027 michael 967 if (conf_parser_ctx.pass == 2)
2028 adx 30 {
2029     yy_conf = make_conf_item(SERVER_TYPE);
2030 michael 1265 yy_aconf = map_to_conf(yy_conf);
2031    
2032 adx 30 /* defaults */
2033     yy_aconf->port = PORTNUM;
2034     }
2035     else
2036     {
2037     MyFree(class_name);
2038     class_name = NULL;
2039     }
2040 michael 1285 } '{' connect_items '}' ';'
2041 adx 30 {
2042 michael 967 if (conf_parser_ctx.pass == 2)
2043 adx 30 {
2044 michael 1383 if (yy_aconf->host && yy_aconf->passwd && yy_aconf->spasswd)
2045 michael 1302 {
2046     if (conf_add_server(yy_conf, class_name) == -1)
2047     delete_conf_item(yy_conf);
2048     }
2049     else
2050     {
2051     if (yy_conf->name != NULL)
2052     {
2053     if (yy_aconf->host == NULL)
2054     yyerror("Ignoring connect block -- missing host");
2055     else if (!yy_aconf->passwd || !yy_aconf->spasswd)
2056     yyerror("Ignoring connect block -- missing password");
2057     }
2058 adx 30
2059 michael 1302 /* XXX
2060     * This fixes a try_connections() core (caused by invalid class_ptr
2061     * pointers) reported by metalrock. That's an ugly fix, but there
2062     * is currently no better way. The entire config subsystem needs an
2063     * rewrite ASAP. make_conf_item() shouldn't really add things onto
2064     * a doubly linked list immediately without any sanity checks! -Michael
2065     */
2066     delete_conf_item(yy_conf);
2067     }
2068 adx 30
2069 michael 1383 MyFree(class_name);
2070     class_name = NULL;
2071     yy_conf = NULL;
2072     yy_aconf = NULL;
2073 adx 30 }
2074     };
2075    
2076     connect_items: connect_items connect_item | connect_item;
2077     connect_item: connect_name | connect_host | connect_vhost |
2078     connect_send_password | connect_accept_password |
2079 michael 1306 connect_aftype | connect_port | connect_ssl_cipher_list |
2080 michael 1076 connect_flags | connect_hub_mask | connect_leaf_mask |
2081 michael 1302 connect_class | connect_encrypted |
2082 michael 1076 error ';' ;
2083 adx 30
2084     connect_name: NAME '=' QSTRING ';'
2085     {
2086 michael 967 if (conf_parser_ctx.pass == 2)
2087 adx 30 {
2088     MyFree(yy_conf->name);
2089     DupString(yy_conf->name, yylval.string);
2090     }
2091     };
2092    
2093     connect_host: HOST '=' QSTRING ';'
2094     {
2095 michael 967 if (conf_parser_ctx.pass == 2)
2096 adx 30 {
2097     MyFree(yy_aconf->host);
2098     DupString(yy_aconf->host, yylval.string);
2099     }
2100     };
2101    
2102     connect_vhost: VHOST '=' QSTRING ';'
2103     {
2104 michael 967 if (conf_parser_ctx.pass == 2)
2105 adx 30 {
2106     struct addrinfo hints, *res;
2107    
2108     memset(&hints, 0, sizeof(hints));
2109    
2110     hints.ai_family = AF_UNSPEC;
2111     hints.ai_socktype = SOCK_STREAM;
2112     hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2113    
2114 michael 1123 if (getaddrinfo(yylval.string, NULL, &hints, &res))
2115 michael 1247 ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
2116 adx 30 else
2117     {
2118     assert(res != NULL);
2119    
2120     memcpy(&yy_aconf->my_ipnum, res->ai_addr, res->ai_addrlen);
2121     yy_aconf->my_ipnum.ss.ss_family = res->ai_family;
2122     yy_aconf->my_ipnum.ss_len = res->ai_addrlen;
2123 michael 1123 freeaddrinfo(res);
2124 adx 30 }
2125     }
2126     };
2127    
2128     connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2129     {
2130 michael 967 if (conf_parser_ctx.pass == 2)
2131 adx 30 {
2132 adx 38 if ($3[0] == ':')
2133     yyerror("Server passwords cannot begin with a colon");
2134     else if (strchr($3, ' ') != NULL)
2135     yyerror("Server passwords cannot contain spaces");
2136     else {
2137     if (yy_aconf->spasswd != NULL)
2138     memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd));
2139 adx 30
2140 adx 38 MyFree(yy_aconf->spasswd);
2141     DupString(yy_aconf->spasswd, yylval.string);
2142     }
2143 adx 30 }
2144     };
2145    
2146     connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2147     {
2148 michael 967 if (conf_parser_ctx.pass == 2)
2149 adx 30 {
2150 adx 38 if ($3[0] == ':')
2151     yyerror("Server passwords cannot begin with a colon");
2152     else if (strchr($3, ' ') != NULL)
2153     yyerror("Server passwords cannot contain spaces");
2154     else {
2155     if (yy_aconf->passwd != NULL)
2156     memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
2157 adx 30
2158 adx 38 MyFree(yy_aconf->passwd);
2159     DupString(yy_aconf->passwd, yylval.string);
2160     }
2161 adx 30 }
2162     };
2163    
2164     connect_port: PORT '=' NUMBER ';'
2165     {
2166 michael 967 if (conf_parser_ctx.pass == 2)
2167 adx 30 yy_aconf->port = $3;
2168     };
2169    
2170     connect_aftype: AFTYPE '=' T_IPV4 ';'
2171     {
2172 michael 967 if (conf_parser_ctx.pass == 2)
2173 adx 30 yy_aconf->aftype = AF_INET;
2174     } | AFTYPE '=' T_IPV6 ';'
2175     {
2176     #ifdef IPV6
2177 michael 967 if (conf_parser_ctx.pass == 2)
2178 adx 30 yy_aconf->aftype = AF_INET6;
2179     #endif
2180     };
2181    
2182     connect_flags: IRCD_FLAGS
2183     {
2184     } '=' connect_flags_items ';';
2185    
2186     connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2187 michael 1302 connect_flags_item: AUTOCONN
2188 adx 30 {
2189 michael 967 if (conf_parser_ctx.pass == 2)
2190 michael 1228 SetConfAllowAutoConn(yy_aconf);
2191 adx 30 } | BURST_AWAY
2192     {
2193 michael 967 if (conf_parser_ctx.pass == 2)
2194 michael 1228 SetConfAwayBurst(yy_aconf);
2195 adx 30 } | TOPICBURST
2196     {
2197 michael 967 if (conf_parser_ctx.pass == 2)
2198 michael 1228 SetConfTopicBurst(yy_aconf);
2199 michael 1303 } | T_SSL
2200     {
2201     if (conf_parser_ctx.pass == 2)
2202     SetConfSSL(yy_aconf);
2203 michael 1228 };
2204 adx 30
2205     connect_encrypted: ENCRYPTED '=' TBOOL ';'
2206     {
2207 michael 967 if (conf_parser_ctx.pass == 2)
2208 adx 30 {
2209     if (yylval.number)
2210     yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
2211     else
2212     yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED;
2213     }
2214     };
2215    
2216     connect_hub_mask: HUB_MASK '=' QSTRING ';'
2217     {
2218 michael 967 if (conf_parser_ctx.pass == 2)
2219 adx 30 {
2220 michael 1383 char *mask;
2221 adx 30
2222 michael 1383 DupString(mask, yylval.string);
2223     dlinkAdd(mask, make_dlink_node(), &yy_aconf->hub_list);
2224 adx 30 }
2225     };
2226    
2227     connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2228     {
2229 michael 967 if (conf_parser_ctx.pass == 2)
2230 adx 30 {
2231 michael 1383 char *mask;
2232 adx 30
2233 michael 1383 DupString(mask, yylval.string);
2234     dlinkAdd(mask, make_dlink_node(), &yy_aconf->leaf_list);
2235 adx 30 }
2236     };
2237    
2238     connect_class: CLASS '=' QSTRING ';'
2239     {
2240 michael 967 if (conf_parser_ctx.pass == 2)
2241 adx 30 {
2242     MyFree(class_name);
2243     DupString(class_name, yylval.string);
2244     }
2245     };
2246    
2247 michael 1306 connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2248     {
2249     #ifdef HAVE_LIBCRYPTO
2250     if (conf_parser_ctx.pass == 2)
2251     {
2252     MyFree(yy_aconf->cipher_list);
2253     DupString(yy_aconf->cipher_list, yylval.string);
2254     }
2255     #else
2256     if (conf_parser_ctx.pass == 2)
2257     yyerror("Ignoring connect::ciphers -- no OpenSSL support");
2258     #endif
2259     };
2260    
2261    
2262 adx 30 /***************************************************************************
2263     * section kill
2264     ***************************************************************************/
2265     kill_entry: KILL
2266     {
2267 michael 967 if (conf_parser_ctx.pass == 2)
2268 adx 30 {
2269     userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2270     regex_ban = 0;
2271     }
2272     } '{' kill_items '}' ';'
2273     {
2274 michael 967 if (conf_parser_ctx.pass == 2)
2275 adx 30 {
2276     if (userbuf[0] && hostbuf[0])
2277     {
2278     if (regex_ban)
2279     {
2280 michael 1009 #ifdef HAVE_LIBPCRE
2281     void *exp_user = NULL;
2282     void *exp_host = NULL;
2283 adx 30 const char *errptr = NULL;
2284    
2285     if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2286     !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2287     {
2288 michael 1247 ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2289 michael 595 errptr);
2290 adx 30 break;
2291     }
2292    
2293 michael 1005 yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE));
2294 adx 30 yy_aconf->regexuser = exp_user;
2295     yy_aconf->regexhost = exp_host;
2296    
2297     DupString(yy_aconf->user, userbuf);
2298     DupString(yy_aconf->host, hostbuf);
2299    
2300     if (reasonbuf[0])
2301     DupString(yy_aconf->reason, reasonbuf);
2302     else
2303     DupString(yy_aconf->reason, "No reason");
2304 michael 1009 #else
2305 michael 1247 ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2306 michael 1009 break;
2307     #endif
2308 adx 30 }
2309     else
2310     {
2311 michael 1369 find_and_delete_temporary(userbuf, hostbuf, CONF_KLINE);
2312    
2313 michael 1005 yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2314 adx 30
2315     DupString(yy_aconf->user, userbuf);
2316     DupString(yy_aconf->host, hostbuf);
2317    
2318     if (reasonbuf[0])
2319     DupString(yy_aconf->reason, reasonbuf);
2320     else
2321     DupString(yy_aconf->reason, "No reason");
2322 michael 1369 add_conf_by_address(CONF_KLINE, yy_aconf);
2323 adx 30 }
2324     }
2325    
2326     yy_aconf = NULL;
2327     }
2328     };
2329    
2330     kill_type: TYPE
2331     {
2332     } '=' kill_type_items ';';
2333    
2334     kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2335     kill_type_item: REGEX_T
2336     {
2337 michael 967 if (conf_parser_ctx.pass == 2)
2338 adx 30 regex_ban = 1;
2339     };
2340    
2341     kill_items: kill_items kill_item | kill_item;
2342     kill_item: kill_user | kill_reason | kill_type | error;
2343    
2344     kill_user: USER '=' QSTRING ';'
2345     {
2346 michael 967 if (conf_parser_ctx.pass == 2)
2347 adx 30 {
2348 michael 593 struct split_nuh_item nuh;
2349 adx 30
2350 michael 593 nuh.nuhmask = yylval.string;
2351     nuh.nickptr = NULL;
2352     nuh.userptr = userbuf;
2353     nuh.hostptr = hostbuf;
2354 adx 30
2355 michael 593 nuh.nicksize = 0;
2356     nuh.usersize = sizeof(userbuf);
2357     nuh.hostsize = sizeof(hostbuf);
2358 adx 30
2359 michael 593 split_nuh(&nuh);
2360 adx 30 }
2361     };
2362    
2363     kill_reason: REASON '=' QSTRING ';'
2364     {
2365 michael 967 if (conf_parser_ctx.pass == 2)
2366 adx 30 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2367     };
2368    
2369     /***************************************************************************
2370     * section deny
2371     ***************************************************************************/
2372     deny_entry: DENY
2373     {
2374 michael 967 if (conf_parser_ctx.pass == 2)
2375 michael 1005 hostbuf[0] = reasonbuf[0] = '\0';
2376 adx 30 } '{' deny_items '}' ';'
2377     {
2378 michael 967 if (conf_parser_ctx.pass == 2)
2379 adx 30 {
2380 michael 1005 if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
2381     {
2382 michael 1369 find_and_delete_temporary(NULL, hostbuf, CONF_DLINE);
2383    
2384 michael 1005 yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2385     DupString(yy_aconf->host, hostbuf);
2386    
2387     if (reasonbuf[0])
2388     DupString(yy_aconf->reason, reasonbuf);
2389     else
2390     DupString(yy_aconf->reason, "No reason");
2391 adx 30 add_conf_by_address(CONF_DLINE, yy_aconf);
2392 michael 1005 yy_aconf = NULL;
2393     }
2394 adx 30 }
2395     };
2396    
2397     deny_items: deny_items deny_item | deny_item;
2398     deny_item: deny_ip | deny_reason | error;
2399    
2400     deny_ip: IP '=' QSTRING ';'
2401     {
2402 michael 967 if (conf_parser_ctx.pass == 2)
2403 michael 1005 strlcpy(hostbuf, yylval.string, sizeof(hostbuf));
2404 adx 30 };
2405    
2406     deny_reason: REASON '=' QSTRING ';'
2407     {
2408 michael 967 if (conf_parser_ctx.pass == 2)
2409 michael 1005 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2410 adx 30 };
2411    
2412     /***************************************************************************
2413     * section exempt
2414     ***************************************************************************/
2415     exempt_entry: EXEMPT '{' exempt_items '}' ';';
2416    
2417     exempt_items: exempt_items exempt_item | exempt_item;
2418     exempt_item: exempt_ip | error;
2419    
2420     exempt_ip: IP '=' QSTRING ';'
2421     {
2422 michael 967 if (conf_parser_ctx.pass == 2)
2423 adx 30 {
2424     if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2425     {
2426 michael 1005 yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE));
2427 adx 30 DupString(yy_aconf->host, yylval.string);
2428    
2429     add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
2430     yy_aconf = NULL;
2431     }
2432     }
2433     };
2434    
2435     /***************************************************************************
2436     * section gecos
2437     ***************************************************************************/
2438     gecos_entry: GECOS
2439     {
2440 michael 967 if (conf_parser_ctx.pass == 2)
2441 adx 30 {
2442     regex_ban = 0;
2443     reasonbuf[0] = gecos_name[0] = '\0';
2444     }
2445     } '{' gecos_items '}' ';'
2446     {
2447 michael 967 if (conf_parser_ctx.pass == 2)
2448 adx 30 {
2449     if (gecos_name[0])
2450     {
2451     if (regex_ban)
2452     {
2453 michael 1009 #ifdef HAVE_LIBPCRE
2454     void *exp_p = NULL;
2455 adx 30 const char *errptr = NULL;
2456    
2457     if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2458     {
2459 michael 1247 ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2460 michael 595 errptr);
2461 adx 30 break;
2462     }
2463    
2464     yy_conf = make_conf_item(RXLINE_TYPE);
2465     yy_conf->regexpname = exp_p;
2466 michael 1009 #else
2467 michael 1247 ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2468 michael 1009 break;
2469     #endif
2470 adx 30 }
2471     else
2472     yy_conf = make_conf_item(XLINE_TYPE);
2473    
2474     yy_match_item = map_to_conf(yy_conf);
2475     DupString(yy_conf->name, gecos_name);
2476    
2477     if (reasonbuf[0])
2478     DupString(yy_match_item->reason, reasonbuf);
2479     else
2480     DupString(yy_match_item->reason, "No reason");
2481     }
2482     }
2483     };
2484    
2485     gecos_flags: TYPE
2486     {
2487     } '=' gecos_flags_items ';';
2488    
2489     gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2490     gecos_flags_item: REGEX_T
2491     {
2492 michael 967 if (conf_parser_ctx.pass == 2)
2493 adx 30 regex_ban = 1;
2494     };
2495    
2496     gecos_items: gecos_items gecos_item | gecos_item;
2497     gecos_item: gecos_name | gecos_reason | gecos_flags | error;
2498    
2499     gecos_name: NAME '=' QSTRING ';'
2500     {
2501 michael 967 if (conf_parser_ctx.pass == 2)
2502 adx 30 strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
2503     };
2504    
2505     gecos_reason: REASON '=' QSTRING ';'
2506     {
2507 michael 967 if (conf_parser_ctx.pass == 2)
2508 adx 30 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2509     };
2510    
2511     /***************************************************************************
2512     * section general
2513     ***************************************************************************/
2514     general_entry: GENERAL
2515     '{' general_items '}' ';';
2516    
2517     general_items: general_items general_item | general_item;
2518     general_item: general_hide_spoof_ips | general_ignore_bogus_ts |
2519     general_failed_oper_notice | general_anti_nick_flood |
2520     general_max_nick_time | general_max_nick_changes |
2521     general_max_accept | general_anti_spam_exit_message_time |
2522     general_ts_warn_delta | general_ts_max_delta |
2523     general_kill_chase_time_limit | general_kline_with_reason |
2524     general_kline_reason | general_invisible_on_connect |
2525     general_warn_no_nline | general_dots_in_ident |
2526     general_stats_o_oper_only | general_stats_k_oper_only |
2527     general_pace_wait | general_stats_i_oper_only |
2528     general_pace_wait_simple | general_stats_P_oper_only |
2529     general_short_motd | general_no_oper_flood |
2530     general_true_no_oper_flood | general_oper_pass_resv |
2531 michael 1176 general_message_locale |
2532 adx 30 general_oper_only_umodes | general_max_targets |
2533     general_use_egd | general_egdpool_path |
2534     general_oper_umodes | general_caller_id_wait |
2535     general_opers_bypass_callerid | general_default_floodcount |
2536     general_min_nonwildcard | general_min_nonwildcard_simple |
2537 michael 1302 general_disable_remote_commands |
2538     general_client_flood |
2539 adx 30 general_throttle_time | general_havent_read_conf |
2540 michael 1072 general_ping_cookie |
2541 michael 1264 general_disable_auth |
2542 adx 30 general_tkline_expire_notices | general_gline_min_cidr |
2543     general_gline_min_cidr6 | general_use_whois_actually |
2544 michael 584 general_reject_hold_time | general_stats_e_disabled |
2545 michael 1176 general_max_watch | general_services_name |
2546 adx 30 error;
2547    
2548    
2549 michael 876 general_max_watch: MAX_WATCH '=' NUMBER ';'
2550     {
2551     ConfigFileEntry.max_watch = $3;
2552     };
2553 adx 30
2554     general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2555     {
2556     ConfigFileEntry.gline_min_cidr = $3;
2557     };
2558    
2559     general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2560     {
2561     ConfigFileEntry.gline_min_cidr6 = $3;
2562     };
2563    
2564     general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2565     {
2566     ConfigFileEntry.use_whois_actually = yylval.number;
2567     };
2568    
2569     general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';'
2570     {
2571     GlobalSetOptions.rejecttime = yylval.number;
2572     };
2573    
2574     general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2575     {
2576     ConfigFileEntry.tkline_expire_notices = yylval.number;
2577     };
2578    
2579 michael 1074 general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2580 adx 30 {
2581     ConfigFileEntry.kill_chase_time_limit = $3;
2582     };
2583    
2584     general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2585     {
2586     ConfigFileEntry.hide_spoof_ips = yylval.number;
2587     };
2588    
2589     general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2590     {
2591     ConfigFileEntry.ignore_bogus_ts = yylval.number;
2592     };
2593    
2594     general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2595     {
2596     ConfigFileEntry.disable_remote = yylval.number;
2597     };
2598    
2599     general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2600     {
2601     ConfigFileEntry.failed_oper_notice = yylval.number;
2602     };
2603    
2604     general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2605     {
2606     ConfigFileEntry.anti_nick_flood = yylval.number;
2607     };
2608    
2609     general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2610     {
2611     ConfigFileEntry.max_nick_time = $3;
2612     };
2613    
2614     general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2615     {
2616     ConfigFileEntry.max_nick_changes = $3;
2617     };
2618    
2619     general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2620     {
2621     ConfigFileEntry.max_accept = $3;
2622     };
2623    
2624     general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2625     {
2626     ConfigFileEntry.anti_spam_exit_message_time = $3;
2627     };
2628    
2629     general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2630     {
2631     ConfigFileEntry.ts_warn_delta = $3;
2632     };
2633    
2634     general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2635     {
2636 michael 967 if (conf_parser_ctx.pass == 2)
2637 adx 30 ConfigFileEntry.ts_max_delta = $3;
2638     };
2639    
2640     general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2641     {
2642 michael 967 if (($3 > 0) && conf_parser_ctx.pass == 1)
2643 adx 30 {
2644 michael 1247 ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2645     ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2646     ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2647 adx 30 exit(0);
2648     }
2649     };
2650    
2651     general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
2652     {
2653     ConfigFileEntry.kline_with_reason = yylval.number;
2654     };
2655    
2656     general_kline_reason: KLINE_REASON '=' QSTRING ';'
2657     {
2658 michael 967 if (conf_parser_ctx.pass == 2)
2659 adx 30 {
2660     MyFree(ConfigFileEntry.kline_reason);
2661     DupString(ConfigFileEntry.kline_reason, yylval.string);
2662     }
2663     };
2664    
2665     general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2666     {
2667     ConfigFileEntry.invisible_on_connect = yylval.number;
2668     };
2669    
2670     general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';'
2671     {
2672     ConfigFileEntry.warn_no_nline = yylval.number;
2673     };
2674    
2675 michael 584 general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2676     {
2677     ConfigFileEntry.stats_e_disabled = yylval.number;
2678     };
2679    
2680 adx 30 general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2681     {
2682     ConfigFileEntry.stats_o_oper_only = yylval.number;
2683     };
2684    
2685     general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2686     {
2687     ConfigFileEntry.stats_P_oper_only = yylval.number;
2688     };
2689    
2690     general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2691     {
2692     ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2693     } | STATS_K_OPER_ONLY '=' TMASKED ';'
2694     {
2695     ConfigFileEntry.stats_k_oper_only = 1;
2696     };
2697    
2698     general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2699     {
2700     ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2701     } | STATS_I_OPER_ONLY '=' TMASKED ';'
2702     {
2703     ConfigFileEntry.stats_i_oper_only = 1;
2704     };
2705    
2706     general_pace_wait: PACE_WAIT '=' timespec ';'
2707     {
2708     ConfigFileEntry.pace_wait = $3;
2709     };
2710    
2711     general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2712     {
2713     ConfigFileEntry.caller_id_wait = $3;
2714     };
2715    
2716     general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2717     {
2718     ConfigFileEntry.opers_bypass_callerid = yylval.number;
2719     };
2720    
2721     general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2722     {
2723     ConfigFileEntry.pace_wait_simple = $3;
2724     };
2725    
2726     general_short_motd: SHORT_MOTD '=' TBOOL ';'
2727     {
2728     ConfigFileEntry.short_motd = yylval.number;
2729     };
2730    
2731     general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2732     {
2733     ConfigFileEntry.no_oper_flood = yylval.number;
2734     };
2735    
2736     general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2737     {
2738     ConfigFileEntry.true_no_oper_flood = yylval.number;
2739     };
2740    
2741     general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2742     {
2743     ConfigFileEntry.oper_pass_resv = yylval.number;
2744     };
2745    
2746     general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
2747     {
2748 michael 967 if (conf_parser_ctx.pass == 2)
2749 adx 30 {
2750     if (strlen(yylval.string) > LOCALE_LENGTH-2)
2751     yylval.string[LOCALE_LENGTH-1] = '\0';
2752    
2753     set_locale(yylval.string);
2754     }
2755     };
2756    
2757     general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2758     {
2759     ConfigFileEntry.dots_in_ident = $3;
2760     };
2761    
2762     general_max_targets: MAX_TARGETS '=' NUMBER ';'
2763     {
2764     ConfigFileEntry.max_targets = $3;
2765     };
2766    
2767     general_use_egd: USE_EGD '=' TBOOL ';'
2768     {
2769     ConfigFileEntry.use_egd = yylval.number;
2770     };
2771    
2772     general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2773     {
2774 michael 967 if (conf_parser_ctx.pass == 2)
2775 adx 30 {
2776     MyFree(ConfigFileEntry.egdpool_path);
2777     DupString(ConfigFileEntry.egdpool_path, yylval.string);
2778     }
2779     };
2780    
2781 michael 1176 general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2782 michael 1157 {
2783 michael 1176 if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2784 michael 1157 {
2785     MyFree(ConfigFileEntry.service_name);
2786     DupString(ConfigFileEntry.service_name, yylval.string);
2787     }
2788     };
2789    
2790 adx 30 general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2791     {
2792     ConfigFileEntry.ping_cookie = yylval.number;
2793     };
2794    
2795     general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2796     {
2797     ConfigFileEntry.disable_auth = yylval.number;
2798     };
2799    
2800     general_throttle_time: THROTTLE_TIME '=' timespec ';'
2801     {
2802     ConfigFileEntry.throttle_time = yylval.number;
2803     };
2804    
2805     general_oper_umodes: OPER_UMODES
2806     {
2807     ConfigFileEntry.oper_umodes = 0;
2808     } '=' umode_oitems ';' ;
2809    
2810     umode_oitems: umode_oitems ',' umode_oitem | umode_oitem;
2811     umode_oitem: T_BOTS
2812     {
2813     ConfigFileEntry.oper_umodes |= UMODE_BOTS;
2814     } | T_CCONN
2815     {
2816     ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2817 db 849 } | T_CCONN_FULL
2818     {
2819     ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
2820 adx 30 } | T_DEAF
2821     {
2822     ConfigFileEntry.oper_umodes |= UMODE_DEAF;
2823     } | T_DEBUG
2824     {
2825     ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
2826     } | T_FULL
2827     {
2828     ConfigFileEntry.oper_umodes |= UMODE_FULL;
2829 michael 1294 } | HIDDEN
2830     {
2831     ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2832 adx 30 } | T_SKILL
2833     {
2834     ConfigFileEntry.oper_umodes |= UMODE_SKILL;
2835     } | T_NCHANGE
2836     {
2837     ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
2838     } | T_REJ
2839     {
2840     ConfigFileEntry.oper_umodes |= UMODE_REJ;
2841     } | T_UNAUTH
2842     {
2843     ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
2844     } | T_SPY
2845     {
2846     ConfigFileEntry.oper_umodes |= UMODE_SPY;
2847     } | T_EXTERNAL
2848     {
2849     ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
2850     } | T_OPERWALL
2851     {
2852     ConfigFileEntry.oper_umodes |= UMODE_OPERWALL;
2853     } | T_SERVNOTICE
2854     {
2855     ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
2856     } | T_INVISIBLE
2857     {
2858     ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
2859     } | T_WALLOP
2860     {
2861     ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
2862     } | T_SOFTCALLERID
2863     {
2864     ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
2865     } | T_CALLERID
2866     {
2867     ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
2868     } | T_LOCOPS
2869     {
2870     ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2871     };
2872    
2873     general_oper_only_umodes: OPER_ONLY_UMODES
2874     {
2875     ConfigFileEntry.oper_only_umodes = 0;
2876     } '=' umode_items ';' ;
2877    
2878     umode_items: umode_items ',' umode_item | umode_item;
2879     umode_item: T_BOTS
2880     {
2881     ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2882     } | T_CCONN
2883     {
2884     ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2885 db 853 } | T_CCONN_FULL
2886     {
2887     ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
2888 adx 30 } | T_DEAF
2889     {
2890     ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
2891     } | T_DEBUG
2892     {
2893     ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2894     } | T_FULL
2895     {
2896     ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2897     } | T_SKILL
2898     {
2899     ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2900 michael 1294 } | HIDDEN
2901     {
2902     ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
2903 adx 30 } | T_NCHANGE
2904     {
2905     ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
2906     } | T_REJ
2907     {
2908     ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
2909     } | T_UNAUTH
2910     {
2911     ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
2912     } | T_SPY
2913     {
2914     ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
2915     } | T_EXTERNAL
2916     {
2917     ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
2918     } | T_OPERWALL
2919     {
2920     ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL;
2921     } | T_SERVNOTICE
2922     {
2923     ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
2924     } | T_INVISIBLE
2925     {
2926     ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
2927     } | T_WALLOP
2928     {
2929     ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
2930     } | T_SOFTCALLERID
2931     {
2932     ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
2933     } | T_CALLERID
2934     {
2935     ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
2936     } | T_LOCOPS
2937     {
2938     ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
2939     };
2940    
2941     general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2942     {
2943     ConfigFileEntry.min_nonwildcard = $3;
2944     };
2945    
2946     general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2947     {
2948     ConfigFileEntry.min_nonwildcard_simple = $3;
2949     };
2950    
2951     general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2952     {
2953     ConfigFileEntry.default_floodcount = $3;
2954     };
2955    
2956     general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
2957     {
2958     ConfigFileEntry.client_flood = $3;
2959     };
2960    
2961    
2962     /***************************************************************************
2963     * section glines
2964     ***************************************************************************/
2965     gline_entry: GLINES
2966     {
2967 michael 967 if (conf_parser_ctx.pass == 2)
2968 adx 30 {
2969     yy_conf = make_conf_item(GDENY_TYPE);
2970 michael 102 yy_aconf = map_to_conf(yy_conf);
2971 adx 30 }
2972     } '{' gline_items '}' ';'
2973     {
2974 michael 967 if (conf_parser_ctx.pass == 2)
2975 adx 30 {
2976     /*
2977     * since we re-allocate yy_conf/yy_aconf after the end of action=, at the
2978     * end we will have one extra, so we should free it.
2979     */
2980 michael 102 if (yy_conf->name == NULL || yy_aconf->user == NULL)
2981 adx 30 {
2982 michael 102 delete_conf_item(yy_conf);
2983 adx 30 yy_conf = NULL;
2984     yy_aconf = NULL;
2985     }
2986     }
2987     };
2988    
2989     gline_items: gline_items gline_item | gline_item;
2990     gline_item: gline_enable |
2991     gline_duration |
2992     gline_logging |
2993     gline_user |
2994     gline_server |
2995     gline_action |
2996     error;
2997    
2998     gline_enable: ENABLE '=' TBOOL ';'
2999     {
3000 michael 967 if (conf_parser_ctx.pass == 2)
3001 adx 30 ConfigFileEntry.glines = yylval.number;
3002     };
3003    
3004     gline_duration: DURATION '=' timespec ';'
3005     {
3006 michael 967 if (conf_parser_ctx.pass == 2)
3007 adx 30 ConfigFileEntry.gline_time = $3;
3008     };
3009    
3010 michael 1247 gline_logging: T_LOG
3011 adx 30 {
3012 michael 967 if (conf_parser_ctx.pass == 2)
3013 adx 30 ConfigFileEntry.gline_logging = 0;
3014     } '=' gline_logging_types ';';
3015     gline_logging_types: gline_logging_types ',' gline_logging_type_item | gline_logging_type_item;
3016     gline_logging_type_item: T_REJECT
3017     {
3018 michael 967 if (conf_parser_ctx.pass == 2)
3019 adx 30 ConfigFileEntry.gline_logging |= GDENY_REJECT;
3020     } | T_BLOCK
3021     {
3022 michael 967 if (conf_parser_ctx.pass == 2)
3023 adx 30 ConfigFileEntry.gline_logging |= GDENY_BLOCK;
3024     };
3025    
3026     gline_user: USER '=' QSTRING ';'
3027     {
3028 michael 967 if (conf_parser_ctx.pass == 2)
3029 adx 30 {
3030 michael 593 struct split_nuh_item nuh;
3031 adx 30
3032 michael 593 nuh.nuhmask = yylval.string;
3033     nuh.nickptr = NULL;
3034     nuh.userptr = userbuf;
3035     nuh.hostptr = hostbuf;
3036    
3037     nuh.nicksize = 0;
3038     nuh.usersize = sizeof(userbuf);
3039     nuh.hostsize = sizeof(hostbuf);
3040    
3041     split_nuh(&nuh);
3042    
3043 adx 30 if (yy_aconf->user == NULL)
3044     {
3045 michael 593 DupString(yy_aconf->user, userbuf);
3046     DupString(yy_aconf->host, hostbuf);
3047 adx 30 }
3048     else
3049     {
3050 michael 593 struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
3051    
3052     DupString(yy_tmp->user, userbuf);
3053     DupString(yy_tmp->host, hostbuf);
3054    
3055 adx 30 dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
3056     }
3057     }
3058     };
3059    
3060     gline_server: NAME '=' QSTRING ';'
3061     {
3062 michael 967 if (conf_parser_ctx.pass == 2)
3063 adx 30 {
3064     MyFree(yy_conf->name);
3065     DupString(yy_conf->name, yylval.string);
3066     }
3067     };
3068    
3069     gline_action: ACTION
3070     {
3071 michael 967 if (conf_parser_ctx.pass == 2)
3072 adx 30 yy_aconf->flags = 0;
3073     } '=' gdeny_types ';'
3074     {
3075 michael 967 if (conf_parser_ctx.pass == 2)
3076 adx 30 {
3077 michael 102 struct CollectItem *yy_tmp = NULL;
3078 adx 30 dlink_node *ptr, *next_ptr;
3079    
3080     DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
3081     {
3082     struct AccessItem *new_aconf;
3083     struct ConfItem *new_conf;
3084    
3085     yy_tmp = ptr->data;
3086     new_conf = make_conf_item(GDENY_TYPE);
3087 michael 102 new_aconf = map_to_conf(new_conf);
3088 adx 30
3089     new_aconf->flags = yy_aconf->flags;
3090    
3091     if (yy_conf->name != NULL)
3092     DupString(new_conf->name, yy_conf->name);
3093     else
3094     DupString(new_conf->name, "*");
3095     if (yy_aconf->user != NULL)
3096     DupString(new_aconf->user, yy_tmp->user);
3097     else
3098     DupString(new_aconf->user, "*");
3099     if (yy_aconf->host != NULL)
3100     DupString(new_aconf->host, yy_tmp->host);
3101     else
3102     DupString(new_aconf->host, "*");
3103    
3104     dlinkDelete(&yy_tmp->node, &col_conf_list);
3105     }
3106 michael 102
3107     /*
3108     * In case someone has fed us with more than one action= after user/name
3109     * which would leak memory -Michael
3110     */
3111     if (yy_conf->name == NULL || yy_aconf->user == NULL)
3112     delete_conf_item(yy_conf);
3113    
3114     yy_conf = make_conf_item(GDENY_TYPE);
3115     yy_aconf = map_to_conf(yy_conf);
3116 adx 30 }
3117     };
3118    
3119     gdeny_types: gdeny_types ',' gdeny_type_item | gdeny_type_item;
3120     gdeny_type_item: T_REJECT
3121     {
3122 michael 967 if (conf_parser_ctx.pass == 2)
3123 adx 30 yy_aconf->flags |= GDENY_REJECT;
3124     } | T_BLOCK
3125     {
3126 michael 967 if (conf_parser_ctx.pass == 2)
3127 adx 30 yy_aconf->flags |= GDENY_BLOCK;
3128     };
3129    
3130     /***************************************************************************
3131     * section channel
3132     ***************************************************************************/
3133     channel_entry: CHANNEL
3134     '{' channel_items '}' ';';
3135    
3136     channel_items: channel_items channel_item | channel_item;
3137     channel_item: channel_disable_local_channels | channel_use_except |
3138     channel_use_invex | channel_use_knock |
3139     channel_max_bans | channel_knock_delay |
3140 adx 201 channel_knock_delay_channel | channel_max_chans_per_user |
3141     channel_quiet_on_ban | channel_default_split_user_count |
3142     channel_default_split_server_count |
3143     channel_no_create_on_split | channel_restrict_channels |
3144     channel_no_join_on_split | channel_burst_topicwho |
3145     channel_jflood_count | channel_jflood_time |
3146 michael 632 channel_disable_fake_channels | error;
3147 adx 30
3148 michael 632 channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
3149     {
3150     ConfigChannel.disable_fake_channels = yylval.number;
3151     };
3152    
3153 adx 30 channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3154     {
3155     ConfigChannel.restrict_channels = yylval.number;
3156     };
3157    
3158     channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
3159     {
3160     ConfigChannel.disable_local_channels = yylval.number;
3161     };
3162    
3163     channel_use_except: USE_EXCEPT '=' TBOOL ';'
3164     {
3165     ConfigChannel.use_except = yylval.number;
3166     };
3167    
3168     channel_use_invex: USE_INVEX '=' TBOOL ';'
3169     {
3170     ConfigChannel.use_invex = yylval.number;
3171     };
3172    
3173     channel_use_knock: USE_KNOCK '=' TBOOL ';'
3174     {
3175     ConfigChannel.use_knock = yylval.number;
3176     };
3177    
3178     channel_knock_delay: KNOCK_DELAY '=' timespec ';'
3179     {
3180     ConfigChannel.knock_delay = $3;
3181     };
3182    
3183     channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
3184     {
3185     ConfigChannel.knock_delay_channel = $3;
3186     };
3187    
3188     channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3189     {
3190     ConfigChannel.max_chans_per_user = $3;
3191     };
3192    
3193     channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
3194     {
3195     ConfigChannel.quiet_on_ban = yylval.number;
3196     };
3197    
3198     channel_max_bans: MAX_BANS '=' NUMBER ';'
3199     {
3200     ConfigChannel.max_bans = $3;
3201     };
3202    
3203     channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
3204     {
3205     ConfigChannel.default_split_user_count = $3;
3206     };
3207    
3208     channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
3209     {
3210     ConfigChannel.default_split_server_count = $3;
3211     };
3212    
3213     channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
3214     {
3215     ConfigChannel.no_create_on_split = yylval.number;
3216     };
3217    
3218     channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
3219     {
3220     ConfigChannel.no_join_on_split = yylval.number;
3221     };
3222    
3223     channel_burst_topicwho: BURST_TOPICWHO '=' TBOOL ';'
3224     {
3225     ConfigChannel.burst_topicwho = yylval.number;
3226     };
3227    
3228     channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3229     {
3230     GlobalSetOptions.joinfloodcount = yylval.number;
3231     };
3232    
3233     channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
3234     {
3235     GlobalSetOptions.joinfloodtime = yylval.number;
3236     };
3237    
3238     /***************************************************************************
3239     * section serverhide
3240     ***************************************************************************/
3241     serverhide_entry: SERVERHIDE
3242     '{' serverhide_items '}' ';';
3243    
3244     serverhide_items: serverhide_items serverhide_item | serverhide_item;
3245     serverhide_item: serverhide_flatten_links | serverhide_hide_servers |
3246     serverhide_links_delay |
3247     serverhide_disable_hidden |
3248     serverhide_hidden | serverhide_hidden_name |
3249     serverhide_hide_server_ips |
3250     error;
3251    
3252     serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3253     {
3254 michael 967 if (conf_parser_ctx.pass == 2)
3255 adx 30 ConfigServerHide.flatten_links = yylval.number;
3256     };
3257    
3258     serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3259     {
3260 michael 967 if (conf_parser_ctx.pass == 2)
3261 adx 30 ConfigServerHide.hide_servers = yylval.number;
3262     };
3263    
3264     serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3265     {
3266 michael 967 if (conf_parser_ctx.pass == 2)
3267 adx 30 {
3268     MyFree(ConfigServerHide.hidden_name);
3269     DupString(ConfigServerHide.hidden_name, yylval.string);
3270     }
3271     };
3272    
3273     serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3274     {
3275 michael 967 if (conf_parser_ctx.pass == 2)
3276 adx 30 {
3277     if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3278     {
3279     eventAddIsh("write_links_file", write_links_file, NULL, $3);
3280     ConfigServerHide.links_disabled = 0;
3281     }
3282    
3283     ConfigServerHide.links_delay = $3;
3284     }
3285     };
3286    
3287     serverhide_hidden: HIDDEN '=' TBOOL ';'
3288     {
3289 michael 967 if (conf_parser_ctx.pass == 2)
3290 adx 30 ConfigServerHide.hidden = yylval.number;
3291     };
3292    
3293     serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3294     {
3295 michael 967 if (conf_parser_ctx.pass == 2)
3296 adx 30 ConfigServerHide.disable_hidden = yylval.number;
3297     };
3298    
3299     serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3300     {
3301 michael 967 if (conf_parser_ctx.pass == 2)
3302 adx 30 ConfigServerHide.hide_server_ips = yylval.number;
3303     };

Properties

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