ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 5805
Committed: Tue Apr 21 21:49:58 2015 UTC (11 years, 5 months ago) by michael
File size: 79252 byte(s)
Log Message:
- Removed glines
- Added kline_min_cidr, kline_min_cidr6, dline_min_cidr and
  dline_min_cidr6 configuration options

File Contents

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

Properties

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