ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1378
Committed: Mon Apr 30 19:43:34 2012 UTC (13 years, 3 months ago) by michael
Original Path: ircd-hybrid-8/src/conf_parser.y
File size: 81739 byte(s)
Log Message:
- Get rid of OPERNICKLEN. Oper login IDs are no longer limited to NICKLEN*2

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

Properties

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