ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 5414
Committed: Sun Jan 25 17:40:40 2015 UTC (11 years, 8 months ago) by michael
File size: 79670 byte(s)
Log Message:
- conf_lexer.l, conf_parser.y: removed entropy gathering daemon leftovers

File Contents

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

Properties

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