ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 3762
Committed: Sun Jun 1 19:35:16 2014 UTC (11 years, 2 months ago) by michael
File size: 77702 byte(s)
Log Message:
- Added INVITE flood protection/throttling as requested by Adam. This basically
  works similar as the KNOCK throttling algorithm.

File Contents

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

Properties

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