ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 6678
Committed: Tue Oct 27 19:19:21 2015 UTC (10 years, 11 months ago) by michael
File size: 77495 byte(s)
Log Message:
- conf_parser.y: whitespace change

File Contents

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

Properties

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