ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 6488
Committed: Fri Sep 4 17:56:25 2015 UTC (11 years, 1 month ago) by michael
File size: 78066 byte(s)
Log Message:
- Added 'close' to irc-operator flags

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

Properties

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