ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 5602
Committed: Mon Feb 23 21:04:46 2015 UTC (11 years, 7 months ago) by michael
File size: 79956 byte(s)
Log Message:
- Fixed core in conjunction with OSX 10.10/possibly other system when parsing pseudo{} blocks as reported by Daniel Oaks
- Reverted -r4080, -r4609 and 4106 as they only cause undefined behavior on some systems

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

Properties

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