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

Properties

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