ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 4019
Committed: Fri Jun 20 16:06:42 2014 UTC (12 years, 3 months ago) by michael
File size: 77783 byte(s)
Log Message:
- Renamed OPER_FLAG_K to OPER_FLAG_KLINE

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

Properties

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