ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 1459
Committed: Fri Jul 6 14:23:09 2012 UTC (13 years, 1 month ago) by michael
Original Path: ircd-hybrid-8/src/conf_parser.y
File size: 75060 byte(s)
Log Message:
- remove g-line acls
- added general::gline_request_duration configuration option which
  simply replaces the harcoded PENDING_GLINE_TIME definition

File Contents

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

Properties

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