ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 6375
Committed: Fri Aug 21 10:34:16 2015 UTC (11 years, 1 month ago) by michael
File size: 77728 byte(s)
Log Message:
- Remove splitmode checking

File Contents

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

Properties

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