ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1401
Committed: Tue May 8 18:58:13 2012 UTC (11 years, 11 months ago) by michael
Original Path: ircd-hybrid-8/src/conf_parser.y
File size: 78321 byte(s)
Log Message:
o) Removed channel::burst_topicwho configuration option. Topicsetters are
   now sent by default

File Contents

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

Properties

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