ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 3869
Committed: Thu Jun 5 22:19:27 2014 UTC (11 years, 2 months ago) by michael
File size: 77588 byte(s)
Log Message:
- Removed OPERWALL. Use GLOBOPS instead.

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 3860 %token INVITE_CLIENT_COUNT
210     %token INVITE_CLIENT_TIME
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 michael 3860 %token KNOCK_CLIENT_COUNT
222     %token KNOCK_CLIENT_TIME
223 adx 30 %token KNOCK_DELAY_CHANNEL
224     %token LEAF_MASK
225     %token LINKS_DELAY
226     %token LISTEN
227 michael 1858 %token MASK
228 adx 30 %token MAX_ACCEPT
229     %token MAX_BANS
230 michael 1432 %token MAX_CHANS_PER_OPER
231 adx 30 %token MAX_CHANS_PER_USER
232     %token MAX_GLOBAL
233     %token MAX_IDENT
234 michael 2129 %token MAX_IDLE
235 adx 30 %token MAX_LOCAL
236     %token MAX_NICK_CHANGES
237 michael 1751 %token MAX_NICK_LENGTH
238 adx 30 %token MAX_NICK_TIME
239     %token MAX_NUMBER
240     %token MAX_TARGETS
241 michael 1751 %token MAX_TOPIC_LENGTH
242 michael 876 %token MAX_WATCH
243 michael 2129 %token MIN_IDLE
244 adx 30 %token MIN_NONWILDCARD
245     %token MIN_NONWILDCARD_SIMPLE
246     %token MODULE
247     %token MODULES
248 michael 2150 %token MOTD
249 adx 30 %token NAME
250 michael 2129 %token NEED_IDENT
251 adx 30 %token NEED_PASSWORD
252     %token NETWORK_DESC
253     %token NETWORK_NAME
254     %token NICK
255     %token NO_CREATE_ON_SPLIT
256     %token NO_JOIN_ON_SPLIT
257     %token NO_OPER_FLOOD
258     %token NO_TILDE
259     %token NUMBER
260     %token NUMBER_PER_CIDR
261     %token NUMBER_PER_IP
262     %token OPER_ONLY_UMODES
263     %token OPER_PASS_RESV
264     %token OPER_UMODES
265 michael 2129 %token OPERATOR
266     %token OPERS_BYPASS_CALLERID
267 adx 30 %token PACE_WAIT
268     %token PACE_WAIT_SIMPLE
269     %token PASSWORD
270     %token PATH
271     %token PING_COOKIE
272     %token PING_TIME
273     %token PORT
274     %token QSTRING
275 michael 2129 %token RANDOM_IDLE
276 adx 30 %token REASON
277     %token REDIRPORT
278     %token REDIRSERV
279     %token REHASH
280     %token REMOTE
281     %token REMOTEBAN
282 michael 2129 %token RESV
283     %token RESV_EXEMPT
284 adx 30 %token RSA_PRIVATE_KEY_FILE
285     %token RSA_PUBLIC_KEY_FILE
286 michael 1783 %token SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS
287 michael 2129 %token SEND_PASSWORD
288 adx 30 %token SENDQ
289     %token SERVERHIDE
290     %token SERVERINFO
291     %token SHORT_MOTD
292     %token SPOOF
293     %token SPOOF_NOTICE
294 michael 2129 %token SQUIT
295     %token SSL_CERTIFICATE_FILE
296 michael 2244 %token SSL_CERTIFICATE_FINGERPRINT
297 michael 2248 %token SSL_CONNECTION_REQUIRED
298 michael 2129 %token SSL_DH_PARAM_FILE
299 michael 584 %token STATS_E_DISABLED
300 adx 30 %token STATS_I_OPER_ONLY
301     %token STATS_K_OPER_ONLY
302     %token STATS_O_OPER_ONLY
303     %token STATS_P_OPER_ONLY
304 michael 2269 %token STATS_U_OPER_ONLY
305 adx 30 %token T_ALL
306     %token T_BOTS
307     %token T_CALLERID
308     %token T_CCONN
309 michael 2129 %token T_CLUSTER
310 adx 30 %token T_DEAF
311     %token T_DEBUG
312 michael 1247 %token T_DLINE
313 adx 30 %token T_EXTERNAL
314 michael 1976 %token T_FARCONNECT
315 michael 2129 %token T_FILE
316 adx 30 %token T_FULL
317 michael 2129 %token T_GLOBOPS
318 adx 30 %token T_INVISIBLE
319     %token T_IPV4
320     %token T_IPV6
321     %token T_LOCOPS
322 michael 2129 %token T_LOG
323 adx 30 %token T_MAX_CLIENTS
324     %token T_NCHANGE
325 michael 1855 %token T_NONONREG
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_SERVNOTICE
1227     {
1228 michael 967 if (conf_parser_ctx.pass == 2)
1229 michael 1646 block_state.modes.value |= UMODE_SERVNOTICE;
1230 michael 56 } | T_INVISIBLE
1231     {
1232 michael 967 if (conf_parser_ctx.pass == 2)
1233 michael 1646 block_state.modes.value |= UMODE_INVISIBLE;
1234 michael 56 } | T_WALLOP
1235     {
1236 michael 967 if (conf_parser_ctx.pass == 2)
1237 michael 1646 block_state.modes.value |= UMODE_WALLOP;
1238 michael 56 } | T_SOFTCALLERID
1239     {
1240 michael 967 if (conf_parser_ctx.pass == 2)
1241 michael 1646 block_state.modes.value |= UMODE_SOFTCALLERID;
1242 michael 56 } | T_CALLERID
1243     {
1244 michael 967 if (conf_parser_ctx.pass == 2)
1245 michael 1646 block_state.modes.value |= UMODE_CALLERID;
1246 michael 56 } | T_LOCOPS
1247     {
1248 michael 967 if (conf_parser_ctx.pass == 2)
1249 michael 1646 block_state.modes.value |= UMODE_LOCOPS;
1250 michael 1855 } | T_NONONREG
1251     {
1252     if (conf_parser_ctx.pass == 2)
1253     block_state.modes.value |= UMODE_REGONLY;
1254 michael 1976 } | T_FARCONNECT
1255     {
1256     if (conf_parser_ctx.pass == 2)
1257     block_state.modes.value |= UMODE_FARCONNECT;
1258 michael 56 };
1259    
1260 adx 30 oper_flags: IRCD_FLAGS
1261     {
1262 michael 1228 if (conf_parser_ctx.pass == 2)
1263 michael 1646 block_state.port.value = 0;
1264 adx 30 } '=' oper_flags_items ';';
1265    
1266     oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1267 michael 2012 oper_flags_item: KILL ':' REMOTE
1268 adx 30 {
1269 michael 967 if (conf_parser_ctx.pass == 2)
1270 michael 2012 block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1271     } | KILL
1272 adx 30 {
1273 michael 967 if (conf_parser_ctx.pass == 2)
1274 michael 2012 block_state.port.value |= OPER_FLAG_KILL;
1275     } | CONNECT ':' REMOTE
1276     {
1277     if (conf_parser_ctx.pass == 2)
1278     block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1279     } | CONNECT
1280     {
1281     if (conf_parser_ctx.pass == 2)
1282     block_state.port.value |= OPER_FLAG_CONNECT;
1283     } | SQUIT ':' REMOTE
1284     {
1285     if (conf_parser_ctx.pass == 2)
1286     block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1287     } | SQUIT
1288     {
1289     if (conf_parser_ctx.pass == 2)
1290     block_state.port.value |= OPER_FLAG_SQUIT;
1291 adx 30 } | KLINE
1292     {
1293 michael 967 if (conf_parser_ctx.pass == 2)
1294 michael 1646 block_state.port.value |= OPER_FLAG_K;
1295 adx 30 } | UNKLINE
1296     {
1297 michael 967 if (conf_parser_ctx.pass == 2)
1298 michael 1646 block_state.port.value |= OPER_FLAG_UNKLINE;
1299 michael 1301 } | T_DLINE
1300     {
1301     if (conf_parser_ctx.pass == 2)
1302 michael 1646 block_state.port.value |= OPER_FLAG_DLINE;
1303 michael 1301 } | T_UNDLINE
1304     {
1305     if (conf_parser_ctx.pass == 2)
1306 michael 1646 block_state.port.value |= OPER_FLAG_UNDLINE;
1307 adx 30 } | XLINE
1308     {
1309 michael 967 if (conf_parser_ctx.pass == 2)
1310 michael 2852 block_state.port.value |= OPER_FLAG_XLINE;
1311     } | T_UNXLINE
1312     {
1313     if (conf_parser_ctx.pass == 2)
1314     block_state.port.value |= OPER_FLAG_UNXLINE;
1315 adx 30 } | GLINE
1316     {
1317 michael 967 if (conf_parser_ctx.pass == 2)
1318 michael 1646 block_state.port.value |= OPER_FLAG_GLINE;
1319 adx 30 } | DIE
1320     {
1321 michael 967 if (conf_parser_ctx.pass == 2)
1322 michael 1646 block_state.port.value |= OPER_FLAG_DIE;
1323 michael 1228 } | T_RESTART
1324     {
1325     if (conf_parser_ctx.pass == 2)
1326 michael 1646 block_state.port.value |= OPER_FLAG_RESTART;
1327 adx 30 } | REHASH
1328     {
1329 michael 967 if (conf_parser_ctx.pass == 2)
1330 michael 1646 block_state.port.value |= OPER_FLAG_REHASH;
1331 adx 30 } | ADMIN
1332     {
1333 michael 967 if (conf_parser_ctx.pass == 2)
1334 michael 1646 block_state.port.value |= OPER_FLAG_ADMIN;
1335 michael 1216 } | T_GLOBOPS
1336     {
1337     if (conf_parser_ctx.pass == 2)
1338 michael 1646 block_state.port.value |= OPER_FLAG_GLOBOPS;
1339 michael 2038 } | T_WALLOPS
1340     {
1341     if (conf_parser_ctx.pass == 2)
1342     block_state.port.value |= OPER_FLAG_WALLOPS;
1343     } | T_LOCOPS
1344     {
1345     if (conf_parser_ctx.pass == 2)
1346     block_state.port.value |= OPER_FLAG_LOCOPS;
1347 adx 30 } | REMOTEBAN
1348     {
1349 michael 967 if (conf_parser_ctx.pass == 2)
1350 michael 1646 block_state.port.value |= OPER_FLAG_REMOTEBAN;
1351 michael 1460 } | T_SET
1352     {
1353     if (conf_parser_ctx.pass == 2)
1354 michael 1646 block_state.port.value |= OPER_FLAG_SET;
1355 michael 1228 } | MODULE
1356 adx 30 {
1357 michael 967 if (conf_parser_ctx.pass == 2)
1358 michael 1646 block_state.port.value |= OPER_FLAG_MODULE;
1359 adx 30 };
1360    
1361    
1362     /***************************************************************************
1363     * section class
1364     ***************************************************************************/
1365     class_entry: CLASS
1366     {
1367 michael 1651 if (conf_parser_ctx.pass != 1)
1368     break;
1369    
1370     reset_block_state();
1371    
1372     block_state.ping_freq.value = DEFAULT_PINGFREQUENCY;
1373     block_state.con_freq.value = DEFAULT_CONNECTFREQUENCY;
1374     block_state.max_total.value = MAXIMUM_LINKS_DEFAULT;
1375     block_state.max_sendq.value = DEFAULT_SENDQ;
1376     block_state.max_recvq.value = DEFAULT_RECVQ;
1377 michael 1285 } '{' class_items '}' ';'
1378 adx 30 {
1379 michael 1647 struct ClassItem *class = NULL;
1380 adx 30
1381 michael 1647 if (conf_parser_ctx.pass != 1)
1382     break;
1383 adx 30
1384 michael 1647 if (!block_state.class.buf[0])
1385     break;
1386 michael 671
1387 michael 1647 if (!(class = class_find(block_state.class.buf, 0)))
1388     class = class_make();
1389 michael 671
1390 michael 1647 class->active = 1;
1391     MyFree(class->name);
1392     class->name = xstrdup(block_state.class.buf);
1393     class->ping_freq = block_state.ping_freq.value;
1394     class->max_perip = block_state.max_perip.value;
1395     class->con_freq = block_state.con_freq.value;
1396     class->max_total = block_state.max_total.value;
1397     class->max_global = block_state.max_global.value;
1398     class->max_local = block_state.max_local.value;
1399     class->max_ident = block_state.max_ident.value;
1400     class->max_sendq = block_state.max_sendq.value;
1401     class->max_recvq = block_state.max_recvq.value;
1402 michael 671
1403 michael 1785 if (block_state.min_idle.value > block_state.max_idle.value)
1404     {
1405     block_state.min_idle.value = 0;
1406     block_state.max_idle.value = 0;
1407     block_state.flags.value &= ~CLASS_FLAGS_FAKE_IDLE;
1408     }
1409    
1410     class->flags = block_state.flags.value;
1411     class->min_idle = block_state.min_idle.value;
1412     class->max_idle = block_state.max_idle.value;
1413    
1414 michael 1647 if (class->number_per_cidr && block_state.number_per_cidr.value)
1415     if ((class->cidr_bitlen_ipv4 && block_state.cidr_bitlen_ipv4.value) ||
1416     (class->cidr_bitlen_ipv6 && block_state.cidr_bitlen_ipv6.value))
1417     if ((class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value) ||
1418     (class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value))
1419     rebuild_cidr_list(class);
1420 adx 30
1421 michael 1647 class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1422     class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1423     class->number_per_cidr = block_state.number_per_cidr.value;
1424 adx 30 };
1425    
1426     class_items: class_items class_item | class_item;
1427     class_item: class_name |
1428 michael 3439 class_cidr_bitlen_ipv4 |
1429     class_cidr_bitlen_ipv6 |
1430 adx 30 class_ping_time |
1431 michael 3439 class_number_per_cidr |
1432 adx 30 class_number_per_ip |
1433     class_connectfreq |
1434     class_max_number |
1435 michael 3439 class_max_global |
1436     class_max_local |
1437     class_max_ident |
1438 michael 1516 class_sendq | class_recvq |
1439 michael 1783 class_min_idle |
1440     class_max_idle |
1441     class_flags |
1442 michael 3439 error ';' ;
1443 adx 30
1444 michael 2916 class_name: NAME '=' QSTRING ';'
1445 adx 30 {
1446 michael 967 if (conf_parser_ctx.pass == 1)
1447 michael 1647 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1448 adx 30 };
1449    
1450     class_ping_time: PING_TIME '=' timespec ';'
1451     {
1452 michael 967 if (conf_parser_ctx.pass == 1)
1453 michael 1647 block_state.ping_freq.value = $3;
1454 adx 30 };
1455    
1456     class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1457     {
1458 michael 967 if (conf_parser_ctx.pass == 1)
1459 michael 1647 block_state.max_perip.value = $3;
1460 adx 30 };
1461    
1462     class_connectfreq: CONNECTFREQ '=' timespec ';'
1463     {
1464 michael 967 if (conf_parser_ctx.pass == 1)
1465 michael 1647 block_state.con_freq.value = $3;
1466 adx 30 };
1467    
1468     class_max_number: MAX_NUMBER '=' NUMBER ';'
1469     {
1470 michael 967 if (conf_parser_ctx.pass == 1)
1471 michael 1647 block_state.max_total.value = $3;
1472 adx 30 };
1473    
1474     class_max_global: MAX_GLOBAL '=' NUMBER ';'
1475     {
1476 michael 967 if (conf_parser_ctx.pass == 1)
1477 michael 1647 block_state.max_global.value = $3;
1478 adx 30 };
1479    
1480     class_max_local: MAX_LOCAL '=' NUMBER ';'
1481     {
1482 michael 967 if (conf_parser_ctx.pass == 1)
1483 michael 1647 block_state.max_local.value = $3;
1484 adx 30 };
1485    
1486     class_max_ident: MAX_IDENT '=' NUMBER ';'
1487     {
1488 michael 967 if (conf_parser_ctx.pass == 1)
1489 michael 1647 block_state.max_ident.value = $3;
1490 adx 30 };
1491    
1492     class_sendq: SENDQ '=' sizespec ';'
1493     {
1494 michael 967 if (conf_parser_ctx.pass == 1)
1495 michael 1647 block_state.max_sendq.value = $3;
1496 adx 30 };
1497    
1498 michael 1516 class_recvq: T_RECVQ '=' sizespec ';'
1499     {
1500     if (conf_parser_ctx.pass == 1)
1501     if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1502 michael 1647 block_state.max_recvq.value = $3;
1503 michael 1516 };
1504    
1505 adx 30 class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1506     {
1507 michael 967 if (conf_parser_ctx.pass == 1)
1508 michael 1647 block_state.cidr_bitlen_ipv4.value = $3 > 32 ? 32 : $3;
1509 adx 30 };
1510    
1511     class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1512     {
1513 michael 967 if (conf_parser_ctx.pass == 1)
1514 michael 1647 block_state.cidr_bitlen_ipv6.value = $3 > 128 ? 128 : $3;
1515 adx 30 };
1516    
1517     class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1518     {
1519 michael 967 if (conf_parser_ctx.pass == 1)
1520 michael 1647 block_state.number_per_cidr.value = $3;
1521 adx 30 };
1522    
1523 michael 1783 class_min_idle: MIN_IDLE '=' timespec ';'
1524     {
1525 michael 1785 if (conf_parser_ctx.pass != 1)
1526     break;
1527    
1528     block_state.min_idle.value = $3;
1529     block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1530 michael 1783 };
1531    
1532     class_max_idle: MAX_IDLE '=' timespec ';'
1533     {
1534 michael 1785 if (conf_parser_ctx.pass != 1)
1535     break;
1536    
1537     block_state.max_idle.value = $3;
1538     block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1539 michael 1783 };
1540    
1541     class_flags: IRCD_FLAGS
1542     {
1543     if (conf_parser_ctx.pass == 1)
1544 michael 1785 block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE;
1545 michael 1783 } '=' class_flags_items ';';
1546    
1547     class_flags_items: class_flags_items ',' class_flags_item | class_flags_item;
1548     class_flags_item: RANDOM_IDLE
1549     {
1550     if (conf_parser_ctx.pass == 1)
1551     block_state.flags.value |= CLASS_FLAGS_RANDOM_IDLE;
1552     } | HIDE_IDLE_FROM_OPERS
1553     {
1554     if (conf_parser_ctx.pass == 1)
1555     block_state.flags.value |= CLASS_FLAGS_HIDE_IDLE_FROM_OPERS;
1556     };
1557    
1558    
1559 adx 30 /***************************************************************************
1560     * section listen
1561     ***************************************************************************/
1562     listen_entry: LISTEN
1563     {
1564 michael 967 if (conf_parser_ctx.pass == 2)
1565 michael 1646 reset_block_state();
1566     } '{' listen_items '}' ';';
1567 adx 30
1568     listen_flags: IRCD_FLAGS
1569     {
1570 michael 1646 block_state.flags.value = 0;
1571 adx 30 } '=' listen_flags_items ';';
1572    
1573     listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1574     listen_flags_item: T_SSL
1575     {
1576 michael 967 if (conf_parser_ctx.pass == 2)
1577 michael 1646 block_state.flags.value |= LISTENER_SSL;
1578 adx 30 } | HIDDEN
1579     {
1580 michael 967 if (conf_parser_ctx.pass == 2)
1581 michael 1647 block_state.flags.value |= LISTENER_HIDDEN;
1582 michael 900 } | T_SERVER
1583     {
1584 michael 967 if (conf_parser_ctx.pass == 2)
1585 michael 1647 block_state.flags.value |= LISTENER_SERVER;
1586 adx 30 };
1587    
1588     listen_items: listen_items listen_item | listen_item;
1589 michael 440 listen_item: listen_port | listen_flags | listen_address | listen_host | error ';';
1590 adx 30
1591 michael 1648 listen_port: PORT '=' port_items { block_state.flags.value = 0; } ';';
1592 adx 30
1593     port_items: port_items ',' port_item | port_item;
1594    
1595     port_item: NUMBER
1596     {
1597 michael 967 if (conf_parser_ctx.pass == 2)
1598 adx 30 {
1599 michael 1646 if (block_state.flags.value & LISTENER_SSL)
1600 adx 30 #ifdef HAVE_LIBCRYPTO
1601 michael 967 if (!ServerInfo.server_ctx)
1602 adx 30 #endif
1603     {
1604 michael 1752 conf_error_report("SSL not available - port closed");
1605 michael 3439 break;
1606 adx 30 }
1607 michael 1646 add_listener($1, block_state.addr.buf, block_state.flags.value);
1608 adx 30 }
1609     } | NUMBER TWODOTS NUMBER
1610     {
1611 michael 967 if (conf_parser_ctx.pass == 2)
1612 adx 30 {
1613 michael 1646 if (block_state.flags.value & LISTENER_SSL)
1614 adx 30 #ifdef HAVE_LIBCRYPTO
1615 michael 967 if (!ServerInfo.server_ctx)
1616 adx 30 #endif
1617     {
1618 michael 1752 conf_error_report("SSL not available - port closed");
1619 michael 3439 break;
1620 adx 30 }
1621    
1622 michael 3439 for (int i = $1; i <= $3; ++i)
1623 michael 1646 add_listener(i, block_state.addr.buf, block_state.flags.value);
1624 adx 30 }
1625     };
1626    
1627     listen_address: IP '=' QSTRING ';'
1628     {
1629 michael 967 if (conf_parser_ctx.pass == 2)
1630 michael 1646 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1631 adx 30 };
1632    
1633     listen_host: HOST '=' QSTRING ';'
1634     {
1635 michael 967 if (conf_parser_ctx.pass == 2)
1636 michael 1646 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1637 adx 30 };
1638    
1639     /***************************************************************************
1640     * section auth
1641     ***************************************************************************/
1642     auth_entry: IRCD_AUTH
1643     {
1644 michael 967 if (conf_parser_ctx.pass == 2)
1645 michael 1646 reset_block_state();
1646 adx 30 } '{' auth_items '}' ';'
1647     {
1648 michael 1646 dlink_node *ptr = NULL;
1649 adx 30
1650 michael 1646 if (conf_parser_ctx.pass != 2)
1651     break;
1652 adx 30
1653 michael 1646 DLINK_FOREACH(ptr, block_state.mask.list.head)
1654     {
1655     struct MaskItem *conf = NULL;
1656     struct split_nuh_item nuh;
1657 adx 30
1658 michael 1646 nuh.nuhmask = ptr->data;
1659     nuh.nickptr = NULL;
1660 michael 1647 nuh.userptr = block_state.user.buf;
1661     nuh.hostptr = block_state.host.buf;
1662 michael 1646 nuh.nicksize = 0;
1663 michael 1647 nuh.usersize = sizeof(block_state.user.buf);
1664     nuh.hostsize = sizeof(block_state.host.buf);
1665 michael 1646 split_nuh(&nuh);
1666 adx 30
1667 michael 1646 conf = conf_make(CONF_CLIENT);
1668 michael 2106 conf->user = xstrdup(block_state.user.buf);
1669     conf->host = xstrdup(block_state.host.buf);
1670 adx 30
1671 michael 1647 if (block_state.rpass.buf[0])
1672     conf->passwd = xstrdup(block_state.rpass.buf);
1673 michael 1646 if (block_state.name.buf[0])
1674 michael 1911 conf->name = xstrdup(block_state.name.buf);
1675 adx 30
1676 michael 1646 conf->flags = block_state.flags.value;
1677     conf->port = block_state.port.value;
1678 adx 30
1679 michael 1646 conf_add_class_to_conf(conf, block_state.class.buf);
1680     add_conf_by_address(CONF_CLIENT, conf);
1681 adx 30 }
1682 michael 2916 };
1683 adx 30
1684     auth_items: auth_items auth_item | auth_item;
1685 michael 3439 auth_item: auth_user |
1686     auth_passwd |
1687     auth_class |
1688     auth_flags |
1689     auth_spoof |
1690 michael 3441 auth_redir_serv |
1691 michael 3439 auth_redir_port |
1692     auth_encrypted |
1693     error ';' ;
1694 adx 30
1695     auth_user: USER '=' QSTRING ';'
1696     {
1697 michael 967 if (conf_parser_ctx.pass == 2)
1698 michael 1646 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1699 adx 30 };
1700    
1701     auth_passwd: PASSWORD '=' QSTRING ';'
1702     {
1703 michael 967 if (conf_parser_ctx.pass == 2)
1704 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1705 adx 30 };
1706    
1707     auth_class: CLASS '=' QSTRING ';'
1708     {
1709 michael 967 if (conf_parser_ctx.pass == 2)
1710 michael 1646 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1711 adx 30 };
1712    
1713     auth_encrypted: ENCRYPTED '=' TBOOL ';'
1714     {
1715 michael 967 if (conf_parser_ctx.pass == 2)
1716 adx 30 {
1717     if (yylval.number)
1718 michael 1646 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1719 adx 30 else
1720 michael 1646 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1721 adx 30 }
1722     };
1723    
1724     auth_flags: IRCD_FLAGS
1725     {
1726 michael 1646 if (conf_parser_ctx.pass == 2)
1727 michael 2093 block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1728 adx 30 } '=' auth_flags_items ';';
1729    
1730     auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1731 michael 1228 auth_flags_item: SPOOF_NOTICE
1732 adx 30 {
1733 michael 967 if (conf_parser_ctx.pass == 2)
1734 michael 1646 block_state.flags.value |= CONF_FLAGS_SPOOF_NOTICE;
1735 adx 30 } | EXCEED_LIMIT
1736     {
1737 michael 967 if (conf_parser_ctx.pass == 2)
1738 michael 1646 block_state.flags.value |= CONF_FLAGS_NOLIMIT;
1739 adx 30 } | KLINE_EXEMPT
1740     {
1741 michael 967 if (conf_parser_ctx.pass == 2)
1742 michael 1646 block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1743 adx 30 } | NEED_IDENT
1744     {
1745 michael 967 if (conf_parser_ctx.pass == 2)
1746 michael 1646 block_state.flags.value |= CONF_FLAGS_NEED_IDENTD;
1747 adx 30 } | CAN_FLOOD
1748     {
1749 michael 967 if (conf_parser_ctx.pass == 2)
1750 michael 1646 block_state.flags.value |= CONF_FLAGS_CAN_FLOOD;
1751 adx 30 } | NO_TILDE
1752     {
1753 michael 967 if (conf_parser_ctx.pass == 2)
1754 michael 1646 block_state.flags.value |= CONF_FLAGS_NO_TILDE;
1755 adx 30 } | GLINE_EXEMPT
1756     {
1757 michael 967 if (conf_parser_ctx.pass == 2)
1758 michael 1646 block_state.flags.value |= CONF_FLAGS_EXEMPTGLINE;
1759 adx 30 } | RESV_EXEMPT
1760     {
1761 michael 967 if (conf_parser_ctx.pass == 2)
1762 michael 1646 block_state.flags.value |= CONF_FLAGS_EXEMPTRESV;
1763 michael 1715 } | T_WEBIRC
1764     {
1765     if (conf_parser_ctx.pass == 2)
1766     block_state.flags.value |= CONF_FLAGS_WEBIRC;
1767 adx 30 } | NEED_PASSWORD
1768     {
1769 michael 967 if (conf_parser_ctx.pass == 2)
1770 michael 1646 block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD;
1771 adx 30 };
1772    
1773 michael 2916 auth_spoof: SPOOF '=' QSTRING ';'
1774 adx 30 {
1775 michael 1646 if (conf_parser_ctx.pass != 2)
1776     break;
1777    
1778 michael 3441 if (valid_hostname(yylval.string))
1779 adx 30 {
1780 michael 1646 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1781     block_state.flags.value |= CONF_FLAGS_SPOOF_IP;
1782 adx 30 }
1783 michael 1646 else
1784     ilog(LOG_TYPE_IRCD, "Spoof either is too long or contains invalid characters. Ignoring it.");
1785 adx 30 };
1786    
1787     auth_redir_serv: REDIRSERV '=' QSTRING ';'
1788     {
1789 michael 1646 if (conf_parser_ctx.pass != 2)
1790     break;
1791    
1792     strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1793     block_state.flags.value |= CONF_FLAGS_REDIR;
1794 adx 30 };
1795    
1796     auth_redir_port: REDIRPORT '=' NUMBER ';'
1797     {
1798 michael 1646 if (conf_parser_ctx.pass != 2)
1799     break;
1800 michael 1647
1801 michael 1646 block_state.flags.value |= CONF_FLAGS_REDIR;
1802     block_state.port.value = $3;
1803 adx 30 };
1804    
1805    
1806     /***************************************************************************
1807     * section resv
1808     ***************************************************************************/
1809     resv_entry: RESV
1810     {
1811 michael 1647 if (conf_parser_ctx.pass != 2)
1812     break;
1813 adx 30
1814 michael 1647 reset_block_state();
1815     strlcpy(block_state.rpass.buf, CONF_NOREASON, sizeof(block_state.rpass.buf));
1816 michael 1823 } '{' resv_items '}' ';'
1817     {
1818 michael 1858 if (conf_parser_ctx.pass != 2)
1819     break;
1820    
1821     create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list);
1822 michael 1823 };
1823 michael 1647
1824 michael 3439 resv_items: resv_items resv_item | resv_item;
1825     resv_item: resv_mask | resv_reason | resv_exempt | error ';' ;
1826 adx 30
1827 michael 1858 resv_mask: MASK '=' QSTRING ';'
1828 adx 30 {
1829 michael 967 if (conf_parser_ctx.pass == 2)
1830 michael 1858 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1831 adx 30 };
1832    
1833 michael 1858 resv_reason: REASON '=' QSTRING ';'
1834 adx 30 {
1835 michael 1823 if (conf_parser_ctx.pass == 2)
1836 michael 1858 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1837 adx 30 };
1838    
1839 michael 1858 resv_exempt: EXEMPT '=' QSTRING ';'
1840 adx 30 {
1841 michael 967 if (conf_parser_ctx.pass == 2)
1842 michael 1858 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1843 adx 30 };
1844    
1845 michael 1858
1846 adx 30 /***************************************************************************
1847 michael 1157 * section service
1848     ***************************************************************************/
1849     service_entry: T_SERVICE '{' service_items '}' ';';
1850    
1851     service_items: service_items service_item | service_item;
1852     service_item: service_name | error;
1853    
1854     service_name: NAME '=' QSTRING ';'
1855     {
1856 michael 2129 if (conf_parser_ctx.pass != 2)
1857     break;
1858    
1859     if (valid_servname(yylval.string))
1860 michael 1157 {
1861 michael 2129 struct MaskItem *conf = conf_make(CONF_SERVICE);
1862     conf->name = xstrdup(yylval.string);
1863 michael 1157 }
1864     };
1865    
1866     /***************************************************************************
1867 adx 30 * section shared, for sharing remote klines etc.
1868     ***************************************************************************/
1869     shared_entry: T_SHARED
1870     {
1871 michael 1647 if (conf_parser_ctx.pass != 2)
1872     break;
1873    
1874     reset_block_state();
1875    
1876     strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1877     strlcpy(block_state.user.buf, "*", sizeof(block_state.user.buf));
1878     strlcpy(block_state.host.buf, "*", sizeof(block_state.host.buf));
1879     block_state.flags.value = SHARED_ALL;
1880 adx 30 } '{' shared_items '}' ';'
1881     {
1882 michael 1647 struct MaskItem *conf = NULL;
1883    
1884     if (conf_parser_ctx.pass != 2)
1885     break;
1886    
1887     conf = conf_make(CONF_ULINE);
1888     conf->flags = block_state.flags.value;
1889     conf->name = xstrdup(block_state.name.buf);
1890     conf->user = xstrdup(block_state.user.buf);
1891 michael 1911 conf->host = xstrdup(block_state.host.buf);
1892 adx 30 };
1893    
1894     shared_items: shared_items shared_item | shared_item;
1895     shared_item: shared_name | shared_user | shared_type | error ';' ;
1896    
1897     shared_name: NAME '=' QSTRING ';'
1898     {
1899 michael 967 if (conf_parser_ctx.pass == 2)
1900 michael 1647 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1901 adx 30 };
1902    
1903     shared_user: USER '=' QSTRING ';'
1904     {
1905 michael 967 if (conf_parser_ctx.pass == 2)
1906 adx 30 {
1907 michael 593 struct split_nuh_item nuh;
1908    
1909     nuh.nuhmask = yylval.string;
1910     nuh.nickptr = NULL;
1911 michael 1647 nuh.userptr = block_state.user.buf;
1912     nuh.hostptr = block_state.host.buf;
1913 michael 593
1914     nuh.nicksize = 0;
1915 michael 1647 nuh.usersize = sizeof(block_state.user.buf);
1916     nuh.hostsize = sizeof(block_state.host.buf);
1917 michael 593
1918     split_nuh(&nuh);
1919 adx 30 }
1920     };
1921    
1922     shared_type: TYPE
1923     {
1924 michael 967 if (conf_parser_ctx.pass == 2)
1925 michael 1647 block_state.flags.value = 0;
1926 adx 30 } '=' shared_types ';' ;
1927    
1928     shared_types: shared_types ',' shared_type_item | shared_type_item;
1929     shared_type_item: KLINE
1930     {
1931 michael 967 if (conf_parser_ctx.pass == 2)
1932 michael 1647 block_state.flags.value |= SHARED_KLINE;
1933 michael 1301 } | UNKLINE
1934 adx 30 {
1935 michael 967 if (conf_parser_ctx.pass == 2)
1936 michael 1647 block_state.flags.value |= SHARED_UNKLINE;
1937 michael 1301 } | T_DLINE
1938 adx 30 {
1939 michael 967 if (conf_parser_ctx.pass == 2)
1940 michael 1647 block_state.flags.value |= SHARED_DLINE;
1941 michael 1301 } | T_UNDLINE
1942     {
1943     if (conf_parser_ctx.pass == 2)
1944 michael 1647 block_state.flags.value |= SHARED_UNDLINE;
1945 adx 30 } | XLINE
1946     {
1947 michael 967 if (conf_parser_ctx.pass == 2)
1948 michael 1647 block_state.flags.value |= SHARED_XLINE;
1949 adx 30 } | T_UNXLINE
1950     {
1951 michael 967 if (conf_parser_ctx.pass == 2)
1952 michael 1647 block_state.flags.value |= SHARED_UNXLINE;
1953 adx 30 } | RESV
1954     {
1955 michael 967 if (conf_parser_ctx.pass == 2)
1956 michael 1647 block_state.flags.value |= SHARED_RESV;
1957 adx 30 } | T_UNRESV
1958     {
1959 michael 967 if (conf_parser_ctx.pass == 2)
1960 michael 1647 block_state.flags.value |= SHARED_UNRESV;
1961 adx 30 } | T_LOCOPS
1962     {
1963 michael 967 if (conf_parser_ctx.pass == 2)
1964 michael 1647 block_state.flags.value |= SHARED_LOCOPS;
1965 adx 30 } | T_ALL
1966     {
1967 michael 967 if (conf_parser_ctx.pass == 2)
1968 michael 1647 block_state.flags.value = SHARED_ALL;
1969 adx 30 };
1970    
1971     /***************************************************************************
1972     * section cluster
1973     ***************************************************************************/
1974     cluster_entry: T_CLUSTER
1975     {
1976 michael 1647 if (conf_parser_ctx.pass != 2)
1977     break;
1978    
1979     reset_block_state();
1980    
1981     strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf));
1982     block_state.flags.value = SHARED_ALL;
1983 adx 30 } '{' cluster_items '}' ';'
1984     {
1985 michael 1647 struct MaskItem *conf = NULL;
1986    
1987     if (conf_parser_ctx.pass != 2)
1988     break;
1989    
1990     conf = conf_make(CONF_CLUSTER);
1991     conf->flags = block_state.flags.value;
1992     conf->name = xstrdup(block_state.name.buf);
1993 adx 30 };
1994    
1995 michael 3439 cluster_items: cluster_items cluster_item | cluster_item;
1996     cluster_item: cluster_name | cluster_type | error ';' ;
1997 adx 30
1998     cluster_name: NAME '=' QSTRING ';'
1999     {
2000 michael 967 if (conf_parser_ctx.pass == 2)
2001 michael 1647 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2002 adx 30 };
2003    
2004     cluster_type: TYPE
2005     {
2006 michael 967 if (conf_parser_ctx.pass == 2)
2007 michael 1647 block_state.flags.value = 0;
2008 adx 30 } '=' cluster_types ';' ;
2009    
2010 michael 3439 cluster_types: cluster_types ',' cluster_type_item | cluster_type_item;
2011 adx 30 cluster_type_item: KLINE
2012     {
2013 michael 967 if (conf_parser_ctx.pass == 2)
2014 michael 1647 block_state.flags.value |= SHARED_KLINE;
2015 michael 1301 } | UNKLINE
2016 adx 30 {
2017 michael 967 if (conf_parser_ctx.pass == 2)
2018 michael 1647 block_state.flags.value |= SHARED_UNKLINE;
2019 michael 1301 } | T_DLINE
2020 adx 30 {
2021 michael 967 if (conf_parser_ctx.pass == 2)
2022 michael 1647 block_state.flags.value |= SHARED_DLINE;
2023 michael 1301 } | T_UNDLINE
2024     {
2025     if (conf_parser_ctx.pass == 2)
2026 michael 1647 block_state.flags.value |= SHARED_UNDLINE;
2027 adx 30 } | XLINE
2028     {
2029 michael 967 if (conf_parser_ctx.pass == 2)
2030 michael 1647 block_state.flags.value |= SHARED_XLINE;
2031 adx 30 } | T_UNXLINE
2032     {
2033 michael 967 if (conf_parser_ctx.pass == 2)
2034 michael 1647 block_state.flags.value |= SHARED_UNXLINE;
2035 adx 30 } | RESV
2036     {
2037 michael 967 if (conf_parser_ctx.pass == 2)
2038 michael 1647 block_state.flags.value |= SHARED_RESV;
2039 adx 30 } | T_UNRESV
2040     {
2041 michael 967 if (conf_parser_ctx.pass == 2)
2042 michael 1647 block_state.flags.value |= SHARED_UNRESV;
2043 adx 30 } | T_LOCOPS
2044     {
2045 michael 967 if (conf_parser_ctx.pass == 2)
2046 michael 1647 block_state.flags.value |= SHARED_LOCOPS;
2047 adx 30 } | T_ALL
2048     {
2049 michael 967 if (conf_parser_ctx.pass == 2)
2050 michael 1647 block_state.flags.value = SHARED_ALL;
2051 adx 30 };
2052    
2053     /***************************************************************************
2054     * section connect
2055     ***************************************************************************/
2056 michael 2916 connect_entry: CONNECT
2057 adx 30 {
2058 michael 1265
2059 michael 1647 if (conf_parser_ctx.pass != 2)
2060     break;
2061    
2062     reset_block_state();
2063 michael 2397 block_state.aftype.value = AF_INET;
2064 michael 1647 block_state.port.value = PORTNUM;
2065 michael 1285 } '{' connect_items '}' ';'
2066 adx 30 {
2067 michael 1647 struct MaskItem *conf = NULL;
2068     struct addrinfo hints, *res;
2069    
2070     if (conf_parser_ctx.pass != 2)
2071     break;
2072    
2073 michael 1648 if (!block_state.name.buf[0] ||
2074     !block_state.host.buf[0])
2075 michael 1647 break;
2076    
2077 michael 2126 if (!block_state.rpass.buf[0] ||
2078     !block_state.spass.buf[0])
2079 michael 1647 break;
2080    
2081     if (has_wildcards(block_state.name.buf) ||
2082     has_wildcards(block_state.host.buf))
2083     break;
2084    
2085     conf = conf_make(CONF_SERVER);
2086     conf->port = block_state.port.value;
2087     conf->flags = block_state.flags.value;
2088     conf->aftype = block_state.aftype.value;
2089     conf->host = xstrdup(block_state.host.buf);
2090     conf->name = xstrdup(block_state.name.buf);
2091     conf->passwd = xstrdup(block_state.rpass.buf);
2092     conf->spasswd = xstrdup(block_state.spass.buf);
2093 michael 2228
2094     if (block_state.cert.buf[0])
2095     conf->certfp = xstrdup(block_state.cert.buf);
2096    
2097 michael 2252 if (block_state.ciph.buf[0])
2098     conf->cipher_list = xstrdup(block_state.ciph.buf);
2099 michael 1647
2100     dlinkMoveList(&block_state.leaf.list, &conf->leaf_list);
2101     dlinkMoveList(&block_state.hub.list, &conf->hub_list);
2102    
2103     if (block_state.bind.buf[0])
2104 adx 30 {
2105 michael 1647 memset(&hints, 0, sizeof(hints));
2106    
2107     hints.ai_family = AF_UNSPEC;
2108     hints.ai_socktype = SOCK_STREAM;
2109     hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
2110    
2111     if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res))
2112     ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf);
2113 michael 1302 else
2114     {
2115 michael 3443 assert(res);
2116 adx 30
2117 michael 1647 memcpy(&conf->bind, res->ai_addr, res->ai_addrlen);
2118     conf->bind.ss.ss_family = res->ai_family;
2119     conf->bind.ss_len = res->ai_addrlen;
2120     freeaddrinfo(res);
2121 michael 1302 }
2122 michael 1647 }
2123 adx 30
2124 michael 1647 conf_add_class_to_conf(conf, block_state.class.buf);
2125     lookup_confhost(conf);
2126 adx 30 };
2127    
2128     connect_items: connect_items connect_item | connect_item;
2129 michael 3439 connect_item: connect_name |
2130     connect_host |
2131     connect_vhost |
2132     connect_send_password |
2133     connect_accept_password |
2134     connect_ssl_certificate_fingerprint |
2135     connect_aftype |
2136     connect_port |
2137     connect_ssl_cipher_list |
2138     connect_flags |
2139     connect_hub_mask |
2140     connect_leaf_mask |
2141     connect_class |
2142     connect_encrypted |
2143 michael 1076 error ';' ;
2144 adx 30
2145     connect_name: NAME '=' QSTRING ';'
2146     {
2147 michael 967 if (conf_parser_ctx.pass == 2)
2148 michael 1647 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2149 adx 30 };
2150    
2151 michael 2916 connect_host: HOST '=' QSTRING ';'
2152 adx 30 {
2153 michael 967 if (conf_parser_ctx.pass == 2)
2154 michael 1647 strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf));
2155 adx 30 };
2156    
2157 michael 2916 connect_vhost: VHOST '=' QSTRING ';'
2158 adx 30 {
2159 michael 967 if (conf_parser_ctx.pass == 2)
2160 michael 1647 strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf));
2161 adx 30 };
2162 michael 2916
2163 adx 30 connect_send_password: SEND_PASSWORD '=' QSTRING ';'
2164     {
2165 michael 1647 if (conf_parser_ctx.pass != 2)
2166     break;
2167 adx 30
2168 michael 1647 if ($3[0] == ':')
2169 michael 1752 conf_error_report("Server passwords cannot begin with a colon");
2170 michael 3443 else if (strchr($3, ' '))
2171 michael 1752 conf_error_report("Server passwords cannot contain spaces");
2172 michael 1647 else
2173     strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf));
2174 adx 30 };
2175    
2176     connect_accept_password: ACCEPT_PASSWORD '=' QSTRING ';'
2177     {
2178 michael 1647 if (conf_parser_ctx.pass != 2)
2179     break;
2180 adx 30
2181 michael 1647 if ($3[0] == ':')
2182 michael 1752 conf_error_report("Server passwords cannot begin with a colon");
2183 michael 3443 else if (strchr($3, ' '))
2184 michael 1752 conf_error_report("Server passwords cannot contain spaces");
2185 michael 1647 else
2186     strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2187 adx 30 };
2188    
2189 michael 2244 connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
2190 michael 2228 {
2191     if (conf_parser_ctx.pass == 2)
2192 michael 2229 strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
2193 michael 2228 };
2194    
2195 adx 30 connect_port: PORT '=' NUMBER ';'
2196     {
2197 michael 967 if (conf_parser_ctx.pass == 2)
2198 michael 1647 block_state.port.value = $3;
2199 adx 30 };
2200    
2201     connect_aftype: AFTYPE '=' T_IPV4 ';'
2202     {
2203 michael 967 if (conf_parser_ctx.pass == 2)
2204 michael 1647 block_state.aftype.value = AF_INET;
2205 adx 30 } | AFTYPE '=' T_IPV6 ';'
2206     {
2207     #ifdef IPV6
2208 michael 967 if (conf_parser_ctx.pass == 2)
2209 michael 1647 block_state.aftype.value = AF_INET6;
2210 adx 30 #endif
2211     };
2212    
2213     connect_flags: IRCD_FLAGS
2214     {
2215 michael 1648 block_state.flags.value &= CONF_FLAGS_ENCRYPTED;
2216 adx 30 } '=' connect_flags_items ';';
2217    
2218     connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item;
2219 michael 1302 connect_flags_item: AUTOCONN
2220 adx 30 {
2221 michael 967 if (conf_parser_ctx.pass == 2)
2222 michael 1647 block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN;
2223 michael 1303 } | T_SSL
2224     {
2225     if (conf_parser_ctx.pass == 2)
2226 michael 1647 block_state.flags.value |= CONF_FLAGS_SSL;
2227 michael 1228 };
2228 adx 30
2229     connect_encrypted: ENCRYPTED '=' TBOOL ';'
2230     {
2231 michael 967 if (conf_parser_ctx.pass == 2)
2232 adx 30 {
2233     if (yylval.number)
2234 michael 1647 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
2235 adx 30 else
2236 michael 1647 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
2237 adx 30 }
2238     };
2239    
2240 michael 2916 connect_hub_mask: HUB_MASK '=' QSTRING ';'
2241 adx 30 {
2242 michael 967 if (conf_parser_ctx.pass == 2)
2243 michael 1647 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list);
2244 adx 30 };
2245    
2246 michael 2916 connect_leaf_mask: LEAF_MASK '=' QSTRING ';'
2247 adx 30 {
2248 michael 967 if (conf_parser_ctx.pass == 2)
2249 michael 1647 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list);
2250 adx 30 };
2251    
2252     connect_class: CLASS '=' QSTRING ';'
2253     {
2254 michael 967 if (conf_parser_ctx.pass == 2)
2255 michael 1647 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
2256 adx 30 };
2257    
2258 michael 1306 connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
2259     {
2260     #ifdef HAVE_LIBCRYPTO
2261     if (conf_parser_ctx.pass == 2)
2262 michael 1647 strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf));
2263 michael 1306 #else
2264     if (conf_parser_ctx.pass == 2)
2265 michael 1752 conf_error_report("Ignoring connect::ciphers -- no OpenSSL support");
2266 michael 1306 #endif
2267     };
2268    
2269    
2270 adx 30 /***************************************************************************
2271     * section kill
2272     ***************************************************************************/
2273     kill_entry: KILL
2274     {
2275 michael 967 if (conf_parser_ctx.pass == 2)
2276 michael 1647 reset_block_state();
2277 adx 30 } '{' kill_items '}' ';'
2278     {
2279 michael 1647 struct MaskItem *conf = NULL;
2280    
2281     if (conf_parser_ctx.pass != 2)
2282     break;
2283    
2284     if (!block_state.user.buf[0] ||
2285     !block_state.host.buf[0])
2286     break;
2287    
2288 michael 1921 conf = conf_make(CONF_KLINE);
2289     conf->user = xstrdup(block_state.user.buf);
2290     conf->host = xstrdup(block_state.host.buf);
2291 michael 1647
2292 michael 1921 if (block_state.rpass.buf[0])
2293     conf->reason = xstrdup(block_state.rpass.buf);
2294 michael 1647 else
2295 michael 1921 conf->reason = xstrdup(CONF_NOREASON);
2296     add_conf_by_address(CONF_KLINE, conf);
2297 michael 2916 };
2298 adx 30
2299     kill_items: kill_items kill_item | kill_item;
2300 michael 1921 kill_item: kill_user | kill_reason | error;
2301 adx 30
2302     kill_user: USER '=' QSTRING ';'
2303     {
2304 michael 1647
2305 michael 967 if (conf_parser_ctx.pass == 2)
2306 adx 30 {
2307 michael 593 struct split_nuh_item nuh;
2308 adx 30
2309 michael 593 nuh.nuhmask = yylval.string;
2310     nuh.nickptr = NULL;
2311 michael 1647 nuh.userptr = block_state.user.buf;
2312     nuh.hostptr = block_state.host.buf;
2313 adx 30
2314 michael 593 nuh.nicksize = 0;
2315 michael 1647 nuh.usersize = sizeof(block_state.user.buf);
2316     nuh.hostsize = sizeof(block_state.host.buf);
2317 adx 30
2318 michael 593 split_nuh(&nuh);
2319 adx 30 }
2320     };
2321    
2322 michael 2916 kill_reason: REASON '=' QSTRING ';'
2323 adx 30 {
2324 michael 967 if (conf_parser_ctx.pass == 2)
2325 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2326 adx 30 };
2327    
2328     /***************************************************************************
2329     * section deny
2330     ***************************************************************************/
2331 michael 2916 deny_entry: DENY
2332 adx 30 {
2333 michael 967 if (conf_parser_ctx.pass == 2)
2334 michael 1646 reset_block_state();
2335 adx 30 } '{' deny_items '}' ';'
2336     {
2337 michael 1646 struct MaskItem *conf = NULL;
2338    
2339     if (conf_parser_ctx.pass != 2)
2340     break;
2341    
2342     if (!block_state.addr.buf[0])
2343     break;
2344    
2345     if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST)
2346 adx 30 {
2347 michael 1646 conf = conf_make(CONF_DLINE);
2348     conf->host = xstrdup(block_state.addr.buf);
2349 michael 1005
2350 michael 1647 if (block_state.rpass.buf[0])
2351     conf->reason = xstrdup(block_state.rpass.buf);
2352 michael 1646 else
2353     conf->reason = xstrdup(CONF_NOREASON);
2354     add_conf_by_address(CONF_DLINE, conf);
2355 adx 30 }
2356 michael 2916 };
2357 adx 30
2358     deny_items: deny_items deny_item | deny_item;
2359     deny_item: deny_ip | deny_reason | error;
2360    
2361     deny_ip: IP '=' QSTRING ';'
2362     {
2363 michael 967 if (conf_parser_ctx.pass == 2)
2364 michael 1646 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
2365 adx 30 };
2366    
2367 michael 2916 deny_reason: REASON '=' QSTRING ';'
2368 adx 30 {
2369 michael 967 if (conf_parser_ctx.pass == 2)
2370 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2371 adx 30 };
2372    
2373     /***************************************************************************
2374     * section exempt
2375     ***************************************************************************/
2376     exempt_entry: EXEMPT '{' exempt_items '}' ';';
2377    
2378     exempt_items: exempt_items exempt_item | exempt_item;
2379     exempt_item: exempt_ip | error;
2380    
2381     exempt_ip: IP '=' QSTRING ';'
2382     {
2383 michael 967 if (conf_parser_ctx.pass == 2)
2384 adx 30 {
2385     if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST)
2386     {
2387 michael 1646 struct MaskItem *conf = conf_make(CONF_EXEMPT);
2388     conf->host = xstrdup(yylval.string);
2389 adx 30
2390 michael 1646 add_conf_by_address(CONF_EXEMPT, conf);
2391 adx 30 }
2392     }
2393     };
2394    
2395     /***************************************************************************
2396     * section gecos
2397     ***************************************************************************/
2398     gecos_entry: GECOS
2399     {
2400 michael 967 if (conf_parser_ctx.pass == 2)
2401 michael 1646 reset_block_state();
2402 adx 30 } '{' gecos_items '}' ';'
2403     {
2404 michael 1646 struct MaskItem *conf = NULL;
2405    
2406     if (conf_parser_ctx.pass != 2)
2407     break;
2408    
2409     if (!block_state.name.buf[0])
2410     break;
2411    
2412 michael 1921 conf = conf_make(CONF_XLINE);
2413 michael 1646 conf->name = xstrdup(block_state.name.buf);
2414 adx 30
2415 michael 1647 if (block_state.rpass.buf[0])
2416     conf->reason = xstrdup(block_state.rpass.buf);
2417 michael 1646 else
2418     conf->reason = xstrdup(CONF_NOREASON);
2419 adx 30 };
2420    
2421     gecos_items: gecos_items gecos_item | gecos_item;
2422 michael 1921 gecos_item: gecos_name | gecos_reason | error;
2423 adx 30
2424 michael 2916 gecos_name: NAME '=' QSTRING ';'
2425 adx 30 {
2426 michael 967 if (conf_parser_ctx.pass == 2)
2427 michael 1646 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
2428 adx 30 };
2429    
2430 michael 2916 gecos_reason: REASON '=' QSTRING ';'
2431 adx 30 {
2432 michael 967 if (conf_parser_ctx.pass == 2)
2433 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
2434 adx 30 };
2435    
2436     /***************************************************************************
2437     * section general
2438     ***************************************************************************/
2439     general_entry: GENERAL
2440     '{' general_items '}' ';';
2441    
2442     general_items: general_items general_item | general_item;
2443 michael 3439 general_item: general_hide_spoof_ips |
2444     general_ignore_bogus_ts |
2445     general_failed_oper_notice |
2446     general_anti_nick_flood |
2447     general_max_nick_time |
2448     general_max_nick_changes |
2449     general_max_accept |
2450     general_anti_spam_exit_message_time |
2451     general_ts_warn_delta |
2452     general_ts_max_delta |
2453 michael 1549 general_kill_chase_time_limit |
2454     general_invisible_on_connect |
2455 michael 3473 general_warn_no_connect_block |
2456 michael 3439 general_dots_in_ident |
2457     general_stats_o_oper_only |
2458     general_stats_k_oper_only |
2459     general_pace_wait |
2460     general_stats_i_oper_only |
2461     general_pace_wait_simple |
2462     general_stats_P_oper_only |
2463 michael 2269 general_stats_u_oper_only |
2464 michael 3439 general_short_motd |
2465     general_no_oper_flood |
2466     general_true_no_oper_flood |
2467     general_oper_pass_resv |
2468     general_oper_only_umodes |
2469     general_max_targets |
2470     general_use_egd |
2471     general_egdpool_path |
2472     general_oper_umodes |
2473     general_caller_id_wait |
2474     general_opers_bypass_callerid |
2475     general_default_floodcount |
2476     general_min_nonwildcard |
2477     general_min_nonwildcard_simple |
2478     general_throttle_time |
2479     general_havent_read_conf |
2480 michael 1072 general_ping_cookie |
2481 michael 2916 general_disable_auth |
2482 michael 3439 general_tkline_expire_notices |
2483     general_gline_enable |
2484     general_gline_duration |
2485     general_gline_request_duration |
2486 michael 1459 general_gline_min_cidr |
2487 michael 1547 general_gline_min_cidr6 |
2488 michael 3439 general_stats_e_disabled |
2489     general_max_watch |
2490     general_services_name |
2491     general_cycle_on_host_change |
2492     error;
2493 adx 30
2494    
2495 michael 876 general_max_watch: MAX_WATCH '=' NUMBER ';'
2496     {
2497     ConfigFileEntry.max_watch = $3;
2498     };
2499 adx 30
2500 michael 2283 general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2501     {
2502     if (conf_parser_ctx.pass == 2)
2503     ConfigFileEntry.cycle_on_host_change = yylval.number;
2504     };
2505    
2506 michael 1459 general_gline_enable: GLINE_ENABLE '=' TBOOL ';'
2507     {
2508     if (conf_parser_ctx.pass == 2)
2509     ConfigFileEntry.glines = yylval.number;
2510     };
2511    
2512     general_gline_duration: GLINE_DURATION '=' timespec ';'
2513     {
2514     if (conf_parser_ctx.pass == 2)
2515     ConfigFileEntry.gline_time = $3;
2516     };
2517    
2518     general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';'
2519     {
2520     if (conf_parser_ctx.pass == 2)
2521     ConfigFileEntry.gline_request_time = $3;
2522     };
2523    
2524 adx 30 general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';'
2525     {
2526     ConfigFileEntry.gline_min_cidr = $3;
2527     };
2528    
2529     general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';'
2530     {
2531     ConfigFileEntry.gline_min_cidr6 = $3;
2532     };
2533    
2534     general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2535     {
2536     ConfigFileEntry.tkline_expire_notices = yylval.number;
2537     };
2538    
2539 michael 1074 general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2540 adx 30 {
2541     ConfigFileEntry.kill_chase_time_limit = $3;
2542     };
2543    
2544     general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';'
2545     {
2546     ConfigFileEntry.hide_spoof_ips = yylval.number;
2547     };
2548    
2549     general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2550     {
2551     ConfigFileEntry.ignore_bogus_ts = yylval.number;
2552     };
2553    
2554     general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2555     {
2556     ConfigFileEntry.failed_oper_notice = yylval.number;
2557     };
2558    
2559     general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2560     {
2561     ConfigFileEntry.anti_nick_flood = yylval.number;
2562     };
2563    
2564     general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2565     {
2566 michael 2916 ConfigFileEntry.max_nick_time = $3;
2567 adx 30 };
2568    
2569     general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2570     {
2571     ConfigFileEntry.max_nick_changes = $3;
2572     };
2573    
2574     general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2575     {
2576     ConfigFileEntry.max_accept = $3;
2577     };
2578    
2579     general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2580     {
2581     ConfigFileEntry.anti_spam_exit_message_time = $3;
2582     };
2583    
2584     general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2585     {
2586     ConfigFileEntry.ts_warn_delta = $3;
2587     };
2588    
2589     general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2590     {
2591 michael 967 if (conf_parser_ctx.pass == 2)
2592 adx 30 ConfigFileEntry.ts_max_delta = $3;
2593     };
2594    
2595     general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';'
2596     {
2597 michael 967 if (($3 > 0) && conf_parser_ctx.pass == 1)
2598 adx 30 {
2599 michael 1247 ilog(LOG_TYPE_IRCD, "You haven't read your config file properly.");
2600     ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed.");
2601     ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line.");
2602 adx 30 exit(0);
2603     }
2604     };
2605    
2606     general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2607     {
2608     ConfigFileEntry.invisible_on_connect = yylval.number;
2609     };
2610    
2611 michael 3473 general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2612 adx 30 {
2613 michael 3473 ConfigFileEntry.warn_no_connect_block = yylval.number;
2614 adx 30 };
2615    
2616 michael 584 general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2617     {
2618     ConfigFileEntry.stats_e_disabled = yylval.number;
2619     };
2620    
2621 adx 30 general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2622     {
2623     ConfigFileEntry.stats_o_oper_only = yylval.number;
2624     };
2625    
2626     general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2627     {
2628     ConfigFileEntry.stats_P_oper_only = yylval.number;
2629     };
2630    
2631 michael 2269 general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2632     {
2633     ConfigFileEntry.stats_u_oper_only = yylval.number;
2634     };
2635    
2636 adx 30 general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2637     {
2638     ConfigFileEntry.stats_k_oper_only = 2 * yylval.number;
2639     } | STATS_K_OPER_ONLY '=' TMASKED ';'
2640     {
2641     ConfigFileEntry.stats_k_oper_only = 1;
2642     };
2643    
2644     general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2645     {
2646     ConfigFileEntry.stats_i_oper_only = 2 * yylval.number;
2647     } | STATS_I_OPER_ONLY '=' TMASKED ';'
2648     {
2649     ConfigFileEntry.stats_i_oper_only = 1;
2650     };
2651    
2652     general_pace_wait: PACE_WAIT '=' timespec ';'
2653     {
2654     ConfigFileEntry.pace_wait = $3;
2655     };
2656    
2657     general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2658     {
2659     ConfigFileEntry.caller_id_wait = $3;
2660     };
2661    
2662     general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2663     {
2664     ConfigFileEntry.opers_bypass_callerid = yylval.number;
2665     };
2666    
2667     general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2668     {
2669     ConfigFileEntry.pace_wait_simple = $3;
2670     };
2671    
2672     general_short_motd: SHORT_MOTD '=' TBOOL ';'
2673     {
2674     ConfigFileEntry.short_motd = yylval.number;
2675     };
2676 michael 2916
2677 adx 30 general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2678     {
2679     ConfigFileEntry.no_oper_flood = yylval.number;
2680     };
2681    
2682     general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';'
2683     {
2684     ConfigFileEntry.true_no_oper_flood = yylval.number;
2685     };
2686    
2687     general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2688     {
2689     ConfigFileEntry.oper_pass_resv = yylval.number;
2690     };
2691    
2692     general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2693     {
2694     ConfigFileEntry.dots_in_ident = $3;
2695     };
2696    
2697     general_max_targets: MAX_TARGETS '=' NUMBER ';'
2698     {
2699     ConfigFileEntry.max_targets = $3;
2700     };
2701    
2702     general_use_egd: USE_EGD '=' TBOOL ';'
2703     {
2704     ConfigFileEntry.use_egd = yylval.number;
2705     };
2706    
2707     general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';'
2708     {
2709 michael 967 if (conf_parser_ctx.pass == 2)
2710 adx 30 {
2711     MyFree(ConfigFileEntry.egdpool_path);
2712 michael 1646 ConfigFileEntry.egdpool_path = xstrdup(yylval.string);
2713 adx 30 }
2714     };
2715    
2716 michael 1176 general_services_name: T_SERVICES_NAME '=' QSTRING ';'
2717 michael 1157 {
2718 michael 1176 if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string))
2719 michael 1157 {
2720     MyFree(ConfigFileEntry.service_name);
2721 michael 1646 ConfigFileEntry.service_name = xstrdup(yylval.string);
2722 michael 1157 }
2723     };
2724    
2725 adx 30 general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2726     {
2727     ConfigFileEntry.ping_cookie = yylval.number;
2728     };
2729    
2730     general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2731     {
2732     ConfigFileEntry.disable_auth = yylval.number;
2733     };
2734    
2735     general_throttle_time: THROTTLE_TIME '=' timespec ';'
2736     {
2737 michael 3435 ConfigFileEntry.throttle_time = $3;
2738 adx 30 };
2739    
2740     general_oper_umodes: OPER_UMODES
2741     {
2742     ConfigFileEntry.oper_umodes = 0;
2743     } '=' umode_oitems ';' ;
2744    
2745     umode_oitems: umode_oitems ',' umode_oitem | umode_oitem;
2746     umode_oitem: T_BOTS
2747     {
2748     ConfigFileEntry.oper_umodes |= UMODE_BOTS;
2749     } | T_CCONN
2750     {
2751     ConfigFileEntry.oper_umodes |= UMODE_CCONN;
2752     } | T_DEAF
2753     {
2754     ConfigFileEntry.oper_umodes |= UMODE_DEAF;
2755     } | T_DEBUG
2756     {
2757     ConfigFileEntry.oper_umodes |= UMODE_DEBUG;
2758     } | T_FULL
2759     {
2760     ConfigFileEntry.oper_umodes |= UMODE_FULL;
2761 michael 1294 } | HIDDEN
2762     {
2763     ConfigFileEntry.oper_umodes |= UMODE_HIDDEN;
2764 michael 3513 } | HIDE_CHANS
2765     {
2766     ConfigFileEntry.oper_umodes |= UMODE_HIDECHANS;
2767 michael 3506 } | HIDE_IDLE
2768     {
2769     ConfigFileEntry.oper_umodes |= UMODE_HIDEIDLE;
2770 adx 30 } | T_SKILL
2771     {
2772     ConfigFileEntry.oper_umodes |= UMODE_SKILL;
2773     } | T_NCHANGE
2774     {
2775     ConfigFileEntry.oper_umodes |= UMODE_NCHANGE;
2776     } | T_REJ
2777     {
2778     ConfigFileEntry.oper_umodes |= UMODE_REJ;
2779     } | T_UNAUTH
2780     {
2781     ConfigFileEntry.oper_umodes |= UMODE_UNAUTH;
2782     } | T_SPY
2783     {
2784     ConfigFileEntry.oper_umodes |= UMODE_SPY;
2785     } | T_EXTERNAL
2786     {
2787     ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL;
2788     } | T_SERVNOTICE
2789     {
2790     ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE;
2791     } | T_INVISIBLE
2792     {
2793     ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE;
2794     } | T_WALLOP
2795     {
2796     ConfigFileEntry.oper_umodes |= UMODE_WALLOP;
2797     } | T_SOFTCALLERID
2798     {
2799     ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID;
2800     } | T_CALLERID
2801     {
2802     ConfigFileEntry.oper_umodes |= UMODE_CALLERID;
2803     } | T_LOCOPS
2804     {
2805     ConfigFileEntry.oper_umodes |= UMODE_LOCOPS;
2806 michael 1979 } | T_NONONREG
2807     {
2808     ConfigFileEntry.oper_umodes |= UMODE_REGONLY;
2809 michael 1976 } | T_FARCONNECT
2810     {
2811     ConfigFileEntry.oper_umodes |= UMODE_FARCONNECT;
2812 adx 30 };
2813    
2814 michael 2916 general_oper_only_umodes: OPER_ONLY_UMODES
2815 adx 30 {
2816     ConfigFileEntry.oper_only_umodes = 0;
2817     } '=' umode_items ';' ;
2818    
2819 michael 3439 umode_items: umode_items ',' umode_item | umode_item;
2820     umode_item: T_BOTS
2821 adx 30 {
2822     ConfigFileEntry.oper_only_umodes |= UMODE_BOTS;
2823     } | T_CCONN
2824     {
2825     ConfigFileEntry.oper_only_umodes |= UMODE_CCONN;
2826     } | T_DEAF
2827     {
2828     ConfigFileEntry.oper_only_umodes |= UMODE_DEAF;
2829     } | T_DEBUG
2830     {
2831     ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG;
2832     } | T_FULL
2833 michael 2916 {
2834 adx 30 ConfigFileEntry.oper_only_umodes |= UMODE_FULL;
2835     } | T_SKILL
2836     {
2837     ConfigFileEntry.oper_only_umodes |= UMODE_SKILL;
2838 michael 1294 } | HIDDEN
2839     {
2840     ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN;
2841 adx 30 } | T_NCHANGE
2842     {
2843     ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE;
2844     } | T_REJ
2845     {
2846     ConfigFileEntry.oper_only_umodes |= UMODE_REJ;
2847     } | T_UNAUTH
2848     {
2849     ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH;
2850     } | T_SPY
2851     {
2852     ConfigFileEntry.oper_only_umodes |= UMODE_SPY;
2853     } | T_EXTERNAL
2854     {
2855     ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL;
2856     } | T_SERVNOTICE
2857     {
2858     ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE;
2859     } | T_INVISIBLE
2860     {
2861     ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE;
2862     } | T_WALLOP
2863     {
2864     ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP;
2865     } | T_SOFTCALLERID
2866     {
2867     ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID;
2868     } | T_CALLERID
2869     {
2870     ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID;
2871     } | T_LOCOPS
2872     {
2873     ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS;
2874 michael 1855 } | T_NONONREG
2875     {
2876     ConfigFileEntry.oper_only_umodes |= UMODE_REGONLY;
2877 michael 1976 } | T_FARCONNECT
2878     {
2879     ConfigFileEntry.oper_only_umodes |= UMODE_FARCONNECT;
2880 adx 30 };
2881    
2882     general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2883     {
2884     ConfigFileEntry.min_nonwildcard = $3;
2885     };
2886    
2887     general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2888     {
2889     ConfigFileEntry.min_nonwildcard_simple = $3;
2890     };
2891    
2892     general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2893     {
2894     ConfigFileEntry.default_floodcount = $3;
2895     };
2896    
2897    
2898     /***************************************************************************
2899     * section channel
2900     ***************************************************************************/
2901     channel_entry: CHANNEL
2902     '{' channel_items '}' ';';
2903    
2904     channel_items: channel_items channel_item | channel_item;
2905 michael 1495 channel_item: channel_max_bans |
2906 michael 3860 channel_invite_client_count |
2907     channel_invite_client_time |
2908     channel_knock_client_count |
2909     channel_knock_client_time |
2910 michael 3439 channel_knock_delay_channel |
2911     channel_max_chans_per_user |
2912     channel_max_chans_per_oper |
2913 michael 1946 channel_default_split_user_count |
2914 adx 201 channel_default_split_server_count |
2915 michael 1858 channel_no_create_on_split |
2916 michael 1401 channel_no_join_on_split |
2917 michael 3439 channel_jflood_count |
2918     channel_jflood_time |
2919     channel_disable_fake_channels |
2920     error;
2921 adx 30
2922 michael 632 channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2923     {
2924     ConfigChannel.disable_fake_channels = yylval.number;
2925     };
2926    
2927 michael 3860
2928     channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2929 adx 30 {
2930 michael 3860 ConfigChannel.invite_client_count = $3;
2931 adx 30 };
2932    
2933 michael 3860 channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2934 adx 30 {
2935 michael 3860 ConfigChannel.invite_client_time = $3;
2936 adx 30 };
2937    
2938 michael 3860 channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2939 michael 3762 {
2940 michael 3860 ConfigChannel.knock_client_count = $3;
2941 michael 3762 };
2942    
2943 michael 3860 channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2944 michael 3762 {
2945 michael 3860 ConfigChannel.knock_client_time = $3;
2946 michael 3762 };
2947    
2948 michael 3860 channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
2949     {
2950     ConfigChannel.knock_delay_channel = $3;
2951     };
2952    
2953 adx 30 channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';'
2954     {
2955     ConfigChannel.max_chans_per_user = $3;
2956     };
2957    
2958 michael 1432 channel_max_chans_per_oper: MAX_CHANS_PER_OPER '=' NUMBER ';'
2959     {
2960     ConfigChannel.max_chans_per_oper = $3;
2961     };
2962    
2963 adx 30 channel_max_bans: MAX_BANS '=' NUMBER ';'
2964     {
2965     ConfigChannel.max_bans = $3;
2966     };
2967    
2968     channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
2969     {
2970     ConfigChannel.default_split_user_count = $3;
2971     };
2972    
2973     channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
2974     {
2975     ConfigChannel.default_split_server_count = $3;
2976     };
2977    
2978     channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
2979     {
2980     ConfigChannel.no_create_on_split = yylval.number;
2981     };
2982    
2983     channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
2984     {
2985     ConfigChannel.no_join_on_split = yylval.number;
2986     };
2987    
2988     channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';'
2989     {
2990     GlobalSetOptions.joinfloodcount = yylval.number;
2991     };
2992    
2993     channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';'
2994     {
2995 michael 3435 GlobalSetOptions.joinfloodtime = $3;
2996 adx 30 };
2997    
2998     /***************************************************************************
2999     * section serverhide
3000     ***************************************************************************/
3001     serverhide_entry: SERVERHIDE
3002     '{' serverhide_items '}' ';';
3003    
3004     serverhide_items: serverhide_items serverhide_item | serverhide_item;
3005 michael 3439 serverhide_item: serverhide_flatten_links |
3006     serverhide_disable_remote_commands |
3007 michael 2196 serverhide_hide_servers |
3008 michael 3439 serverhide_hide_services |
3009     serverhide_links_delay |
3010     serverhide_hidden |
3011     serverhide_hidden_name |
3012     serverhide_hide_server_ips |
3013 adx 30 error;
3014    
3015     serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3016     {
3017 michael 967 if (conf_parser_ctx.pass == 2)
3018 adx 30 ConfigServerHide.flatten_links = yylval.number;
3019     };
3020    
3021 michael 2196 serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
3022     {
3023     if (conf_parser_ctx.pass == 2)
3024     ConfigServerHide.disable_remote_commands = yylval.number;
3025     };
3026    
3027 adx 30 serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3028     {
3029 michael 967 if (conf_parser_ctx.pass == 2)
3030 adx 30 ConfigServerHide.hide_servers = yylval.number;
3031     };
3032    
3033 michael 1851 serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
3034     {
3035     if (conf_parser_ctx.pass == 2)
3036     ConfigServerHide.hide_services = yylval.number;
3037     };
3038    
3039 adx 30 serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3040     {
3041 michael 967 if (conf_parser_ctx.pass == 2)
3042 adx 30 {
3043     MyFree(ConfigServerHide.hidden_name);
3044 michael 1646 ConfigServerHide.hidden_name = xstrdup(yylval.string);
3045 adx 30 }
3046     };
3047    
3048     serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3049     {
3050 michael 967 if (conf_parser_ctx.pass == 2)
3051 adx 30 {
3052     if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3053     {
3054     eventAddIsh("write_links_file", write_links_file, NULL, $3);
3055     ConfigServerHide.links_disabled = 0;
3056     }
3057    
3058     ConfigServerHide.links_delay = $3;
3059     }
3060     };
3061    
3062     serverhide_hidden: HIDDEN '=' TBOOL ';'
3063     {
3064 michael 967 if (conf_parser_ctx.pass == 2)
3065 adx 30 ConfigServerHide.hidden = yylval.number;
3066     };
3067    
3068     serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3069     {
3070 michael 967 if (conf_parser_ctx.pass == 2)
3071 adx 30 ConfigServerHide.hide_server_ips = yylval.number;
3072     };

Properties

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