ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 5800
Committed: Fri Apr 17 18:55:55 2015 UTC (11 years, 5 months ago) by michael
File size: 79871 byte(s)
Log Message:
- conf_parser.y: fixed error messages as pointed out by Adam

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

Properties

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