ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 3513
Committed: Mon May 12 16:28:29 2014 UTC (12 years, 4 months ago) by michael
File size: 77348 byte(s)
Log Message:
- Added usermode +p which hides channel list in WHOIS

File Contents

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

Properties

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