ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1460
Committed: Fri Jul 6 14:32:53 2012 UTC (11 years, 8 months ago) by michael
Original Path: ircd-hybrid-8/src/conf_parser.y
File size: 75156 byte(s)
Log Message:
- Added 'set' to operator privilege flags. Gives access to the "SET" command

File Contents

# User Rev Content
1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 michael 1309 * conf_parser.y: Parses the ircd configuration file.
4 adx 30 *
5     * Copyright (C) 2005 by the past and present ircd coders, and others.
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20     * USA
21     *
22 knight 31 * $Id$
23 adx 30 */
24    
25     %{
26    
27     #define YY_NO_UNPUT
28     #include <sys/types.h>
29 stu 909 #include <string.h>
30 adx 30
31 michael 1009 #include "config.h"
32 adx 30 #include "stdinc.h"
33     #include "ircd.h"
34     #include "list.h"
35 michael 1309 #include "conf.h"
36 adx 30 #include "event.h"
37 michael 1309 #include "log.h"
38 adx 30 #include "client.h" /* for UMODE_ALL only */
39     #include "irc_string.h"
40     #include "sprintf_irc.h"
41     #include "memory.h"
42     #include "modules.h"
43 michael 885 #include "s_serv.h"
44 adx 30 #include "hostmask.h"
45     #include "send.h"
46     #include "listener.h"
47     #include "resv.h"
48     #include "numeric.h"
49     #include "s_user.h"
50    
51     #ifdef HAVE_LIBCRYPTO
52     #include <openssl/rsa.h>
53     #include <openssl/bio.h>
54     #include <openssl/pem.h>
55 michael 1306 #include <openssl/dh.h>
56 adx 30 #endif
57    
58 michael 1329 int yylex(void);
59    
60 adx 30 static char *class_name = NULL;
61     static struct ConfItem *yy_conf = NULL;
62     static struct AccessItem *yy_aconf = NULL;
63     static struct MatchItem *yy_match_item = NULL;
64     static struct ClassItem *yy_class = NULL;
65     static char *yy_class_name = NULL;
66    
67     static dlink_list col_conf_list = { NULL, NULL, 0 };
68     static unsigned int listener_flags = 0;
69     static unsigned int regex_ban = 0;
70     static char userbuf[IRCD_BUFSIZE];
71     static char hostbuf[IRCD_BUFSIZE];
72     static char reasonbuf[REASONLEN + 1];
73     static char gecos_name[REALLEN * 4];
74 michael 1247 static char lfile[IRCD_BUFSIZE];
75     static unsigned int ltype = 0;
76     static unsigned int lsize = 0;
77 adx 30 static char *resv_reason = NULL;
78     static char *listener_address = NULL;
79    
80 michael 593 struct CollectItem
81     {
82 adx 30 dlink_node node;
83     char *name;
84     char *user;
85     char *host;
86     char *passwd;
87     int port;
88     int flags;
89     #ifdef HAVE_LIBCRYPTO
90     char *rsa_public_key_file;
91     RSA *rsa_public_key;
92     #endif
93     };
94    
95     static void
96     free_collect_item(struct CollectItem *item)
97     {
98     MyFree(item->name);
99     MyFree(item->user);
100     MyFree(item->host);
101     MyFree(item->passwd);
102     #ifdef HAVE_LIBCRYPTO
103     MyFree(item->rsa_public_key_file);
104     #endif
105     MyFree(item);
106     }
107    
108     %}
109    
110     %union {
111     int number;
112     char *string;
113     }
114    
115     %token ACCEPT_PASSWORD
116     %token ACTION
117     %token ADMIN
118     %token AFTYPE
119     %token T_ALLOW
120     %token ANTI_NICK_FLOOD
121     %token ANTI_SPAM_EXIT_MESSAGE_TIME
122     %token AUTOCONN
123     %token T_BLOCK
124     %token BURST_AWAY
125     %token BYTES KBYTES MBYTES GBYTES TBYTES
126     %token CALLER_ID_WAIT
127     %token CAN_FLOOD
128     %token CHANNEL
129     %token CIDR_BITLEN_IPV4
130     %token CIDR_BITLEN_IPV6
131     %token CLASS
132     %token CONNECT
133     %token CONNECTFREQ
134     %token DEFAULT_FLOODCOUNT
135     %token DEFAULT_SPLIT_SERVER_COUNT
136     %token DEFAULT_SPLIT_USER_COUNT
137     %token DENY
138     %token DESCRIPTION
139     %token DIE
140     %token DISABLE_AUTH
141 michael 632 %token DISABLE_FAKE_CHANNELS
142 adx 30 %token DISABLE_HIDDEN
143     %token DISABLE_LOCAL_CHANNELS
144     %token DISABLE_REMOTE_COMMANDS
145     %token DOTS_IN_IDENT
146     %token DURATION
147     %token EGDPOOL_PATH
148     %token EMAIL
149     %token ENABLE
150     %token ENCRYPTED
151     %token EXCEED_LIMIT
152     %token EXEMPT
153     %token FAILED_OPER_NOTICE
154     %token IRCD_FLAGS
155     %token FLATTEN_LINKS
156     %token GECOS
157     %token GENERAL
158     %token GLINE
159 michael 1459 %token GLINE_DURATION
160     %token GLINE_ENABLE
161 adx 30 %token GLINE_EXEMPT
162     %token GLINE_TIME
163 michael 1459 %token GLINE_REQUEST_DURATION
164 adx 30 %token GLINE_MIN_CIDR
165     %token GLINE_MIN_CIDR6
166     %token GLOBAL_KILL
167     %token IRCD_AUTH
168     %token NEED_IDENT
169     %token HAVENT_READ_CONF
170     %token HIDDEN
171     %token HIDDEN_NAME
172     %token HIDE_SERVER_IPS
173     %token HIDE_SERVERS
174     %token HIDE_SPOOF_IPS
175     %token HOST
176     %token HUB
177     %token HUB_MASK
178     %token IGNORE_BOGUS_TS
179     %token INVISIBLE_ON_CONNECT
180     %token IP
181     %token KILL
182     %token KILL_CHASE_TIME_LIMIT
183     %token KLINE
184     %token KLINE_EXEMPT
185     %token KLINE_REASON
186     %token KLINE_WITH_REASON
187     %token KNOCK_DELAY
188     %token KNOCK_DELAY_CHANNEL
189     %token LEAF_MASK
190     %token LINKS_DELAY
191     %token LISTEN
192     %token T_LOG
193     %token MAX_ACCEPT
194     %token MAX_BANS
195 michael 1432 %token MAX_CHANS_PER_OPER
196 adx 30 %token MAX_CHANS_PER_USER
197     %token MAX_GLOBAL
198     %token MAX_IDENT
199     %token MAX_LOCAL
200     %token MAX_NICK_CHANGES
201     %token MAX_NICK_TIME
202     %token MAX_NUMBER
203     %token MAX_TARGETS
204 michael 876 %token MAX_WATCH
205 adx 30 %token MESSAGE_LOCALE
206     %token MIN_NONWILDCARD
207     %token MIN_NONWILDCARD_SIMPLE
208     %token MODULE
209     %token MODULES
210     %token NAME
211     %token NEED_PASSWORD
212     %token NETWORK_DESC
213     %token NETWORK_NAME
214     %token NICK
215     %token NICK_CHANGES
216     %token NO_CREATE_ON_SPLIT
217     %token NO_JOIN_ON_SPLIT
218     %token NO_OPER_FLOOD
219     %token NO_TILDE
220     %token NUMBER
221     %token NUMBER_PER_IDENT
222     %token NUMBER_PER_CIDR
223     %token NUMBER_PER_IP
224     %token NUMBER_PER_IP_GLOBAL
225     %token OPERATOR
226     %token OPERS_BYPASS_CALLERID
227     %token OPER_ONLY_UMODES
228     %token OPER_PASS_RESV
229     %token OPER_SPY_T
230     %token OPER_UMODES
231     %token JOIN_FLOOD_COUNT
232     %token JOIN_FLOOD_TIME
233     %token PACE_WAIT
234     %token PACE_WAIT_SIMPLE
235     %token PASSWORD
236     %token PATH
237     %token PING_COOKIE
238     %token PING_TIME
239     %token PING_WARNING
240     %token PORT
241     %token QSTRING
242     %token QUIET_ON_BAN
243     %token REASON
244     %token REDIRPORT
245     %token REDIRSERV
246     %token REGEX_T
247     %token REHASH
248     %token TREJECT_HOLD_TIME
249     %token REMOTE
250     %token REMOTEBAN
251     %token RESTRICT_CHANNELS
252     %token RESTRICTED
253     %token RSA_PRIVATE_KEY_FILE
254     %token RSA_PUBLIC_KEY_FILE
255     %token SSL_CERTIFICATE_FILE
256 michael 1306 %token SSL_DH_PARAM_FILE
257 michael 1316 %token T_SSL_CLIENT_METHOD
258     %token T_SSL_SERVER_METHOD
259 michael 967 %token T_SSLV3
260     %token T_TLSV1
261 adx 30 %token RESV
262     %token RESV_EXEMPT
263     %token SECONDS MINUTES HOURS DAYS WEEKS
264     %token SENDQ
265     %token SEND_PASSWORD
266     %token SERVERHIDE
267     %token SERVERINFO
268     %token IRCD_SID
269     %token TKLINE_EXPIRE_NOTICES
270     %token T_SHARED
271     %token T_CLUSTER
272     %token TYPE
273     %token SHORT_MOTD
274     %token SILENT
275     %token SPOOF
276     %token SPOOF_NOTICE
277 michael 584 %token STATS_E_DISABLED
278 adx 30 %token STATS_I_OPER_ONLY
279     %token STATS_K_OPER_ONLY
280     %token STATS_O_OPER_ONLY
281     %token STATS_P_OPER_ONLY
282     %token TBOOL
283     %token TMASKED
284     %token T_REJECT
285     %token TS_MAX_DELTA
286     %token TS_WARN_DELTA
287     %token TWODOTS
288     %token T_ALL
289     %token T_BOTS
290     %token T_SOFTCALLERID
291     %token T_CALLERID
292     %token T_CCONN
293 db 849 %token T_CCONN_FULL
294 michael 1306 %token T_SSL_CIPHER_LIST
295 adx 30 %token T_CLIENT_FLOOD
296     %token T_DEAF
297     %token T_DEBUG
298 michael 1247 %token T_DLINE
299 adx 30 %token T_DRONE
300     %token T_EXTERNAL
301     %token T_FULL
302     %token T_INVISIBLE
303     %token T_IPV4
304     %token T_IPV6
305     %token T_LOCOPS
306     %token T_MAX_CLIENTS
307     %token T_NCHANGE
308     %token T_OPERWALL
309     %token T_REJ
310 michael 900 %token T_SERVER
311 adx 30 %token T_SERVNOTICE
312 michael 1460 %token T_SET
313 adx 30 %token T_SKILL
314     %token T_SPY
315     %token T_SSL
316 michael 56 %token T_UMODES
317 adx 30 %token T_UNAUTH
318 michael 1301 %token T_UNDLINE
319 michael 1250 %token T_UNLIMITED
320 adx 30 %token T_UNRESV
321     %token T_UNXLINE
322 michael 1216 %token T_GLOBOPS
323 adx 30 %token T_WALLOP
324 michael 1228 %token T_RESTART
325 michael 1157 %token T_SERVICE
326 michael 1176 %token T_SERVICES_NAME
327 adx 30 %token THROTTLE_TIME
328     %token TOPICBURST
329     %token TRUE_NO_OPER_FLOOD
330     %token TKLINE
331     %token TXLINE
332     %token TRESV
333     %token UNKLINE
334     %token USER
335     %token USE_EGD
336     %token USE_EXCEPT
337     %token USE_INVEX
338     %token USE_KNOCK
339     %token USE_LOGGING
340     %token USE_WHOIS_ACTUALLY
341     %token VHOST
342     %token VHOST6
343     %token XLINE
344     %token WARN
345     %token WARN_NO_NLINE
346 michael 1247 %token T_SIZE
347     %token T_FILE
348 adx 30
349     %type <string> QSTRING
350     %type <number> NUMBER
351     %type <number> timespec
352     %type <number> timespec_
353     %type <number> sizespec
354     %type <number> sizespec_
355    
356     %%
357     conf:
358     | conf conf_item
359     ;
360    
361     conf_item: admin_entry
362     | logging_entry
363     | oper_entry
364     | channel_entry
365     | class_entry
366     | listen_entry
367     | auth_entry
368     | serverinfo_entry
369     | serverhide_entry
370     | resv_entry
371 michael 1157 | service_entry
372 adx 30 | shared_entry
373     | cluster_entry
374     | connect_entry
375     | kill_entry
376     | deny_entry
377     | exempt_entry
378     | general_entry
379     | gecos_entry
380     | modules_entry
381     | error ';'
382     | error '}'
383     ;
384    
385    
386     timespec_: { $$ = 0; } | timespec;
387     timespec: NUMBER timespec_
388     {
389     $$ = $1 + $2;
390     }
391     | NUMBER SECONDS timespec_
392     {
393     $$ = $1 + $3;
394     }
395     | NUMBER MINUTES timespec_
396     {
397     $$ = $1 * 60 + $3;
398     }
399     | NUMBER HOURS timespec_
400     {
401     $$ = $1 * 60 * 60 + $3;
402     }
403     | NUMBER DAYS timespec_
404     {
405     $$ = $1 * 60 * 60 * 24 + $3;
406     }
407     | NUMBER WEEKS timespec_
408     {
409     $$ = $1 * 60 * 60 * 24 * 7 + $3;
410     }
411     ;
412    
413     sizespec_: { $$ = 0; } | sizespec;
414     sizespec: NUMBER sizespec_ { $$ = $1 + $2; }
415     | NUMBER BYTES sizespec_ { $$ = $1 + $3; }
416     | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; }
417     | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
418     ;
419    
420    
421     /***************************************************************************
422     * section modules
423     ***************************************************************************/
424     modules_entry: MODULES
425     '{' modules_items '}' ';';
426    
427     modules_items: modules_items modules_item | modules_item;
428     modules_item: modules_module | modules_path | error ';' ;
429    
430     modules_module: MODULE '=' QSTRING ';'
431     {
432 michael 967 if (conf_parser_ctx.pass == 2)
433 michael 978 add_conf_module(libio_basename(yylval.string));
434 adx 30 };
435    
436     modules_path: PATH '=' QSTRING ';'
437     {
438 michael 967 if (conf_parser_ctx.pass == 2)
439 adx 30 mod_add_path(yylval.string);
440     };
441    
442    
443 michael 967 serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
444    
445     serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ;
446 adx 30 serverinfo_item: serverinfo_name | serverinfo_vhost |
447     serverinfo_hub | serverinfo_description |
448     serverinfo_network_name | serverinfo_network_desc |
449 michael 1306 serverinfo_max_clients | serverinfo_ssl_dh_param_file |
450 adx 30 serverinfo_rsa_private_key_file | serverinfo_vhost6 |
451     serverinfo_sid | serverinfo_ssl_certificate_file |
452 michael 1316 serverinfo_ssl_client_method | serverinfo_ssl_server_method |
453     serverinfo_ssl_cipher_list |
454 adx 30 error ';' ;
455    
456 michael 967
457 michael 1316 serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ;
458     serverinfo_ssl_server_method: T_SSL_SERVER_METHOD '=' server_method_types ';' ;
459    
460     client_method_types: client_method_types ',' client_method_type_item | client_method_type_item;
461     client_method_type_item: T_SSLV3
462 michael 967 {
463 michael 1024 #ifdef HAVE_LIBCRYPTO
464 michael 1316 if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
465     SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3);
466 michael 1024 #endif
467 michael 1316 } | T_TLSV1
468 michael 967 {
469 michael 1024 #ifdef HAVE_LIBCRYPTO
470 michael 1316 if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx)
471     SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1);
472 michael 1024 #endif
473 michael 967 };
474    
475 michael 1316 server_method_types: server_method_types ',' server_method_type_item | server_method_type_item;
476     server_method_type_item: T_SSLV3
477 michael 967 {
478 michael 1024 #ifdef HAVE_LIBCRYPTO
479 michael 1316 if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
480     SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3);
481 michael 1024 #endif
482 michael 967 } | T_TLSV1
483     {
484 michael 1024 #ifdef HAVE_LIBCRYPTO
485 michael 1316 if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
486     SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1);
487 michael 1024 #endif
488 michael 967 };
489    
490 adx 30 serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
491     {
492     #ifdef HAVE_LIBCRYPTO
493 michael 967 if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
494 adx 30 {
495     if (!ServerInfo.rsa_private_key_file)
496     {
497     yyerror("No rsa_private_key_file specified, SSL disabled");
498     break;
499     }
500    
501 michael 967 if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string,
502 michael 1303 SSL_FILETYPE_PEM) <= 0 ||
503     SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string,
504 michael 967 SSL_FILETYPE_PEM) <= 0)
505 adx 30 {
506     yyerror(ERR_lib_error_string(ERR_get_error()));
507     break;
508     }
509    
510 michael 967 if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file,
511 michael 1303 SSL_FILETYPE_PEM) <= 0 ||
512     SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file,
513 michael 967 SSL_FILETYPE_PEM) <= 0)
514 adx 30 {
515     yyerror(ERR_lib_error_string(ERR_get_error()));
516     break;
517     }
518    
519 michael 1303 if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) ||
520     !SSL_CTX_check_private_key(ServerInfo.client_ctx))
521 adx 30 {
522 michael 967 yyerror(ERR_lib_error_string(ERR_get_error()));
523 adx 30 break;
524     }
525     }
526     #endif
527     };
528    
529     serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
530     {
531     #ifdef HAVE_LIBCRYPTO
532 michael 967 if (conf_parser_ctx.pass == 1)
533 adx 30 {
534     BIO *file;
535    
536     if (ServerInfo.rsa_private_key)
537     {
538     RSA_free(ServerInfo.rsa_private_key);
539     ServerInfo.rsa_private_key = NULL;
540     }
541    
542     if (ServerInfo.rsa_private_key_file)
543     {
544     MyFree(ServerInfo.rsa_private_key_file);
545     ServerInfo.rsa_private_key_file = NULL;
546     }
547    
548     DupString(ServerInfo.rsa_private_key_file, yylval.string);
549    
550     if ((file = BIO_new_file(yylval.string, "r")) == NULL)
551     {
552     yyerror("File open failed, ignoring");
553     break;
554     }
555    
556 michael 1306 ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
557 adx 30
558     BIO_set_close(file, BIO_CLOSE);
559     BIO_free(file);
560    
561     if (ServerInfo.rsa_private_key == NULL)
562     {
563     yyerror("Couldn't extract key, ignoring");
564     break;
565     }
566    
567     if (!RSA_check_key(ServerInfo.rsa_private_key))
568     {
569     RSA_free(ServerInfo.rsa_private_key);
570     ServerInfo.rsa_private_key = NULL;
571    
572     yyerror("Invalid key, ignoring");
573     break;
574     }
575    
576     /* require 2048 bit (256 byte) key */
577     if (RSA_size(ServerInfo.rsa_private_key) != 256)
578     {
579     RSA_free(ServerInfo.rsa_private_key);
580     ServerInfo.rsa_private_key = NULL;
581    
582     yyerror("Not a 2048 bit key, ignoring");
583     }
584     }
585     #endif
586     };
587    
588 michael 1306 serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
589     {
590     /* TBD - XXX: error reporting */
591     #ifdef HAVE_LIBCRYPTO
592     if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
593     {
594     BIO *file = BIO_new_file(yylval.string, "r");
595    
596     if (file)
597     {
598     DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
599    
600     BIO_free(file);
601    
602     if (dh)
603     {
604 michael 1352 if (DH_size(dh) < 128)
605     ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
606     else
607     SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh);
608    
609 michael 1306 DH_free(dh);
610     }
611     }
612     }
613     #endif
614     };
615    
616     serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
617     {
618     #ifdef HAVE_LIBCRYPTO
619     if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx)
620     SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string);
621     #endif
622     };
623    
624 adx 30 serverinfo_name: NAME '=' QSTRING ';'
625     {
626     /* this isn't rehashable */
627 michael 1117 if (conf_parser_ctx.pass == 2 && !ServerInfo.name)
628 adx 30 {
629 michael 1117 if (valid_servname(yylval.string))
630     DupString(ServerInfo.name, yylval.string);
631     else
632 adx 30 {
633 michael 1247 ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::name -- invalid name. Aborting.");
634 michael 1117 exit(0);
635 adx 30 }
636     }
637     };
638    
639     serverinfo_sid: IRCD_SID '=' QSTRING ';'
640     {
641     /* this isn't rehashable */
642 michael 967 if (conf_parser_ctx.pass == 2 && !ServerInfo.sid)
643 adx 30 {
644 michael 573 if (valid_sid(yylval.string))
645 adx 30 DupString(ServerInfo.sid, yylval.string);
646     else
647     {
648 michael 1247 ilog(LOG_TYPE_IRCD, "Ignoring serverinfo::sid -- invalid SID. Aborting.");
649 adx 30 exit(0);
650     }
651     }
652     };
653    
654     serverinfo_description: DESCRIPTION '=' QSTRING ';'
655     {
656 michael 967 if (conf_parser_ctx.pass == 2)
657 adx 30 {
658     MyFree(ServerInfo.description);
659     DupString(ServerInfo.description,yylval.string);
660     }
661     };
662    
663     serverinfo_network_name: NETWORK_NAME '=' QSTRING ';'
664     {
665 michael 967 if (conf_parser_ctx.pass == 2)
666 adx 30 {
667     char *p;
668    
669     if ((p = strchr(yylval.string, ' ')) != NULL)
670     p = '\0';
671    
672     MyFree(ServerInfo.network_name);
673     DupString(ServerInfo.network_name, yylval.string);
674     }
675     };
676    
677     serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
678     {
679 michael 967 if (conf_parser_ctx.pass == 2)
680 adx 30 {
681     MyFree(ServerInfo.network_desc);
682     DupString(ServerInfo.network_desc, yylval.string);
683     }
684     };
685    
686     serverinfo_vhost: VHOST '=' QSTRING ';'
687     {
688 michael 967 if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
689 adx 30 {
690     struct addrinfo hints, *res;
691    
692     memset(&hints, 0, sizeof(hints));
693    
694     hints.ai_family = AF_UNSPEC;
695     hints.ai_socktype = SOCK_STREAM;
696     hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
697    
698 michael 1123 if (getaddrinfo(yylval.string, NULL, &hints, &res))
699 michael 1247 ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
700 adx 30 else
701     {
702     assert(res != NULL);
703    
704     memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen);
705     ServerInfo.ip.ss.ss_family = res->ai_family;
706     ServerInfo.ip.ss_len = res->ai_addrlen;
707 michael 1123 freeaddrinfo(res);
708 adx 30
709     ServerInfo.specific_ipv4_vhost = 1;
710     }
711     }
712     };
713    
714     serverinfo_vhost6: VHOST6 '=' QSTRING ';'
715     {
716     #ifdef IPV6
717 michael 967 if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
718 adx 30 {
719     struct addrinfo hints, *res;
720    
721     memset(&hints, 0, sizeof(hints));
722    
723     hints.ai_family = AF_UNSPEC;
724     hints.ai_socktype = SOCK_STREAM;
725     hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
726    
727 michael 1123 if (getaddrinfo(yylval.string, NULL, &hints, &res))
728 michael 1247 ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
729 adx 30 else
730     {
731     assert(res != NULL);
732    
733     memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen);
734     ServerInfo.ip6.ss.ss_family = res->ai_family;
735     ServerInfo.ip6.ss_len = res->ai_addrlen;
736 michael 1123 freeaddrinfo(res);
737 adx 30
738     ServerInfo.specific_ipv6_vhost = 1;
739     }
740     }
741     #endif
742     };
743    
744     serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';'
745     {
746 michael 967 if (conf_parser_ctx.pass == 2)
747 adx 30 {
748     recalc_fdlimit(NULL);
749    
750     if ($3 < MAXCLIENTS_MIN)
751     {
752     char buf[IRCD_BUFSIZE];
753     ircsprintf(buf, "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
754     yyerror(buf);
755     }
756     else if ($3 > MAXCLIENTS_MAX)
757     {
758     char buf[IRCD_BUFSIZE];
759     ircsprintf(buf, "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
760     yyerror(buf);
761     }
762     else
763     ServerInfo.max_clients = $3;
764     }
765     };
766    
767     serverinfo_hub: HUB '=' TBOOL ';'
768     {
769 michael 967 if (conf_parser_ctx.pass == 2)
770 michael 1119 ServerInfo.hub = yylval.number;
771 adx 30 };
772    
773     /***************************************************************************
774     * admin section
775     ***************************************************************************/
776     admin_entry: ADMIN '{' admin_items '}' ';' ;
777    
778     admin_items: admin_items admin_item | admin_item;
779     admin_item: admin_name | admin_description |
780     admin_email | error ';' ;
781    
782     admin_name: NAME '=' QSTRING ';'
783     {
784 michael 967 if (conf_parser_ctx.pass == 2)
785 adx 30 {
786     MyFree(AdminInfo.name);
787     DupString(AdminInfo.name, yylval.string);
788     }
789     };
790    
791     admin_email: EMAIL '=' QSTRING ';'
792     {
793 michael 967 if (conf_parser_ctx.pass == 2)
794 adx 30 {
795     MyFree(AdminInfo.email);
796     DupString(AdminInfo.email, yylval.string);
797     }
798     };
799    
800     admin_description: DESCRIPTION '=' QSTRING ';'
801     {
802 michael 967 if (conf_parser_ctx.pass == 2)
803 adx 30 {
804     MyFree(AdminInfo.description);
805     DupString(AdminInfo.description, yylval.string);
806     }
807     };
808    
809     /***************************************************************************
810     * section logging
811     ***************************************************************************/
812 michael 1247 logging_entry: T_LOG '{' logging_items '}' ';' ;
813     logging_items: logging_items logging_item | logging_item ;
814 adx 30
815 michael 1324 logging_item: logging_use_logging | logging_file_entry |
816 adx 30 error ';' ;
817    
818 michael 1247 logging_use_logging: USE_LOGGING '=' TBOOL ';'
819 adx 30 {
820 michael 967 if (conf_parser_ctx.pass == 2)
821 michael 1247 ConfigLoggingEntry.use_logging = yylval.number;
822 adx 30 };
823    
824 michael 1247 logging_file_entry:
825 adx 30 {
826 michael 1247 lfile[0] = '\0';
827     ltype = 0;
828     lsize = 0;
829     } T_FILE '{' logging_file_items '}' ';'
830 adx 30 {
831 michael 1248 if (conf_parser_ctx.pass == 2 && ltype > 0)
832 michael 1247 log_add_file(ltype, lsize, lfile);
833 adx 30 };
834    
835 michael 1247 logging_file_items: logging_file_items logging_file_item |
836     logging_file_item ;
837 adx 30
838 michael 1247 logging_file_item: logging_file_name | logging_file_type |
839     logging_file_size | error ';' ;
840    
841     logging_file_name: NAME '=' QSTRING ';'
842 adx 30 {
843 michael 1247 strlcpy(lfile, yylval.string, sizeof(lfile));
844     }
845 adx 30
846 michael 1247 logging_file_size: T_SIZE '=' sizespec ';'
847 adx 30 {
848 michael 1247 lsize = $3;
849 michael 1250 } | T_SIZE '=' T_UNLIMITED ';'
850     {
851     lsize = 0;
852 adx 30 };
853    
854 michael 1247 logging_file_type: TYPE
855 adx 30 {
856 michael 967 if (conf_parser_ctx.pass == 2)
857 michael 1247 ltype = 0;
858     } '=' logging_file_type_items ';' ;
859 adx 30
860 michael 1247 logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
861     logging_file_type_item: USER
862 adx 30 {
863 michael 967 if (conf_parser_ctx.pass == 2)
864 michael 1247 ltype = LOG_TYPE_USER;
865     } | OPERATOR
866 adx 30 {
867 michael 967 if (conf_parser_ctx.pass == 2)
868 michael 1247 ltype = LOG_TYPE_OPER;
869     } | GLINE
870 adx 30 {
871 michael 967 if (conf_parser_ctx.pass == 2)
872 michael 1247 ltype = LOG_TYPE_GLINE;
873     } | T_DLINE
874 adx 30 {
875 michael 967 if (conf_parser_ctx.pass == 2)
876 michael 1247 ltype = LOG_TYPE_DLINE;
877     } | KLINE
878 adx 30 {
879 michael 967 if (conf_parser_ctx.pass == 2)
880 michael 1247 ltype = LOG_TYPE_KLINE;
881     } | KILL
882 adx 30 {
883 michael 967 if (conf_parser_ctx.pass == 2)
884 michael 1247 ltype = LOG_TYPE_KILL;
885     } | T_DEBUG
886 adx 30 {
887 michael 967 if (conf_parser_ctx.pass == 2)
888 michael 1247 ltype = LOG_TYPE_DEBUG;
889 adx 30 };
890    
891 michael 1247
892 adx 30 /***************************************************************************
893     * section oper
894     ***************************************************************************/
895     oper_entry: OPERATOR
896     {
897 michael 967 if (conf_parser_ctx.pass == 2)
898 adx 30 {
899     yy_conf = make_conf_item(OPER_TYPE);
900     yy_aconf = map_to_conf(yy_conf);
901     SetConfEncrypted(yy_aconf); /* Yes, the default is encrypted */
902     }
903     else
904     {
905     MyFree(class_name);
906     class_name = NULL;
907     }
908 michael 1285 } '{' oper_items '}' ';'
909 adx 30 {
910 michael 967 if (conf_parser_ctx.pass == 2)
911 adx 30 {
912     struct CollectItem *yy_tmp;
913     dlink_node *ptr;
914     dlink_node *next_ptr;
915    
916     conf_add_class_to_conf(yy_conf, class_name);
917    
918     /* Now, make sure there is a copy of the "base" given oper
919     * block in each of the collected copies
920     */
921    
922     DLINK_FOREACH_SAFE(ptr, next_ptr, col_conf_list.head)
923     {
924     struct AccessItem *new_aconf;
925     struct ConfItem *new_conf;
926     yy_tmp = ptr->data;
927    
928     new_conf = make_conf_item(OPER_TYPE);
929     new_aconf = (struct AccessItem *)map_to_conf(new_conf);
930    
931     new_aconf->flags = yy_aconf->flags;
932    
933     if (yy_conf->name != NULL)
934     DupString(new_conf->name, yy_conf->name);
935     if (yy_tmp->user != NULL)
936     DupString(new_aconf->user, yy_tmp->user);
937     else
938     DupString(new_aconf->user, "*");
939     if (yy_tmp->host != NULL)
940     DupString(new_aconf->host, yy_tmp->host);
941     else
942     DupString(new_aconf->host, "*");
943 michael 1285
944 michael 1389 new_aconf->type = parse_netmask(new_aconf->host, &new_aconf->addr,
945 michael 1285 &new_aconf->bits);
946    
947 adx 30 conf_add_class_to_conf(new_conf, class_name);
948     if (yy_aconf->passwd != NULL)
949     DupString(new_aconf->passwd, yy_aconf->passwd);
950    
951     new_aconf->port = yy_aconf->port;
952     #ifdef HAVE_LIBCRYPTO
953     if (yy_aconf->rsa_public_key_file != NULL)
954     {
955     BIO *file;
956    
957     DupString(new_aconf->rsa_public_key_file,
958     yy_aconf->rsa_public_key_file);
959    
960     file = BIO_new_file(yy_aconf->rsa_public_key_file, "r");
961     new_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file,
962     NULL, 0, NULL);
963     BIO_set_close(file, BIO_CLOSE);
964     BIO_free(file);
965     }
966     #endif
967    
968     #ifdef HAVE_LIBCRYPTO
969     if (yy_tmp->name && (yy_tmp->passwd || yy_aconf->rsa_public_key)
970     && yy_tmp->host)
971     #else
972     if (yy_tmp->name && yy_tmp->passwd && yy_tmp->host)
973     #endif
974     {
975     conf_add_class_to_conf(new_conf, class_name);
976     if (yy_tmp->name != NULL)
977     DupString(new_conf->name, yy_tmp->name);
978     }
979    
980     dlinkDelete(&yy_tmp->node, &col_conf_list);
981     free_collect_item(yy_tmp);
982     }
983    
984     yy_conf = NULL;
985     yy_aconf = NULL;
986    
987    
988     MyFree(class_name);
989     class_name = NULL;
990     }
991     };
992    
993     oper_items: oper_items oper_item | oper_item;
994 michael 1076 oper_item: oper_name | oper_user | oper_password |
995     oper_umodes | oper_class | oper_encrypted |
996     oper_rsa_public_key_file | oper_flags | error ';' ;
997 adx 30
998     oper_name: NAME '=' QSTRING ';'
999     {
1000 michael 967 if (conf_parser_ctx.pass == 2)
1001 adx 30 {
1002     MyFree(yy_conf->name);
1003     DupString(yy_conf->name, yylval.string);
1004     }
1005     };
1006    
1007     oper_user: USER '=' QSTRING ';'
1008     {
1009 michael 967 if (conf_parser_ctx.pass == 2)
1010 adx 30 {
1011 michael 593 struct split_nuh_item nuh;
1012 adx 30
1013 michael 593 nuh.nuhmask = yylval.string;
1014     nuh.nickptr = NULL;
1015     nuh.userptr = userbuf;
1016     nuh.hostptr = hostbuf;
1017    
1018     nuh.nicksize = 0;
1019     nuh.usersize = sizeof(userbuf);
1020     nuh.hostsize = sizeof(hostbuf);
1021    
1022     split_nuh(&nuh);
1023    
1024 adx 30 if (yy_aconf->user == NULL)
1025     {
1026 michael 593 DupString(yy_aconf->user, userbuf);
1027     DupString(yy_aconf->host, hostbuf);
1028 michael 1285
1029 michael 1389 yy_aconf->type = parse_netmask(yy_aconf->host, &yy_aconf->addr,
1030 michael 1285 &yy_aconf->bits);
1031 adx 30 }
1032     else
1033     {
1034 michael 593 struct CollectItem *yy_tmp = MyMalloc(sizeof(struct CollectItem));
1035    
1036     DupString(yy_tmp->user, userbuf);
1037     DupString(yy_tmp->host, hostbuf);
1038    
1039 adx 30 dlinkAdd(yy_tmp, &yy_tmp->node, &col_conf_list);
1040     }
1041     }
1042     };
1043    
1044     oper_password: PASSWORD '=' QSTRING ';'
1045     {
1046 michael 967 if (conf_parser_ctx.pass == 2)
1047 adx 30 {
1048     if (yy_aconf->passwd != NULL)
1049     memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd));
1050    
1051     MyFree(yy_aconf->passwd);
1052     DupString(yy_aconf->passwd, yylval.string);
1053     }
1054     };
1055    
1056     oper_encrypted: ENCRYPTED '=' TBOOL ';'
1057     {
1058 michael 967 if (conf_parser_ctx.pass == 2)
1059 adx 30 {
1060     if (yylval.number)
1061     SetConfEncrypted(yy_aconf);
1062     else
1063     ClearConfEncrypted(yy_aconf);
1064     }
1065     };
1066    
1067     oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1068     {
1069     #ifdef HAVE_LIBCRYPTO
1070 michael 967 if (conf_parser_ctx.pass == 2)
1071 adx 30 {
1072     BIO *file;
1073    
1074     if (yy_aconf->rsa_public_key != NULL)
1075     {
1076     RSA_free(yy_aconf->rsa_public_key);
1077     yy_aconf->rsa_public_key = NULL;
1078     }
1079    
1080     if (yy_aconf->rsa_public_key_file != NULL)
1081     {
1082     MyFree(yy_aconf->rsa_public_key_file);
1083     yy_aconf->rsa_public_key_file = NULL;
1084     }
1085    
1086     DupString(yy_aconf->rsa_public_key_file, yylval.string);
1087     file = BIO_new_file(yylval.string, "r");
1088    
1089     if (file == NULL)
1090     {
1091     yyerror("Ignoring rsa_public_key_file -- file doesn't exist");
1092     break;
1093     }
1094    
1095     yy_aconf->rsa_public_key = (RSA *)PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL);
1096    
1097     if (yy_aconf->rsa_public_key == NULL)
1098     {
1099     yyerror("Ignoring rsa_public_key_file -- Key invalid; check key syntax.");
1100     break;
1101     }
1102    
1103     BIO_set_close(file, BIO_CLOSE);
1104     BIO_free(file);
1105     }
1106     #endif /* HAVE_LIBCRYPTO */
1107     };
1108    
1109     oper_class: CLASS '=' QSTRING ';'
1110     {
1111 michael 967 if (conf_parser_ctx.pass == 2)
1112 adx 30 {
1113     MyFree(class_name);
1114     DupString(class_name, yylval.string);
1115     }
1116     };
1117    
1118 michael 56 oper_umodes: T_UMODES
1119     {
1120 michael 967 if (conf_parser_ctx.pass == 2)
1121 db 298 yy_aconf->modes = 0;
1122 michael 56 } '=' oper_umodes_items ';' ;
1123    
1124     oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1125     oper_umodes_item: T_BOTS
1126     {
1127 michael 967 if (conf_parser_ctx.pass == 2)
1128 db 298 yy_aconf->modes |= UMODE_BOTS;
1129 michael 56 } | T_CCONN
1130     {
1131 michael 967 if (conf_parser_ctx.pass == 2)
1132 db 298 yy_aconf->modes |= UMODE_CCONN;
1133 db 849 } | T_CCONN_FULL
1134     {
1135 michael 967 if (conf_parser_ctx.pass == 2)
1136 db 849 yy_aconf->modes |= UMODE_CCONN_FULL;
1137 michael 56 } | T_DEAF
1138     {
1139 michael 967 if (conf_parser_ctx.pass == 2)
1140 db 298 yy_aconf->modes |= UMODE_DEAF;
1141 michael 56 } | T_DEBUG
1142     {
1143 michael 967 if (conf_parser_ctx.pass == 2)
1144 db 298 yy_aconf->modes |= UMODE_DEBUG;
1145 michael 56 } | T_FULL
1146     {
1147 michael 967 if (conf_parser_ctx.pass == 2)
1148 db 298 yy_aconf->modes |= UMODE_FULL;
1149 michael 1294 } | HIDDEN
1150     {
1151     if (conf_parser_ctx.pass == 2)
1152     yy_aconf->modes |= UMODE_HIDDEN;
1153 michael 56 } | T_SKILL
1154     {
1155 michael 967 if (conf_parser_ctx.pass == 2)
1156 db 298 yy_aconf->modes |= UMODE_SKILL;
1157 michael 56 } | T_NCHANGE
1158     {
1159 michael 967 if (conf_parser_ctx.pass == 2)
1160 db 298 yy_aconf->modes |= UMODE_NCHANGE;
1161 michael 56 } | T_REJ
1162     {
1163 michael 967 if (conf_parser_ctx.pass == 2)
1164 db 298 yy_aconf->modes |= UMODE_REJ;
1165 michael 56 } | T_UNAUTH
1166     {
1167 michael 967 if (conf_parser_ctx.pass == 2)
1168 db 298 yy_aconf->modes |= UMODE_UNAUTH;
1169 michael 56 } | T_SPY
1170     {
1171 michael 967 if (conf_parser_ctx.pass == 2)
1172 db 298 yy_aconf->modes |= UMODE_SPY;
1173 michael 56 } | T_EXTERNAL
1174     {
1175 michael 967 if (conf_parser_ctx.pass == 2)
1176 db 298 yy_aconf->modes |= UMODE_EXTERNAL;
1177 michael 56 } | T_OPERWALL
1178     {
1179 michael 967 if (conf_parser_ctx.pass == 2)
1180 db 298 yy_aconf->modes |= UMODE_OPERWALL;
1181 michael 56 } | T_SERVNOTICE
1182     {
1183 michael 967 if (conf_parser_ctx.pass == 2)
1184 db 298 yy_aconf->modes |= UMODE_SERVNOTICE;
1185 michael 56 } | T_INVISIBLE
1186     {
1187 michael 967 if (conf_parser_ctx.pass == 2)
1188 db 298 yy_aconf->modes |= UMODE_INVISIBLE;
1189 michael 56 } | T_WALLOP
1190     {
1191 michael 967 if (conf_parser_ctx.pass == 2)
1192 db 298 yy_aconf->modes |= UMODE_WALLOP;
1193 michael 56 } | T_SOFTCALLERID
1194     {
1195 michael 967 if (conf_parser_ctx.pass == 2)
1196 db 298 yy_aconf->modes |= UMODE_SOFTCALLERID;
1197 michael 56 } | T_CALLERID
1198     {
1199 michael 967 if (conf_parser_ctx.pass == 2)
1200 db 298 yy_aconf->modes |= UMODE_CALLERID;
1201 michael 56 } | T_LOCOPS
1202     {
1203 michael 967 if (conf_parser_ctx.pass == 2)
1204 db 298 yy_aconf->modes |= UMODE_LOCOPS;
1205 michael 56 };
1206    
1207 adx 30 oper_flags: IRCD_FLAGS
1208     {
1209 michael 1228 if (conf_parser_ctx.pass == 2)
1210     yy_aconf->port = 0;
1211 adx 30 } '=' oper_flags_items ';';
1212    
1213     oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1214 michael 1228 oper_flags_item: GLOBAL_KILL
1215 adx 30 {
1216 michael 967 if (conf_parser_ctx.pass == 2)
1217 michael 1228 yy_aconf->port |= OPER_FLAG_GLOBAL_KILL;
1218 adx 30 } | REMOTE
1219     {
1220 michael 967 if (conf_parser_ctx.pass == 2)
1221 michael 1228 yy_aconf->port |= OPER_FLAG_REMOTE;
1222 adx 30 } | KLINE
1223     {
1224 michael 967 if (conf_parser_ctx.pass == 2)
1225 michael 1228 yy_aconf->port |= OPER_FLAG_K;
1226 adx 30 } | UNKLINE
1227     {
1228 michael 967 if (conf_parser_ctx.pass == 2)
1229 michael 1228 yy_aconf->port |= OPER_FLAG_UNKLINE;
1230 michael 1301 } | T_DLINE
1231     {
1232     if (conf_parser_ctx.pass == 2)
1233     yy_aconf->port |= OPER_FLAG_DLINE;
1234     } | T_UNDLINE
1235     {
1236     if (conf_parser_ctx.pass == 2)
1237     yy_aconf->port |= OPER_FLAG_UNDLINE;
1238 adx 30 } | XLINE
1239     {
1240 michael 967 if (conf_parser_ctx.pass == 2)
1241 michael 1228 yy_aconf->port |= OPER_FLAG_X;
1242 adx 30 } | GLINE
1243     {
1244 michael 967 if (conf_parser_ctx.pass == 2)
1245 michael 1228 yy_aconf->port |= OPER_FLAG_GLINE;
1246 adx 30 } | DIE
1247     {
1248 michael 967 if (conf_parser_ctx.pass == 2)
1249 michael 1228 yy_aconf->port |= OPER_FLAG_DIE;
1250     } | T_RESTART
1251     {
1252     if (conf_parser_ctx.pass == 2)
1253     yy_aconf->port |= OPER_FLAG_RESTART;
1254 adx 30 } | REHASH
1255     {
1256 michael 967 if (conf_parser_ctx.pass == 2)
1257 michael 1228 yy_aconf->port |= OPER_FLAG_REHASH;
1258 adx 30 } | ADMIN
1259     {
1260 michael 967 if (conf_parser_ctx.pass == 2)
1261 michael 1228 yy_aconf->port |= OPER_FLAG_ADMIN;
1262 adx 30 } | NICK_CHANGES
1263     {
1264 michael 967 if (conf_parser_ctx.pass == 2)
1265 michael 1228 yy_aconf->port |= OPER_FLAG_N;
1266 adx 30 } | T_OPERWALL
1267     {
1268 michael 967 if (conf_parser_ctx.pass == 2)
1269 michael 1228 yy_aconf->port |= OPER_FLAG_OPERWALL;
1270 michael 1216 } | T_GLOBOPS
1271     {
1272     if (conf_parser_ctx.pass == 2)
1273 michael 1228 yy_aconf->port |= OPER_FLAG_GLOBOPS;
1274 adx 30 } | OPER_SPY_T
1275     {
1276 michael 967 if (conf_parser_ctx.pass == 2)
1277 michael 1228 yy_aconf->port |= OPER_FLAG_OPER_SPY;
1278 adx 30 } | REMOTEBAN
1279     {
1280 michael 967 if (conf_parser_ctx.pass == 2)
1281 michael 1228 yy_aconf->port |= OPER_FLAG_REMOTEBAN;
1282 michael 1460 } | T_SET
1283     {
1284     if (conf_parser_ctx.pass == 2)
1285     yy_aconf->port |= OPER_FLAG_SET;
1286 michael 1228 } | MODULE
1287 adx 30 {
1288 michael 967 if (conf_parser_ctx.pass == 2)
1289 michael 1228 yy_aconf->port |= OPER_FLAG_MODULE;
1290 adx 30 };
1291    
1292    
1293     /***************************************************************************
1294     * section class
1295     ***************************************************************************/
1296     class_entry: CLASS
1297     {
1298 michael 967 if (conf_parser_ctx.pass == 1)
1299 adx 30 {
1300     yy_conf = make_conf_item(CLASS_TYPE);
1301 michael 671 yy_class = map_to_conf(yy_conf);
1302 adx 30 }
1303 michael 1285 } '{' class_items '}' ';'
1304 adx 30 {
1305 michael 967 if (conf_parser_ctx.pass == 1)
1306 adx 30 {
1307 michael 671 struct ConfItem *cconf = NULL;
1308 adx 30 struct ClassItem *class = NULL;
1309    
1310     if (yy_class_name == NULL)
1311     delete_conf_item(yy_conf);
1312     else
1313     {
1314 michael 1285 cconf = find_exact_name_conf(CLASS_TYPE, NULL, yy_class_name, NULL, NULL);
1315 adx 30
1316     if (cconf != NULL) /* The class existed already */
1317     {
1318 michael 671 int user_count = 0;
1319    
1320 adx 30 rebuild_cidr_class(cconf, yy_class);
1321 michael 671
1322     class = map_to_conf(cconf);
1323    
1324     user_count = class->curr_user_count;
1325     memcpy(class, yy_class, sizeof(*class));
1326     class->curr_user_count = user_count;
1327     class->active = 1;
1328    
1329 adx 30 delete_conf_item(yy_conf);
1330    
1331     MyFree(cconf->name); /* Allows case change of class name */
1332     cconf->name = yy_class_name;
1333     }
1334     else /* Brand new class */
1335     {
1336     MyFree(yy_conf->name); /* just in case it was allocated */
1337     yy_conf->name = yy_class_name;
1338 michael 671 yy_class->active = 1;
1339 adx 30 }
1340     }
1341 michael 671
1342 adx 30 yy_class_name = NULL;
1343     }
1344     };
1345    
1346     class_items: class_items class_item | class_item;
1347     class_item: class_name |
1348     class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 |
1349     class_ping_time |
1350     class_ping_warning |
1351     class_number_per_cidr |
1352     class_number_per_ip |
1353     class_connectfreq |
1354     class_max_number |
1355     class_max_global |
1356     class_max_local |
1357     class_max_ident |
1358     class_sendq |
1359     error ';' ;
1360    
1361     class_name: NAME '=' QSTRING ';'
1362     {
1363 michael 967 if (conf_parser_ctx.pass == 1)
1364 adx 30 {
1365     MyFree(yy_class_name);
1366     DupString(yy_class_name, yylval.string);
1367     }
1368     };
1369    
1370     class_ping_time: PING_TIME '=' timespec ';'
1371     {
1372 michael 967 if (conf_parser_ctx.pass == 1)
1373 michael 1377 yy_class->ping_freq = $3;
1374 adx 30 };
1375    
1376     class_ping_warning: PING_WARNING '=' timespec ';'
1377     {
1378 michael 967 if (conf_parser_ctx.pass == 1)
1379 michael 1377 yy_class->ping_warning = $3;
1380 adx 30 };
1381    
1382     class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1383     {
1384 michael 967 if (conf_parser_ctx.pass == 1)
1385 michael 1377 yy_class->max_perip = $3;
1386 adx 30 };
1387    
1388     class_connectfreq: CONNECTFREQ '=' timespec ';'
1389     {
1390 michael 967 if (conf_parser_ctx.pass == 1)
1391 michael 1377 yy_class->con_freq = $3;
1392 adx 30 };
1393    
1394     class_max_number: MAX_NUMBER '=' NUMBER ';'
1395     {
1396 michael 967 if (conf_parser_ctx.pass == 1)
1397 michael 1377 yy_class->max_total = $3;
1398 adx 30 };
1399    
1400     class_max_global: MAX_GLOBAL '=' NUMBER ';'
1401     {
1402 michael 967 if (conf_parser_ctx.pass == 1)
1403 michael 1377 yy_class->max_global = $3;
1404 adx 30 };
1405    
1406     class_max_local: MAX_LOCAL '=' NUMBER ';'
1407     {
1408 michael 967 if (conf_parser_ctx.pass == 1)
1409 michael 1377 yy_class->max_local = $3;
1410 adx 30 };
1411    
1412     class_max_ident: MAX_IDENT '=' NUMBER ';'
1413     {
1414 michael 967 if (conf_parser_ctx.pass == 1)
1415 michael 1377 yy_class->max_ident = $3;
1416 adx 30 };
1417    
1418     class_sendq: SENDQ '=' sizespec ';'
1419     {
1420 michael 967 if (conf_parser_ctx.pass == 1)
1421 michael 1377 yy_class->max_sendq = $3;
1422 adx 30 };
1423    
1424     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 adx 30 } | BURST_AWAY
2196     {
2197 michael 967 if (conf_parser_ctx.pass == 2)
2198 michael 1228 SetConfAwayBurst(yy_aconf);
2199 adx 30 } | TOPICBURST
2200     {
2201 michael 967 if (conf_parser_ctx.pass == 2)
2202 michael 1228 SetConfTopicBurst(yy_aconf);
2203 michael 1303 } | T_SSL
2204     {
2205     if (conf_parser_ctx.pass == 2)
2206     SetConfSSL(yy_aconf);
2207 michael 1228 };
2208 adx 30
2209     connect_encrypted: ENCRYPTED '=' TBOOL ';'
2210     {
2211 michael 967 if (conf_parser_ctx.pass == 2)
2212 adx 30 {
2213     if (yylval.number)
2214     yy_aconf->flags |= CONF_FLAGS_ENCRYPTED;
2215     else
2216     yy_aconf->flags &= ~CONF_FLAGS_ENCRYPTED;
2217     }
2218     };
2219    
2220     connect_hub_mask: HUB_MASK '=' QSTRING ';'
2221     {
2222 michael 967 if (conf_parser_ctx.pass == 2)
2223 adx 30 {
2224 michael 1383 char *mask;
2225 adx 30
2226 michael 1383 DupString(mask, yylval.string);
2227     dlinkAdd(mask, make_dlink_node(), &yy_aconf->hub_list);
2228 adx 30 }
2229     };
2230    
2231     connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2232     {
2233 michael 967 if (conf_parser_ctx.pass == 2)
2234 adx 30 {
2235 michael 1383 char *mask;
2236 adx 30
2237 michael 1383 DupString(mask, yylval.string);
2238     dlinkAdd(mask, make_dlink_node(), &yy_aconf->leaf_list);
2239 adx 30 }
2240     };
2241    
2242     connect_class: CLASS '=' QSTRING ';'
2243     {
2244 michael 967 if (conf_parser_ctx.pass == 2)
2245 adx 30 {
2246     MyFree(class_name);
2247     DupString(class_name, yylval.string);
2248     }
2249     };
2250    
2251 michael 1306 connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2252     {
2253     #ifdef HAVE_LIBCRYPTO
2254     if (conf_parser_ctx.pass == 2)
2255     {
2256     MyFree(yy_aconf->cipher_list);
2257     DupString(yy_aconf->cipher_list, yylval.string);
2258     }
2259     #else
2260     if (conf_parser_ctx.pass == 2)
2261     yyerror("Ignoring connect::ciphers -- no OpenSSL support");
2262     #endif
2263     };
2264    
2265    
2266 adx 30 /***************************************************************************
2267     * section kill
2268     ***************************************************************************/
2269     kill_entry: KILL
2270     {
2271 michael 967 if (conf_parser_ctx.pass == 2)
2272 adx 30 {
2273     userbuf[0] = hostbuf[0] = reasonbuf[0] = '\0';
2274     regex_ban = 0;
2275     }
2276     } '{' kill_items '}' ';'
2277     {
2278 michael 967 if (conf_parser_ctx.pass == 2)
2279 adx 30 {
2280     if (userbuf[0] && hostbuf[0])
2281     {
2282     if (regex_ban)
2283     {
2284 michael 1009 #ifdef HAVE_LIBPCRE
2285     void *exp_user = NULL;
2286     void *exp_host = NULL;
2287 adx 30 const char *errptr = NULL;
2288    
2289     if (!(exp_user = ircd_pcre_compile(userbuf, &errptr)) ||
2290     !(exp_host = ircd_pcre_compile(hostbuf, &errptr)))
2291     {
2292 michael 1247 ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: %s",
2293 michael 595 errptr);
2294 adx 30 break;
2295     }
2296    
2297 michael 1005 yy_aconf = map_to_conf(make_conf_item(RKLINE_TYPE));
2298 adx 30 yy_aconf->regexuser = exp_user;
2299     yy_aconf->regexhost = exp_host;
2300    
2301     DupString(yy_aconf->user, userbuf);
2302     DupString(yy_aconf->host, hostbuf);
2303    
2304     if (reasonbuf[0])
2305     DupString(yy_aconf->reason, reasonbuf);
2306     else
2307     DupString(yy_aconf->reason, "No reason");
2308 michael 1009 #else
2309 michael 1247 ilog(LOG_TYPE_IRCD, "Failed to add regular expression based K-Line: no PCRE support");
2310 michael 1009 break;
2311     #endif
2312 adx 30 }
2313     else
2314     {
2315 michael 1369 find_and_delete_temporary(userbuf, hostbuf, CONF_KLINE);
2316    
2317 michael 1005 yy_aconf = map_to_conf(make_conf_item(KLINE_TYPE));
2318 adx 30
2319     DupString(yy_aconf->user, userbuf);
2320     DupString(yy_aconf->host, hostbuf);
2321    
2322     if (reasonbuf[0])
2323     DupString(yy_aconf->reason, reasonbuf);
2324     else
2325     DupString(yy_aconf->reason, "No reason");
2326 michael 1369 add_conf_by_address(CONF_KLINE, yy_aconf);
2327 adx 30 }
2328     }
2329    
2330     yy_aconf = NULL;
2331     }
2332     };
2333    
2334     kill_type: TYPE
2335     {
2336     } '=' kill_type_items ';';
2337    
2338     kill_type_items: kill_type_items ',' kill_type_item | kill_type_item;
2339     kill_type_item: REGEX_T
2340     {
2341 michael 967 if (conf_parser_ctx.pass == 2)
2342 adx 30 regex_ban = 1;
2343     };
2344    
2345     kill_items: kill_items kill_item | kill_item;
2346     kill_item: kill_user | kill_reason | kill_type | error;
2347    
2348     kill_user: USER '=' QSTRING ';'
2349     {
2350 michael 967 if (conf_parser_ctx.pass == 2)
2351 adx 30 {
2352 michael 593 struct split_nuh_item nuh;
2353 adx 30
2354 michael 593 nuh.nuhmask = yylval.string;
2355     nuh.nickptr = NULL;
2356     nuh.userptr = userbuf;
2357     nuh.hostptr = hostbuf;
2358 adx 30
2359 michael 593 nuh.nicksize = 0;
2360     nuh.usersize = sizeof(userbuf);
2361     nuh.hostsize = sizeof(hostbuf);
2362 adx 30
2363 michael 593 split_nuh(&nuh);
2364 adx 30 }
2365     };
2366    
2367     kill_reason: REASON '=' QSTRING ';'
2368     {
2369 michael 967 if (conf_parser_ctx.pass == 2)
2370 adx 30 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2371     };
2372    
2373     /***************************************************************************
2374     * section deny
2375     ***************************************************************************/
2376     deny_entry: DENY
2377     {
2378 michael 967 if (conf_parser_ctx.pass == 2)
2379 michael 1005 hostbuf[0] = reasonbuf[0] = '\0';
2380 adx 30 } '{' deny_items '}' ';'
2381     {
2382 michael 967 if (conf_parser_ctx.pass == 2)
2383 adx 30 {
2384 michael 1005 if (hostbuf[0] && parse_netmask(hostbuf, NULL, NULL) != HM_HOST)
2385     {
2386 michael 1369 find_and_delete_temporary(NULL, hostbuf, CONF_DLINE);
2387    
2388 michael 1005 yy_aconf = map_to_conf(make_conf_item(DLINE_TYPE));
2389     DupString(yy_aconf->host, hostbuf);
2390    
2391     if (reasonbuf[0])
2392     DupString(yy_aconf->reason, reasonbuf);
2393     else
2394     DupString(yy_aconf->reason, "No reason");
2395 adx 30 add_conf_by_address(CONF_DLINE, yy_aconf);
2396 michael 1005 yy_aconf = NULL;
2397     }
2398 adx 30 }
2399     };
2400    
2401     deny_items: deny_items deny_item | deny_item;
2402     deny_item: deny_ip | deny_reason | error;
2403    
2404     deny_ip: IP '=' QSTRING ';'
2405     {
2406 michael 967 if (conf_parser_ctx.pass == 2)
2407 michael 1005 strlcpy(hostbuf, yylval.string, sizeof(hostbuf));
2408 adx 30 };
2409    
2410     deny_reason: REASON '=' QSTRING ';'
2411     {
2412 michael 967 if (conf_parser_ctx.pass == 2)
2413 michael 1005 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2414 adx 30 };
2415    
2416     /***************************************************************************
2417     * section exempt
2418     ***************************************************************************/
2419     exempt_entry: EXEMPT '{' exempt_items '}' ';';
2420    
2421     exempt_items: exempt_items exempt_item | exempt_item;
2422     exempt_item: exempt_ip | error;
2423    
2424     exempt_ip: IP '=' QSTRING ';'
2425     {
2426 michael 967 if (conf_parser_ctx.pass == 2)
2427 adx 30 {
2428     if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2429     {
2430 michael 1005 yy_aconf = map_to_conf(make_conf_item(EXEMPTDLINE_TYPE));
2431 adx 30 DupString(yy_aconf->host, yylval.string);
2432    
2433     add_conf_by_address(CONF_EXEMPTDLINE, yy_aconf);
2434     yy_aconf = NULL;
2435     }
2436     }
2437     };
2438    
2439     /***************************************************************************
2440     * section gecos
2441     ***************************************************************************/
2442     gecos_entry: GECOS
2443     {
2444 michael 967 if (conf_parser_ctx.pass == 2)
2445 adx 30 {
2446     regex_ban = 0;
2447     reasonbuf[0] = gecos_name[0] = '\0';
2448     }
2449     } '{' gecos_items '}' ';'
2450     {
2451 michael 967 if (conf_parser_ctx.pass == 2)
2452 adx 30 {
2453     if (gecos_name[0])
2454     {
2455     if (regex_ban)
2456     {
2457 michael 1009 #ifdef HAVE_LIBPCRE
2458     void *exp_p = NULL;
2459 adx 30 const char *errptr = NULL;
2460    
2461     if (!(exp_p = ircd_pcre_compile(gecos_name, &errptr)))
2462     {
2463 michael 1247 ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: %s",
2464 michael 595 errptr);
2465 adx 30 break;
2466     }
2467    
2468     yy_conf = make_conf_item(RXLINE_TYPE);
2469     yy_conf->regexpname = exp_p;
2470 michael 1009 #else
2471 michael 1247 ilog(LOG_TYPE_IRCD, "Failed to add regular expression based X-Line: no PCRE support");
2472 michael 1009 break;
2473     #endif
2474 adx 30 }
2475     else
2476     yy_conf = make_conf_item(XLINE_TYPE);
2477    
2478     yy_match_item = map_to_conf(yy_conf);
2479     DupString(yy_conf->name, gecos_name);
2480    
2481     if (reasonbuf[0])
2482     DupString(yy_match_item->reason, reasonbuf);
2483     else
2484     DupString(yy_match_item->reason, "No reason");
2485     }
2486     }
2487     };
2488    
2489     gecos_flags: TYPE
2490     {
2491     } '=' gecos_flags_items ';';
2492    
2493     gecos_flags_items: gecos_flags_items ',' gecos_flags_item | gecos_flags_item;
2494     gecos_flags_item: REGEX_T
2495     {
2496 michael 967 if (conf_parser_ctx.pass == 2)
2497 adx 30 regex_ban = 1;
2498     };
2499    
2500     gecos_items: gecos_items gecos_item | gecos_item;
2501     gecos_item: gecos_name | gecos_reason | gecos_flags | error;
2502    
2503     gecos_name: NAME '=' QSTRING ';'
2504     {
2505 michael 967 if (conf_parser_ctx.pass == 2)
2506 adx 30 strlcpy(gecos_name, yylval.string, sizeof(gecos_name));
2507     };
2508    
2509     gecos_reason: REASON '=' QSTRING ';'
2510     {
2511 michael 967 if (conf_parser_ctx.pass == 2)
2512 adx 30 strlcpy(reasonbuf, yylval.string, sizeof(reasonbuf));
2513     };
2514    
2515     /***************************************************************************
2516     * section general
2517     ***************************************************************************/
2518     general_entry: GENERAL
2519     '{' general_items '}' ';';
2520    
2521     general_items: general_items general_item | general_item;
2522     general_item: general_hide_spoof_ips | general_ignore_bogus_ts |
2523     general_failed_oper_notice | general_anti_nick_flood |
2524     general_max_nick_time | general_max_nick_changes |
2525     general_max_accept | general_anti_spam_exit_message_time |
2526     general_ts_warn_delta | general_ts_max_delta |
2527     general_kill_chase_time_limit | general_kline_with_reason |
2528     general_kline_reason | general_invisible_on_connect |
2529     general_warn_no_nline | general_dots_in_ident |
2530     general_stats_o_oper_only | general_stats_k_oper_only |
2531     general_pace_wait | general_stats_i_oper_only |
2532     general_pace_wait_simple | general_stats_P_oper_only |
2533     general_short_motd | general_no_oper_flood |
2534     general_true_no_oper_flood | general_oper_pass_resv |
2535 michael 1176 general_message_locale |
2536 adx 30 general_oper_only_umodes | general_max_targets |
2537     general_use_egd | general_egdpool_path |
2538     general_oper_umodes | general_caller_id_wait |
2539     general_opers_bypass_callerid | general_default_floodcount |
2540     general_min_nonwildcard | general_min_nonwildcard_simple |
2541 michael 1302 general_disable_remote_commands |
2542     general_client_flood |
2543 adx 30 general_throttle_time | general_havent_read_conf |
2544 michael 1072 general_ping_cookie |
2545 michael 1264 general_disable_auth |
2546 michael 1459 general_tkline_expire_notices | general_gline_enable |
2547     general_gline_duration | general_gline_request_duration |
2548     general_gline_min_cidr |
2549 adx 30 general_gline_min_cidr6 | general_use_whois_actually |
2550 michael 584 general_reject_hold_time | general_stats_e_disabled |
2551 michael 1176 general_max_watch | general_services_name |
2552 adx 30 error;
2553    
2554    
2555 michael 876 general_max_watch: MAX_WATCH '=' NUMBER ';'
2556     {
2557     ConfigFileEntry.max_watch = $3;
2558     };
2559 adx 30
2560 michael 1459 general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2561     {
2562     if (conf_parser_ctx.pass == 2)
2563     ConfigFileEntry.glines = yylval.number;
2564     };
2565    
2566     general_gline_duration: GLINE_DURATION '=' timespec ';'
2567     {
2568     if (conf_parser_ctx.pass == 2)
2569     ConfigFileEntry.gline_time = $3;
2570     };
2571    
2572     general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2573     {
2574     if (conf_parser_ctx.pass == 2)
2575     ConfigFileEntry.gline_request_time = $3;
2576     };
2577    
2578 adx 30 general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2579     {
2580     ConfigFileEntry.gline_min_cidr = $3;
2581     };
2582    
2583     general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2584     {
2585     ConfigFileEntry.gline_min_cidr6 = $3;
2586     };
2587    
2588     general_use_whois_actually: USE_WHOIS_ACTUALLY '=' TBOOL ';'
2589     {
2590     ConfigFileEntry.use_whois_actually = yylval.number;
2591     };
2592    
2593     general_reject_hold_time: TREJECT_HOLD_TIME '=' timespec ';'
2594     {
2595     GlobalSetOptions.rejecttime = yylval.number;
2596     };
2597    
2598     general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2599     {
2600     ConfigFileEntry.tkline_expire_notices = yylval.number;
2601     };
2602    
2603 michael 1074 general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2604 adx 30 {
2605     ConfigFileEntry.kill_chase_time_limit = $3;
2606     };
2607    
2608     general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2609     {
2610     ConfigFileEntry.hide_spoof_ips = yylval.number;
2611     };
2612    
2613     general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2614     {
2615     ConfigFileEntry.ignore_bogus_ts = yylval.number;
2616     };
2617    
2618     general_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
2619     {
2620     ConfigFileEntry.disable_remote = yylval.number;
2621     };
2622    
2623     general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2624     {
2625     ConfigFileEntry.failed_oper_notice = yylval.number;
2626     };
2627    
2628     general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2629     {
2630     ConfigFileEntry.anti_nick_flood = yylval.number;
2631     };
2632    
2633     general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2634     {
2635     ConfigFileEntry.max_nick_time = $3;
2636     };
2637    
2638     general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2639     {
2640     ConfigFileEntry.max_nick_changes = $3;
2641     };
2642    
2643     general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2644     {
2645     ConfigFileEntry.max_accept = $3;
2646     };
2647    
2648     general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2649     {
2650     ConfigFileEntry.anti_spam_exit_message_time = $3;
2651     };
2652    
2653     general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2654     {
2655     ConfigFileEntry.ts_warn_delta = $3;
2656     };
2657    
2658     general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2659     {
2660 michael 967 if (conf_parser_ctx.pass == 2)
2661 adx 30 ConfigFileEntry.ts_max_delta = $3;
2662     };
2663    
2664     general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2665     {
2666 michael 967 if (($3 > 0) && conf_parser_ctx.pass == 1)
2667 adx 30 {
2668 michael 1247 ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2669     ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2670     ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2671 adx 30 exit(0);
2672     }
2673     };
2674    
2675     general_kline_with_reason: KLINE_WITH_REASON '=' TBOOL ';'
2676     {
2677     ConfigFileEntry.kline_with_reason = yylval.number;
2678     };
2679    
2680     general_kline_reason: KLINE_REASON '=' QSTRING ';'
2681     {
2682 michael 967 if (conf_parser_ctx.pass == 2)
2683 adx 30 {
2684     MyFree(ConfigFileEntry.kline_reason);
2685     DupString(ConfigFileEntry.kline_reason, yylval.string);
2686     }
2687     };
2688    
2689     general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2690     {
2691     ConfigFileEntry.invisible_on_connect = yylval.number;
2692     };
2693    
2694     general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';'
2695     {
2696     ConfigFileEntry.warn_no_nline = yylval.number;
2697     };
2698    
2699 michael 584 general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2700     {
2701     ConfigFileEntry.stats_e_disabled = yylval.number;
2702     };
2703    
2704 adx 30 general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2705     {
2706     ConfigFileEntry.stats_o_oper_only = yylval.number;
2707     };
2708    
2709     general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2710     {
2711     ConfigFileEntry.stats_P_oper_only = yylval.number;
2712     };
2713    
2714     general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2715     {
2716     ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2717     } | STATS_K_OPER_ONLY '=' TMASKED ';'
2718     {
2719     ConfigFileEntry.stats_k_oper_only = 1;
2720     };
2721    
2722     general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2723     {
2724     ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2725     } | STATS_I_OPER_ONLY '=' TMASKED ';'
2726     {
2727     ConfigFileEntry.stats_i_oper_only = 1;
2728     };
2729    
2730     general_pace_wait: PACE_WAIT '=' timespec ';'
2731     {
2732     ConfigFileEntry.pace_wait = $3;
2733     };
2734    
2735     general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2736     {
2737     ConfigFileEntry.caller_id_wait = $3;
2738     };
2739    
2740     general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2741     {
2742     ConfigFileEntry.opers_bypass_callerid = yylval.number;
2743     };
2744    
2745     general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2746     {
2747     ConfigFileEntry.pace_wait_simple = $3;
2748     };
2749    
2750     general_short_motd: SHORT_MOTD '=' TBOOL ';'
2751     {
2752     ConfigFileEntry.short_motd = yylval.number;
2753     };
2754    
2755     general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2756     {
2757     ConfigFileEntry.no_oper_flood = yylval.number;
2758     };
2759    
2760     general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2761     {
2762     ConfigFileEntry.true_no_oper_flood = yylval.number;
2763     };
2764    
2765     general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2766     {
2767     ConfigFileEntry.oper_pass_resv = yylval.number;
2768     };
2769    
2770     general_message_locale: MESSAGE_LOCALE '=' QSTRING ';'
2771     {
2772 michael 967 if (conf_parser_ctx.pass == 2)
2773 adx 30 {
2774     if (strlen(yylval.string) > LOCALE_LENGTH-2)
2775     yylval.string[LOCALE_LENGTH-1] = '\0';
2776    
2777     set_locale(yylval.string);
2778     }
2779     };
2780    
2781     general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2782     {
2783     ConfigFileEntry.dots_in_ident = $3;
2784     };
2785    
2786     general_max_targets: MAX_TARGETS '=' NUMBER ';'
2787     {
2788     ConfigFileEntry.max_targets = $3;
2789     };
2790    
2791     general_use_egd: USE_EGD '=' TBOOL ';'
2792     {
2793     ConfigFileEntry.use_egd = yylval.number;
2794     };
2795    
2796     general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2797     {
2798 michael 967 if (conf_parser_ctx.pass == 2)
2799 adx 30 {
2800     MyFree(ConfigFileEntry.egdpool_path);
2801     DupString(ConfigFileEntry.egdpool_path, yylval.string);
2802     }
2803     };
2804    
2805 michael 1176 general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2806 michael 1157 {
2807 michael 1176 if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2808 michael 1157 {
2809     MyFree(ConfigFileEntry.service_name);
2810     DupString(ConfigFileEntry.service_name, yylval.string);
2811     }
2812     };
2813    
2814 adx 30 general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2815     {
2816     ConfigFileEntry.ping_cookie = yylval.number;
2817     };
2818    
2819     general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2820     {
2821     ConfigFileEntry.disable_auth = yylval.number;
2822     };
2823    
2824     general_throttle_time: THROTTLE_TIME '=' timespec ';'
2825     {
2826     ConfigFileEntry.throttle_time = yylval.number;
2827     };
2828    
2829     general_oper_umodes: OPER_UMODES
2830     {
2831     ConfigFileEntry.oper_umodes = 0;
2832     } '=' umode_oitems ';' ;
2833    
2834     umode_oitems: umode_oitems ',' umode_oitem | umode_oitem;
2835     umode_oitem: T_BOTS
2836     {
2837     ConfigFileEntry.oper_umodes |= UMODE_BOTS;
2838     } | T_CCONN
2839     {
2840     ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2841 db 849 } | T_CCONN_FULL
2842     {
2843     ConfigFileEntry.oper_umodes |= UMODE_CCONN_FULL;
2844 adx 30 } | T_DEAF
2845     {
2846     ConfigFileEntry.oper_umodes |= UMODE_DEAF;
2847     } | T_DEBUG
2848     {
2849     ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
2850     } | T_FULL
2851     {
2852     ConfigFileEntry.oper_umodes |= UMODE_FULL;
2853 michael 1294 } | HIDDEN
2854     {
2855     ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2856 adx 30 } | T_SKILL
2857     {
2858     ConfigFileEntry.oper_umodes |= UMODE_SKILL;
2859     } | T_NCHANGE
2860     {
2861     ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
2862     } | T_REJ
2863     {
2864     ConfigFileEntry.oper_umodes |= UMODE_REJ;
2865     } | T_UNAUTH
2866     {
2867     ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
2868     } | T_SPY
2869     {
2870     ConfigFileEntry.oper_umodes |= UMODE_SPY;
2871     } | T_EXTERNAL
2872     {
2873     ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
2874     } | T_OPERWALL
2875     {
2876     ConfigFileEntry.oper_umodes |= UMODE_OPERWALL;
2877     } | T_SERVNOTICE
2878     {
2879     ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
2880     } | T_INVISIBLE
2881     {
2882     ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
2883     } | T_WALLOP
2884     {
2885     ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
2886     } | T_SOFTCALLERID
2887     {
2888     ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
2889     } | T_CALLERID
2890     {
2891     ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
2892     } | T_LOCOPS
2893     {
2894     ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2895     };
2896    
2897     general_oper_only_umodes: OPER_ONLY_UMODES
2898     {
2899     ConfigFileEntry.oper_only_umodes = 0;
2900     } '=' umode_items ';' ;
2901    
2902     umode_items: umode_items ',' umode_item | umode_item;
2903     umode_item: T_BOTS
2904     {
2905     ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2906     } | T_CCONN
2907     {
2908     ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2909 db 853 } | T_CCONN_FULL
2910     {
2911     ConfigFileEntry.oper_only_umodes |= UMODE_CCONN_FULL;
2912 adx 30 } | T_DEAF
2913     {
2914     ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
2915     } | T_DEBUG
2916     {
2917     ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2918     } | T_FULL
2919     {
2920     ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2921     } | T_SKILL
2922     {
2923     ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2924 michael 1294 } | HIDDEN
2925     {
2926     ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
2927 adx 30 } | T_NCHANGE
2928     {
2929     ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
2930     } | T_REJ
2931     {
2932     ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
2933     } | T_UNAUTH
2934     {
2935     ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
2936     } | T_SPY
2937     {
2938     ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
2939     } | T_EXTERNAL
2940     {
2941     ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
2942     } | T_OPERWALL
2943     {
2944     ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL;
2945     } | T_SERVNOTICE
2946     {
2947     ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
2948     } | T_INVISIBLE
2949     {
2950     ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
2951     } | T_WALLOP
2952     {
2953     ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
2954     } | T_SOFTCALLERID
2955     {
2956     ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
2957     } | T_CALLERID
2958     {
2959     ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
2960     } | T_LOCOPS
2961     {
2962     ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
2963     };
2964    
2965     general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2966     {
2967     ConfigFileEntry.min_nonwildcard = $3;
2968     };
2969    
2970     general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2971     {
2972     ConfigFileEntry.min_nonwildcard_simple = $3;
2973     };
2974    
2975     general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2976     {
2977     ConfigFileEntry.default_floodcount = $3;
2978     };
2979    
2980     general_client_flood: T_CLIENT_FLOOD '=' sizespec ';'
2981     {
2982     ConfigFileEntry.client_flood = $3;
2983     };
2984    
2985    
2986     /***************************************************************************
2987     * section channel
2988     ***************************************************************************/
2989     channel_entry: CHANNEL
2990     '{' channel_items '}' ';';
2991    
2992     channel_items: channel_items channel_item | channel_item;
2993     channel_item: channel_disable_local_channels | channel_use_except |
2994 michael 1432 channel_use_invex | channel_use_knock | channel_max_bans |
2995     channel_knock_delay | channel_knock_delay_channel |
2996     channel_max_chans_per_user | channel_max_chans_per_oper |
2997 adx 201 channel_quiet_on_ban | channel_default_split_user_count |
2998     channel_default_split_server_count |
2999     channel_no_create_on_split | channel_restrict_channels |
3000 michael 1401 channel_no_join_on_split |
3001 adx 201 channel_jflood_count | channel_jflood_time |
3002 michael 632 channel_disable_fake_channels | error;
3003 adx 30
3004 michael 632 channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
3005     {
3006     ConfigChannel.disable_fake_channels = yylval.number;
3007     };
3008    
3009 adx 30 channel_restrict_channels: RESTRICT_CHANNELS '=' TBOOL ';'
3010     {
3011     ConfigChannel.restrict_channels = yylval.number;
3012     };
3013    
3014     channel_disable_local_channels: DISABLE_LOCAL_CHANNELS '=' TBOOL ';'
3015     {
3016     ConfigChannel.disable_local_channels = yylval.number;
3017     };
3018    
3019     channel_use_except: USE_EXCEPT '=' TBOOL ';'
3020     {
3021     ConfigChannel.use_except = yylval.number;
3022     };
3023    
3024     channel_use_invex: USE_INVEX '=' TBOOL ';'
3025     {
3026     ConfigChannel.use_invex = yylval.number;
3027     };
3028    
3029     channel_use_knock: USE_KNOCK '=' TBOOL ';'
3030     {
3031     ConfigChannel.use_knock = yylval.number;
3032     };
3033    
3034     channel_knock_delay: KNOCK_DELAY '=' timespec ';'
3035     {
3036     ConfigChannel.knock_delay = $3;
3037     };
3038    
3039     channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
3040     {
3041     ConfigChannel.knock_delay_channel = $3;
3042     };
3043    
3044     channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
3045     {
3046     ConfigChannel.max_chans_per_user = $3;
3047     };
3048    
3049 michael 1432 channel_max_chans_per_oper: MAX_CHANS_PER_OPER '=' NUMBER ';'
3050     {
3051     ConfigChannel.max_chans_per_oper = $3;
3052     };
3053    
3054 adx 30 channel_quiet_on_ban: QUIET_ON_BAN '=' TBOOL ';'
3055     {
3056     ConfigChannel.quiet_on_ban = yylval.number;
3057     };
3058    
3059     channel_max_bans: MAX_BANS '=' NUMBER ';'
3060     {
3061     ConfigChannel.max_bans = $3;
3062     };
3063    
3064     channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
3065     {
3066     ConfigChannel.default_split_user_count = $3;
3067     };
3068    
3069     channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
3070     {
3071     ConfigChannel.default_split_server_count = $3;
3072     };
3073    
3074     channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
3075     {
3076     ConfigChannel.no_create_on_split = yylval.number;
3077     };
3078    
3079     channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
3080     {
3081     ConfigChannel.no_join_on_split = yylval.number;
3082     };
3083    
3084     channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
3085     {
3086     GlobalSetOptions.joinfloodcount = yylval.number;
3087     };
3088    
3089     channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
3090     {
3091     GlobalSetOptions.joinfloodtime = yylval.number;
3092     };
3093    
3094     /***************************************************************************
3095     * section serverhide
3096     ***************************************************************************/
3097     serverhide_entry: SERVERHIDE
3098     '{' serverhide_items '}' ';';
3099    
3100     serverhide_items: serverhide_items serverhide_item | serverhide_item;
3101     serverhide_item: serverhide_flatten_links | serverhide_hide_servers |
3102     serverhide_links_delay |
3103     serverhide_disable_hidden |
3104     serverhide_hidden | serverhide_hidden_name |
3105     serverhide_hide_server_ips |
3106     error;
3107    
3108     serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3109     {
3110 michael 967 if (conf_parser_ctx.pass == 2)
3111 adx 30 ConfigServerHide.flatten_links = yylval.number;
3112     };
3113    
3114     serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3115     {
3116 michael 967 if (conf_parser_ctx.pass == 2)
3117 adx 30 ConfigServerHide.hide_servers = yylval.number;
3118     };
3119    
3120     serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3121     {
3122 michael 967 if (conf_parser_ctx.pass == 2)
3123 adx 30 {
3124     MyFree(ConfigServerHide.hidden_name);
3125     DupString(ConfigServerHide.hidden_name, yylval.string);
3126     }
3127     };
3128    
3129     serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3130     {
3131 michael 967 if (conf_parser_ctx.pass == 2)
3132 adx 30 {
3133     if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3134     {
3135     eventAddIsh("write_links_file", write_links_file, NULL, $3);
3136     ConfigServerHide.links_disabled = 0;
3137     }
3138    
3139     ConfigServerHide.links_delay = $3;
3140     }
3141     };
3142    
3143     serverhide_hidden: HIDDEN '=' TBOOL ';'
3144     {
3145 michael 967 if (conf_parser_ctx.pass == 2)
3146 adx 30 ConfigServerHide.hidden = yylval.number;
3147     };
3148    
3149     serverhide_disable_hidden: DISABLE_HIDDEN '=' TBOOL ';'
3150     {
3151 michael 967 if (conf_parser_ctx.pass == 2)
3152 adx 30 ConfigServerHide.disable_hidden = yylval.number;
3153     };
3154    
3155     serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3156     {
3157 michael 967 if (conf_parser_ctx.pass == 2)
3158 adx 30 ConfigServerHide.hide_server_ips = yylval.number;
3159     };

Properties

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