ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_parser.y
Revision: 6318
Committed: Wed Aug 5 16:04:43 2015 UTC (8 years, 8 months ago) by michael
File size: 78548 byte(s)
Log Message:
- Get rid of UMODE_ALL

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2916 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 5347 * Copyright (c) 2000-2015 ircd-hybrid development team
5 adx 30 *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2916 /*! \file conf_parser.y
23     * \brief Parses the ircd configuration file.
24     * \version $Id$
25     */
26    
27    
28 adx 30 %{
29    
30     #include <sys/types.h>
31 stu 909 #include <string.h>
32 adx 30
33 michael 1009 #include "config.h"
34 adx 30 #include "stdinc.h"
35     #include "ircd.h"
36     #include "list.h"
37 michael 1309 #include "conf.h"
38 michael 1632 #include "conf_class.h"
39 michael 4545 #include "conf_pseudo.h"
40 adx 30 #include "event.h"
41 michael 6161 #include "id.h"
42 michael 1309 #include "log.h"
43 michael 6318 #include "client.h" /* for UMODE_SERVNOTICE only */
44 adx 30 #include "irc_string.h"
45     #include "memory.h"
46     #include "modules.h"
47 michael 3435 #include "server.h"
48 adx 30 #include "hostmask.h"
49     #include "send.h"
50     #include "listener.h"
51     #include "resv.h"
52     #include "numeric.h"
53 michael 3435 #include "user.h"
54 michael 2150 #include "motd.h"
55 adx 30
56     #ifdef HAVE_LIBCRYPTO
57     #include <openssl/rsa.h>
58     #include <openssl/bio.h>
59     #include <openssl/pem.h>
60 michael 1306 #include <openssl/dh.h>
61 adx 30 #endif
62    
63 michael 1752 #include "rsa.h"
64    
65 michael 1329 int yylex(void);
66    
67 michael 1646 static struct
68 michael 593 {
69 michael 3439 struct
70     {
71 michael 1646 dlink_list list;
72     } mask,
73     leaf,
74     hub;
75 adx 30
76 michael 3439 struct
77     {
78 michael 1646 char buf[IRCD_BUFSIZE];
79     } name,
80 michael 4545 nick,
81 michael 1646 user,
82     host,
83     addr,
84 michael 1647 bind,
85 michael 1646 file,
86 michael 1647 ciph,
87 michael 2228 cert,
88 michael 1647 rpass,
89     spass,
90 michael 5556 whois,
91 michael 4545 class,
92     target,
93     prepend,
94     command;
95 michael 1646
96 michael 3439 struct
97     {
98 michael 1646 unsigned int value;
99     } flags,
100     modes,
101 michael 1647 size,
102     type,
103 michael 1646 port,
104 michael 1647 aftype,
105 michael 1646 ping_freq,
106     max_perip,
107     con_freq,
108 michael 1783 min_idle,
109     max_idle,
110 michael 1646 max_total,
111     max_global,
112     max_local,
113     max_ident,
114     max_sendq,
115     max_recvq,
116 michael 3933 max_channels,
117 michael 1646 cidr_bitlen_ipv4,
118     cidr_bitlen_ipv6,
119     number_per_cidr;
120     } block_state;
121    
122 adx 30 static void
123 michael 1646 reset_block_state(void)
124 adx 30 {
125 michael 4915 dlink_node *node = NULL, *node_next = NULL;
126 michael 1646
127 michael 4915 DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head)
128 michael 1646 {
129 michael 4915 MyFree(node->data);
130     dlinkDelete(node, &block_state.mask.list);
131     free_dlink_node(node);
132 michael 1646 }
133    
134 michael 4915 DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head)
135 michael 1646 {
136 michael 4915 MyFree(node->data);
137     dlinkDelete(node, &block_state.leaf.list);
138     free_dlink_node(node);
139 michael 1646 }
140    
141 michael 4915 DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head)
142 michael 1646 {
143 michael 4915 MyFree(node->data);
144     dlinkDelete(node, &block_state.hub.list);
145     free_dlink_node(node);
146 michael 1646 }
147    
148     memset(&block_state, 0, sizeof(block_state));
149 adx 30 }
150    
151     %}
152    
153     %union {
154     int number;
155     char *string;
156     }
157    
158     %token ACCEPT_PASSWORD
159     %token ADMIN
160     %token AFTYPE
161     %token ANTI_NICK_FLOOD
162     %token ANTI_SPAM_EXIT_MESSAGE_TIME
163     %token AUTOCONN
164 michael 4313 %token AWAY_COUNT
165     %token AWAY_TIME
166 michael 1520 %token BYTES KBYTES MBYTES
167 adx 30 %token CALLER_ID_WAIT
168     %token CAN_FLOOD
169     %token CHANNEL
170 michael 2129 %token CIDR_BITLEN_IPV4
171     %token CIDR_BITLEN_IPV6
172 adx 30 %token CLASS
173     %token CONNECT
174     %token CONNECTFREQ
175 michael 2283 %token CYCLE_ON_HOST_CHANGE
176 adx 30 %token DEFAULT_FLOODCOUNT
177 michael 5489 %token DEFAULT_JOIN_FLOOD_COUNT
178     %token DEFAULT_JOIN_FLOOD_TIME
179     %token DEFAULT_MAX_CLIENTS
180 adx 30 %token DEFAULT_SPLIT_SERVER_COUNT
181     %token DEFAULT_SPLIT_USER_COUNT
182     %token DENY
183     %token DESCRIPTION
184     %token DIE
185     %token DISABLE_AUTH
186 michael 632 %token DISABLE_FAKE_CHANNELS
187 adx 30 %token DISABLE_REMOTE_COMMANDS
188 michael 5805 %token DLINE_MIN_CIDR
189     %token DLINE_MIN_CIDR6
190 adx 30 %token DOTS_IN_IDENT
191     %token EMAIL
192     %token ENCRYPTED
193     %token EXCEED_LIMIT
194     %token EXEMPT
195     %token FAILED_OPER_NOTICE
196     %token FLATTEN_LINKS
197     %token GECOS
198     %token GENERAL
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 michael 5985 %token XLINE_EXEMPT
376 adx 30
377 michael 2129 %type <string> QSTRING
378     %type <number> NUMBER
379     %type <number> timespec
380     %type <number> timespec_
381     %type <number> sizespec
382     %type <number> sizespec_
383 adx 30
384     %%
385 michael 2916 conf:
386 adx 30 | conf conf_item
387     ;
388    
389     conf_item: admin_entry
390     | logging_entry
391     | oper_entry
392 michael 3439 | channel_entry
393 michael 2916 | class_entry
394 adx 30 | listen_entry
395     | auth_entry
396     | serverinfo_entry
397 michael 3439 | serverhide_entry
398 adx 30 | resv_entry
399 michael 1157 | service_entry
400 adx 30 | shared_entry
401 michael 3439 | cluster_entry
402 adx 30 | connect_entry
403     | kill_entry
404     | deny_entry
405 michael 3439 | exempt_entry
406     | general_entry
407 adx 30 | gecos_entry
408     | modules_entry
409 michael 2150 | motd_entry
410 michael 4545 | pseudo_entry
411 adx 30 | error ';'
412     | error '}'
413     ;
414    
415    
416     timespec_: { $$ = 0; } | timespec;
417 michael 3439 timespec: NUMBER timespec_ { $$ = $1 + $2; } |
418     NUMBER SECONDS timespec_ { $$ = $1 + $3; } |
419     NUMBER MINUTES timespec_ { $$ = $1 * 60 + $3; } |
420     NUMBER HOURS timespec_ { $$ = $1 * 60 * 60 + $3; } |
421     NUMBER DAYS timespec_ { $$ = $1 * 60 * 60 * 24 + $3; } |
422     NUMBER WEEKS timespec_ { $$ = $1 * 60 * 60 * 24 * 7 + $3; } |
423     NUMBER MONTHS timespec_ { $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3; } |
424     NUMBER YEARS timespec_ { $$ = $1 * 60 * 60 * 24 * 365 + $3; }
425     ;
426 adx 30
427 michael 3439 sizespec_: { $$ = 0; } | sizespec;
428     sizespec: NUMBER sizespec_ { $$ = $1 + $2; } |
429     NUMBER BYTES sizespec_ { $$ = $1 + $3; } |
430     NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } |
431     NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; }
432     ;
433 adx 30
434    
435     /***************************************************************************
436     * section modules
437     ***************************************************************************/
438     modules_entry: MODULES
439     '{' modules_items '}' ';';
440    
441     modules_items: modules_items modules_item | modules_item;
442     modules_item: modules_module | modules_path | error ';' ;
443    
444     modules_module: MODULE '=' QSTRING ';'
445     {
446 michael 967 if (conf_parser_ctx.pass == 2)
447 michael 978 add_conf_module(libio_basename(yylval.string));
448 adx 30 };
449    
450     modules_path: PATH '=' QSTRING ';'
451     {
452 michael 967 if (conf_parser_ctx.pass == 2)
453 adx 30 mod_add_path(yylval.string);
454     };
455    
456    
457 michael 967 serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';';
458    
459     serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ;
460 michael 3439 serverinfo_item: serverinfo_name |
461     serverinfo_vhost |
462     serverinfo_hub |
463     serverinfo_description |
464     serverinfo_network_name |
465     serverinfo_network_desc |
466 michael 5489 serverinfo_default_max_clients |
467 michael 3439 serverinfo_max_nick_length |
468     serverinfo_max_topic_length |
469     serverinfo_ssl_dh_param_file |
470 michael 4070 serverinfo_ssl_dh_elliptic_curve |
471 michael 3439 serverinfo_rsa_private_key_file |
472     serverinfo_vhost6 |
473     serverinfo_sid |
474     serverinfo_ssl_certificate_file |
475 michael 1316 serverinfo_ssl_cipher_list |
476 michael 4114 serverinfo_ssl_message_digest_algorithm |
477 michael 3439 error ';' ;
478 adx 30
479 michael 967
480 adx 30 serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';'
481     {
482     #ifdef HAVE_LIBCRYPTO
483 michael 4499 if (conf_parser_ctx.pass == 2)
484 adx 30 {
485 michael 4340 if (!ConfigServerInfo.rsa_private_key_file)
486 adx 30 {
487 michael 1752 conf_error_report("No rsa_private_key_file specified, SSL disabled");
488 adx 30 break;
489     }
490    
491 michael 4624 if (SSL_CTX_use_certificate_chain_file(ConfigServerInfo.server_ctx, yylval.string) <= 0 ||
492     SSL_CTX_use_certificate_chain_file(ConfigServerInfo.client_ctx, yylval.string) <= 0)
493 adx 30 {
494 michael 1752 report_crypto_errors();
495     conf_error_report("Could not open/read certificate file");
496 adx 30 break;
497     }
498    
499 michael 4340 if (SSL_CTX_use_PrivateKey_file(ConfigServerInfo.server_ctx, ConfigServerInfo.rsa_private_key_file,
500 michael 1303 SSL_FILETYPE_PEM) <= 0 ||
501 michael 4340 SSL_CTX_use_PrivateKey_file(ConfigServerInfo.client_ctx, ConfigServerInfo.rsa_private_key_file,
502 michael 967 SSL_FILETYPE_PEM) <= 0)
503 adx 30 {
504 michael 1752 report_crypto_errors();
505     conf_error_report("Could not read RSA private key");
506 adx 30 break;
507     }
508    
509 michael 4340 if (!SSL_CTX_check_private_key(ConfigServerInfo.server_ctx) ||
510     !SSL_CTX_check_private_key(ConfigServerInfo.client_ctx))
511 adx 30 {
512 michael 1753 report_crypto_errors();
513     conf_error_report("Could not read RSA private key");
514 adx 30 break;
515     }
516     }
517     #endif
518     };
519    
520     serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';'
521     {
522     #ifdef HAVE_LIBCRYPTO
523 michael 2129 BIO *file = NULL;
524    
525     if (conf_parser_ctx.pass != 1)
526     break;
527    
528 michael 4340 if (ConfigServerInfo.rsa_private_key)
529 adx 30 {
530 michael 4340 RSA_free(ConfigServerInfo.rsa_private_key);
531     ConfigServerInfo.rsa_private_key = NULL;
532 michael 2129 }
533 adx 30
534 michael 4340 if (ConfigServerInfo.rsa_private_key_file)
535 michael 2129 {
536 michael 4340 MyFree(ConfigServerInfo.rsa_private_key_file);
537     ConfigServerInfo.rsa_private_key_file = NULL;
538 michael 2129 }
539 adx 30
540 michael 4340 ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string);
541 adx 30
542 michael 2129 if ((file = BIO_new_file(yylval.string, "r")) == NULL)
543     {
544     conf_error_report("File open failed, ignoring");
545     break;
546     }
547 adx 30
548 michael 4340 ConfigServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL);
549 adx 30
550 michael 2129 BIO_set_close(file, BIO_CLOSE);
551     BIO_free(file);
552 adx 30
553 michael 4340 if (ConfigServerInfo.rsa_private_key == NULL)
554 michael 2129 {
555     conf_error_report("Couldn't extract key, ignoring");
556     break;
557     }
558 adx 30
559 michael 4340 if (!RSA_check_key(ConfigServerInfo.rsa_private_key))
560 michael 2129 {
561 michael 4340 RSA_free(ConfigServerInfo.rsa_private_key);
562     ConfigServerInfo.rsa_private_key = NULL;
563 adx 30
564 michael 2129 conf_error_report("Invalid key, ignoring");
565     break;
566     }
567 adx 30
568 michael 4340 if (RSA_size(ConfigServerInfo.rsa_private_key) < 128)
569 michael 2129 {
570 michael 4340 RSA_free(ConfigServerInfo.rsa_private_key);
571     ConfigServerInfo.rsa_private_key = NULL;
572 adx 30
573 michael 2843 conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size");
574 adx 30 }
575     #endif
576     };
577    
578 michael 1306 serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';'
579     {
580     #ifdef HAVE_LIBCRYPTO
581 michael 4499 if (conf_parser_ctx.pass == 2)
582 michael 1306 {
583     BIO *file = BIO_new_file(yylval.string, "r");
584    
585     if (file)
586     {
587     DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL);
588    
589     BIO_free(file);
590    
591     if (dh)
592     {
593 michael 1352 if (DH_size(dh) < 128)
594 michael 1752 conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size");
595 michael 1352 else
596 michael 4340 SSL_CTX_set_tmp_dh(ConfigServerInfo.server_ctx, dh);
597 michael 1352
598 michael 1306 DH_free(dh);
599     }
600     }
601 michael 4258 else
602     conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- could not open/read Diffie-Hellman parameter file");
603 michael 1306 }
604     #endif
605     };
606    
607     serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';'
608     {
609     #ifdef HAVE_LIBCRYPTO
610 michael 4499 if (conf_parser_ctx.pass == 2)
611 michael 4340 SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, yylval.string);
612 michael 1306 #endif
613     };
614    
615 michael 4114 serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';'
616     {
617     #ifdef HAVE_LIBCRYPTO
618 michael 4499 if (conf_parser_ctx.pass == 2)
619 michael 4114 {
620 michael 4340 if ((ConfigServerInfo.message_digest_algorithm = EVP_get_digestbyname(yylval.string)) == NULL)
621 michael 4121 {
622 michael 4340 ConfigServerInfo.message_digest_algorithm = EVP_sha256();
623 michael 4114 conf_error_report("Ignoring serverinfo::ssl_message_digest_algorithm -- unknown message digest algorithm");
624 michael 4121 }
625 michael 4114 }
626     #endif
627     }
628    
629 michael 4070 serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';'
630     {
631     #ifdef HAVE_LIBCRYPTO
632 michael 4744 #if OPENSSL_VERSION_NUMBER >= 0x009080FFL && !defined(OPENSSL_NO_ECDH)
633 michael 4070 int nid = 0;
634     EC_KEY *key = NULL;
635    
636 michael 4499 if (conf_parser_ctx.pass == 2)
637 michael 4070 {
638     if ((nid = OBJ_sn2nid(yylval.string)) == 0)
639     {
640 michael 5800 conf_error_report("Ignoring serverinfo::ssl_dh_elliptic_curve -- unknown curve name");
641 michael 4070 break;
642     }
643    
644     if ((key = EC_KEY_new_by_curve_name(nid)) == NULL)
645     {
646 michael 5800 conf_error_report("Ignoring serverinfo::ssl_dh_elliptic_curve -- could not create curve");
647 michael 4070 break;
648     }
649    
650 michael 4340 SSL_CTX_set_tmp_ecdh(ConfigServerInfo.server_ctx, key);
651 michael 4070 EC_KEY_free(key);
652     }
653     #endif
654     #endif
655     };
656    
657 michael 2916 serverinfo_name: NAME '=' QSTRING ';'
658 adx 30 {
659     /* this isn't rehashable */
660 michael 4340 if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name)
661 adx 30 {
662 michael 1117 if (valid_servname(yylval.string))
663 michael 4340 ConfigServerInfo.name = xstrdup(yylval.string);
664 michael 1117 else
665 adx 30 {
666 michael 1752 conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting.");
667 michael 1117 exit(0);
668 adx 30 }
669     }
670     };
671    
672 michael 2916 serverinfo_sid: IRCD_SID '=' QSTRING ';'
673 adx 30 {
674     /* this isn't rehashable */
675 michael 4340 if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid)
676 adx 30 {
677 michael 573 if (valid_sid(yylval.string))
678 michael 4340 ConfigServerInfo.sid = xstrdup(yylval.string);
679 adx 30 else
680     {
681 michael 1752 conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting.");
682 adx 30 exit(0);
683     }
684     }
685     };
686    
687     serverinfo_description: DESCRIPTION '=' QSTRING ';'
688     {
689 michael 967 if (conf_parser_ctx.pass == 2)
690 adx 30 {
691 michael 4340 MyFree(ConfigServerInfo.description);
692     ConfigServerInfo.description = xstrdup(yylval.string);
693 michael 4513 strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info));
694 adx 30 }
695     };
696    
697     serverinfo_network_name: NETWORK_NAME '=' QSTRING ';'
698     {
699 michael 967 if (conf_parser_ctx.pass == 2)
700 adx 30 {
701     char *p;
702    
703 michael 3443 if ((p = strchr(yylval.string, ' ')))
704 michael 3892 *p = '\0';
705 adx 30
706 michael 4340 MyFree(ConfigServerInfo.network_name);
707     ConfigServerInfo.network_name = xstrdup(yylval.string);
708 adx 30 }
709     };
710    
711     serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';'
712     {
713 michael 2129 if (conf_parser_ctx.pass != 2)
714     break;
715    
716 michael 4340 MyFree(ConfigServerInfo.network_desc);
717     ConfigServerInfo.network_desc = xstrdup(yylval.string);
718 adx 30 };
719    
720     serverinfo_vhost: VHOST '=' QSTRING ';'
721     {
722 michael 967 if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
723 adx 30 {
724     struct addrinfo hints, *res;
725    
726     memset(&hints, 0, sizeof(hints));
727    
728     hints.ai_family = AF_UNSPEC;
729     hints.ai_socktype = SOCK_STREAM;
730     hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
731    
732 michael 1123 if (getaddrinfo(yylval.string, NULL, &hints, &res))
733 michael 1247 ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string);
734 adx 30 else
735     {
736 michael 3443 assert(res);
737 adx 30
738 michael 4340 memcpy(&ConfigServerInfo.ip, res->ai_addr, res->ai_addrlen);
739     ConfigServerInfo.ip.ss.ss_family = res->ai_family;
740     ConfigServerInfo.ip.ss_len = res->ai_addrlen;
741 michael 1123 freeaddrinfo(res);
742 adx 30
743 michael 4340 ConfigServerInfo.specific_ipv4_vhost = 1;
744 adx 30 }
745     }
746     };
747    
748     serverinfo_vhost6: VHOST6 '=' QSTRING ';'
749     {
750 michael 967 if (conf_parser_ctx.pass == 2 && *yylval.string != '*')
751 adx 30 {
752     struct addrinfo hints, *res;
753    
754     memset(&hints, 0, sizeof(hints));
755    
756     hints.ai_family = AF_UNSPEC;
757     hints.ai_socktype = SOCK_STREAM;
758     hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
759    
760 michael 1123 if (getaddrinfo(yylval.string, NULL, &hints, &res))
761 michael 1247 ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string);
762 adx 30 else
763     {
764 michael 3443 assert(res);
765 adx 30
766 michael 4340 memcpy(&ConfigServerInfo.ip6, res->ai_addr, res->ai_addrlen);
767     ConfigServerInfo.ip6.ss.ss_family = res->ai_family;
768     ConfigServerInfo.ip6.ss_len = res->ai_addrlen;
769 michael 1123 freeaddrinfo(res);
770 adx 30
771 michael 4340 ConfigServerInfo.specific_ipv6_vhost = 1;
772 adx 30 }
773     }
774     };
775    
776 michael 5489 serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';'
777 adx 30 {
778 michael 1736 if (conf_parser_ctx.pass != 2)
779     break;
780    
781     if ($3 < MAXCLIENTS_MIN)
782 adx 30 {
783 michael 3443 char buf[IRCD_BUFSIZE] = "";
784 adx 30
785 michael 1736 snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN);
786 michael 1752 conf_error_report(buf);
787 michael 5489 ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN;
788 adx 30 }
789 michael 1736 else if ($3 > MAXCLIENTS_MAX)
790     {
791 michael 3443 char buf[IRCD_BUFSIZE] = "";
792 michael 1736
793     snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX);
794 michael 1752 conf_error_report(buf);
795 michael 5489 ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX;
796 michael 1736 }
797     else
798 michael 5489 ConfigServerInfo.default_max_clients = $3;
799 adx 30 };
800    
801 michael 1751 serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';'
802     {
803     if (conf_parser_ctx.pass != 2)
804     break;
805    
806     if ($3 < 9)
807     {
808     conf_error_report("max_nick_length too low, setting to 9");
809 michael 4340 ConfigServerInfo.max_nick_length = 9;
810 michael 1751 }
811     else if ($3 > NICKLEN)
812     {
813 michael 3443 char buf[IRCD_BUFSIZE] = "";
814 michael 1751
815     snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN);
816     conf_error_report(buf);
817 michael 4340 ConfigServerInfo.max_nick_length = NICKLEN;
818 michael 1751 }
819     else
820 michael 4340 ConfigServerInfo.max_nick_length = $3;
821 michael 1751 };
822    
823     serverinfo_max_topic_length: MAX_TOPIC_LENGTH '=' NUMBER ';'
824     {
825     if (conf_parser_ctx.pass != 2)
826     break;
827    
828     if ($3 < 80)
829     {
830     conf_error_report("max_topic_length too low, setting to 80");
831 michael 4340 ConfigServerInfo.max_topic_length = 80;
832 michael 1751 }
833     else if ($3 > TOPICLEN)
834     {
835 michael 3443 char buf[IRCD_BUFSIZE] = "";
836 michael 1751
837     snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN);
838     conf_error_report(buf);
839 michael 4340 ConfigServerInfo.max_topic_length = TOPICLEN;
840 michael 1751 }
841     else
842 michael 4340 ConfigServerInfo.max_topic_length = $3;
843 michael 1751 };
844    
845 michael 2916 serverinfo_hub: HUB '=' TBOOL ';'
846 adx 30 {
847 michael 967 if (conf_parser_ctx.pass == 2)
848 michael 4340 ConfigServerInfo.hub = yylval.number;
849 adx 30 };
850    
851     /***************************************************************************
852     * admin section
853     ***************************************************************************/
854     admin_entry: ADMIN '{' admin_items '}' ';' ;
855    
856     admin_items: admin_items admin_item | admin_item;
857 michael 3439 admin_item: admin_name |
858     admin_description |
859     admin_email |
860     error ';' ;
861 adx 30
862 michael 2916 admin_name: NAME '=' QSTRING ';'
863 adx 30 {
864 michael 2129 if (conf_parser_ctx.pass != 2)
865     break;
866    
867 michael 4340 MyFree(ConfigAdminInfo.name);
868     ConfigAdminInfo.name = xstrdup(yylval.string);
869 adx 30 };
870    
871     admin_email: EMAIL '=' QSTRING ';'
872     {
873 michael 2129 if (conf_parser_ctx.pass != 2)
874     break;
875    
876 michael 4340 MyFree(ConfigAdminInfo.email);
877     ConfigAdminInfo.email = xstrdup(yylval.string);
878 adx 30 };
879    
880     admin_description: DESCRIPTION '=' QSTRING ';'
881     {
882 michael 2129 if (conf_parser_ctx.pass != 2)
883     break;
884    
885 michael 4340 MyFree(ConfigAdminInfo.description);
886     ConfigAdminInfo.description = xstrdup(yylval.string);
887 adx 30 };
888    
889     /***************************************************************************
890 michael 2150 * motd section
891     ***************************************************************************/
892 michael 2916 motd_entry: MOTD
893 michael 2150 {
894     if (conf_parser_ctx.pass == 2)
895     reset_block_state();
896     } '{' motd_items '}' ';'
897     {
898 michael 4915 dlink_node *node = NULL;
899 michael 2150
900     if (conf_parser_ctx.pass != 2)
901     break;
902    
903     if (!block_state.file.buf[0])
904     break;
905    
906 michael 4915 DLINK_FOREACH(node, block_state.mask.list.head)
907     motd_add(node->data, block_state.file.buf);
908 michael 2150 };
909    
910     motd_items: motd_items motd_item | motd_item;
911     motd_item: motd_mask | motd_file | error ';' ;
912    
913 michael 2916 motd_mask: MASK '=' QSTRING ';'
914 michael 2150 {
915     if (conf_parser_ctx.pass == 2)
916     dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
917     };
918    
919     motd_file: T_FILE '=' QSTRING ';'
920     {
921     if (conf_parser_ctx.pass == 2)
922     strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
923     };
924    
925     /***************************************************************************
926 michael 4545 * pseudo section
927     ***************************************************************************/
928     pseudo_entry: T_PSEUDO
929     {
930     if (conf_parser_ctx.pass == 2)
931     reset_block_state();
932     } '{' pseudo_items '}' ';'
933     {
934     if (conf_parser_ctx.pass != 2)
935     break;
936    
937     if (!block_state.command.buf[0] ||
938     !block_state.name.buf[0] ||
939     !block_state.nick.buf[0] ||
940     !block_state.host.buf[0])
941     break;
942    
943     pseudo_register(block_state.name.buf, block_state.nick.buf, block_state.host.buf,
944     block_state.prepend.buf, block_state.command.buf);
945     };
946    
947     pseudo_items: pseudo_items pseudo_item | pseudo_item;
948     pseudo_item: pseudo_command | pseudo_prepend | pseudo_name | pseudo_target | error ';' ;
949    
950     pseudo_command: T_COMMAND '=' QSTRING ';'
951     {
952     if (conf_parser_ctx.pass == 2)
953     strlcpy(block_state.command.buf, yylval.string, sizeof(block_state.command.buf));
954     };
955    
956     pseudo_name: NAME '=' QSTRING ';'
957     {
958     if (conf_parser_ctx.pass == 2)
959     strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
960     };
961    
962     pseudo_prepend: T_PREPEND '=' QSTRING ';'
963     {
964     if (conf_parser_ctx.pass == 2)
965     strlcpy(block_state.prepend.buf, yylval.string, sizeof(block_state.prepend.buf));
966     };
967    
968     pseudo_target: T_TARGET '=' QSTRING ';'
969     {
970     if (conf_parser_ctx.pass == 2)
971     {
972     struct split_nuh_item nuh;
973    
974     nuh.nuhmask = yylval.string;
975     nuh.nickptr = NULL;
976 michael 5602 nuh.userptr = block_state.nick.buf;
977 michael 4545 nuh.hostptr = block_state.host.buf;
978     nuh.nicksize = 0;
979     nuh.usersize = sizeof(block_state.nick.buf);
980     nuh.hostsize = sizeof(block_state.host.buf);
981 michael 5602
982 michael 4545 split_nuh(&nuh);
983     }
984     };
985    
986     /***************************************************************************
987 adx 30 * section logging
988     ***************************************************************************/
989 michael 1247 logging_entry: T_LOG '{' logging_items '}' ';' ;
990     logging_items: logging_items logging_item | logging_item ;
991 adx 30
992 michael 3439 logging_item: logging_use_logging | logging_file_entry |
993     error ';' ;
994 adx 30
995 michael 1247 logging_use_logging: USE_LOGGING '=' TBOOL ';'
996 adx 30 {
997 michael 967 if (conf_parser_ctx.pass == 2)
998 michael 4340 ConfigLog.use_logging = yylval.number;
999 adx 30 };
1000    
1001 michael 1247 logging_file_entry:
1002 adx 30 {
1003 michael 1647 if (conf_parser_ctx.pass == 2)
1004     reset_block_state();
1005 michael 1247 } T_FILE '{' logging_file_items '}' ';'
1006 adx 30 {
1007 michael 1647 if (conf_parser_ctx.pass != 2)
1008     break;
1009    
1010     if (block_state.type.value && block_state.file.buf[0])
1011 michael 1831 log_set_file(block_state.type.value, block_state.size.value,
1012 michael 1647 block_state.file.buf);
1013 adx 30 };
1014    
1015 michael 1247 logging_file_items: logging_file_items logging_file_item |
1016     logging_file_item ;
1017 adx 30
1018 michael 1247 logging_file_item: logging_file_name | logging_file_type |
1019     logging_file_size | error ';' ;
1020    
1021     logging_file_name: NAME '=' QSTRING ';'
1022 adx 30 {
1023 michael 1647 if (conf_parser_ctx.pass != 2)
1024     break;
1025    
1026     strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1027 michael 1247 }
1028 adx 30
1029 michael 1247 logging_file_size: T_SIZE '=' sizespec ';'
1030 adx 30 {
1031 michael 1647 block_state.size.value = $3;
1032 michael 1250 } | T_SIZE '=' T_UNLIMITED ';'
1033     {
1034 michael 1647 block_state.size.value = 0;
1035 adx 30 };
1036    
1037 michael 1247 logging_file_type: TYPE
1038 adx 30 {
1039 michael 967 if (conf_parser_ctx.pass == 2)
1040 michael 1647 block_state.type.value = 0;
1041 michael 1247 } '=' logging_file_type_items ';' ;
1042 adx 30
1043 michael 1247 logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item;
1044     logging_file_type_item: USER
1045 adx 30 {
1046 michael 967 if (conf_parser_ctx.pass == 2)
1047 michael 1647 block_state.type.value = LOG_TYPE_USER;
1048 michael 1247 } | OPERATOR
1049 adx 30 {
1050 michael 967 if (conf_parser_ctx.pass == 2)
1051 michael 1647 block_state.type.value = LOG_TYPE_OPER;
1052 michael 2336 } | XLINE
1053     {
1054     if (conf_parser_ctx.pass == 2)
1055     block_state.type.value = LOG_TYPE_XLINE;
1056     } | RESV
1057     {
1058     if (conf_parser_ctx.pass == 2)
1059     block_state.type.value = LOG_TYPE_RESV;
1060 michael 1247 } | T_DLINE
1061 adx 30 {
1062 michael 967 if (conf_parser_ctx.pass == 2)
1063 michael 1647 block_state.type.value = LOG_TYPE_DLINE;
1064 michael 1247 } | KLINE
1065 adx 30 {
1066 michael 967 if (conf_parser_ctx.pass == 2)
1067 michael 1647 block_state.type.value = LOG_TYPE_KLINE;
1068 michael 1247 } | KILL
1069 adx 30 {
1070 michael 967 if (conf_parser_ctx.pass == 2)
1071 michael 1647 block_state.type.value = LOG_TYPE_KILL;
1072 michael 1247 } | T_DEBUG
1073 adx 30 {
1074 michael 967 if (conf_parser_ctx.pass == 2)
1075 michael 1647 block_state.type.value = LOG_TYPE_DEBUG;
1076 adx 30 };
1077    
1078 michael 1247
1079 adx 30 /***************************************************************************
1080     * section oper
1081     ***************************************************************************/
1082 michael 2916 oper_entry: OPERATOR
1083 adx 30 {
1084 michael 1646 if (conf_parser_ctx.pass != 2)
1085     break;
1086    
1087     reset_block_state();
1088     block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1089 michael 1285 } '{' oper_items '}' ';'
1090 adx 30 {
1091 michael 4915 dlink_node *node = NULL;
1092 adx 30
1093 michael 1646 if (conf_parser_ctx.pass != 2)
1094     break;
1095 adx 30
1096 michael 1646 if (!block_state.name.buf[0])
1097     break;
1098     #ifdef HAVE_LIBCRYPTO
1099 michael 2129 if (!block_state.file.buf[0] &&
1100     !block_state.rpass.buf[0])
1101 michael 1646 break;
1102     #else
1103 michael 1647 if (!block_state.rpass.buf[0])
1104 michael 1646 break;
1105     #endif
1106 adx 30
1107 michael 4915 DLINK_FOREACH(node, block_state.mask.list.head)
1108 michael 1646 {
1109     struct MaskItem *conf = NULL;
1110     struct split_nuh_item nuh;
1111 adx 30
1112 michael 4915 nuh.nuhmask = node->data;
1113 michael 1646 nuh.nickptr = NULL;
1114 michael 1647 nuh.userptr = block_state.user.buf;
1115     nuh.hostptr = block_state.host.buf;
1116 michael 1646 nuh.nicksize = 0;
1117 michael 1647 nuh.usersize = sizeof(block_state.user.buf);
1118     nuh.hostsize = sizeof(block_state.host.buf);
1119 michael 1646 split_nuh(&nuh);
1120 adx 30
1121 michael 2228 conf = conf_make(CONF_OPER);
1122     conf->name = xstrdup(block_state.name.buf);
1123     conf->user = xstrdup(block_state.user.buf);
1124     conf->host = xstrdup(block_state.host.buf);
1125 michael 1285
1126 michael 2228 if (block_state.cert.buf[0])
1127     conf->certfp = xstrdup(block_state.cert.buf);
1128    
1129 michael 1647 if (block_state.rpass.buf[0])
1130     conf->passwd = xstrdup(block_state.rpass.buf);
1131 michael 1285
1132 michael 5556 if (block_state.whois.buf[0])
1133     conf->whois = xstrdup(block_state.whois.buf);
1134    
1135 michael 1646 conf->flags = block_state.flags.value;
1136     conf->modes = block_state.modes.value;
1137     conf->port = block_state.port.value;
1138     conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits);
1139 adx 30
1140 michael 1646 conf_add_class_to_conf(conf, block_state.class.buf);
1141    
1142 adx 30 #ifdef HAVE_LIBCRYPTO
1143 michael 1646 if (block_state.file.buf[0])
1144     {
1145     BIO *file = NULL;
1146     RSA *pkey = NULL;
1147    
1148     if ((file = BIO_new_file(block_state.file.buf, "r")) == NULL)
1149 adx 30 {
1150 michael 4256 ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- file doesn't exist");
1151 michael 1646 break;
1152 adx 30 }
1153    
1154 michael 1646 if ((pkey = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL)) == NULL)
1155 michael 4256 ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- key invalid; check key syntax");
1156 michael 4254 else
1157 michael 4258 {
1158     if (RSA_size(pkey) > 128)
1159     ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- key size must be 1024 or below");
1160     else
1161     conf->rsa_public_key = pkey;
1162     }
1163 michael 4254
1164 michael 1646 BIO_set_close(file, BIO_CLOSE);
1165     BIO_free(file);
1166 adx 30 }
1167 michael 1646 #endif /* HAVE_LIBCRYPTO */
1168 adx 30 }
1169 michael 1646 };
1170 adx 30
1171     oper_items: oper_items oper_item | oper_item;
1172 michael 3439 oper_item: oper_name |
1173     oper_user |
1174     oper_password |
1175 michael 5556 oper_whois |
1176 michael 3439 oper_umodes |
1177     oper_class |
1178     oper_encrypted |
1179     oper_rsa_public_key_file |
1180     oper_ssl_certificate_fingerprint |
1181     oper_ssl_connection_required |
1182     oper_flags |
1183     error ';' ;
1184 adx 30
1185     oper_name: NAME '=' QSTRING ';'
1186     {
1187 michael 967 if (conf_parser_ctx.pass == 2)
1188 michael 1646 strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf));
1189 adx 30 };
1190    
1191     oper_user: USER '=' QSTRING ';'
1192     {
1193 michael 967 if (conf_parser_ctx.pass == 2)
1194 michael 1646 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1195 adx 30 };
1196    
1197     oper_password: PASSWORD '=' QSTRING ';'
1198     {
1199 michael 967 if (conf_parser_ctx.pass == 2)
1200 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1201 adx 30 };
1202    
1203 michael 5556 oper_whois: WHOIS '=' QSTRING ';'
1204     {
1205     if (conf_parser_ctx.pass == 2)
1206     strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf));
1207     };
1208    
1209 adx 30 oper_encrypted: ENCRYPTED '=' TBOOL ';'
1210     {
1211 michael 2129 if (conf_parser_ctx.pass != 2)
1212     break;
1213    
1214     if (yylval.number)
1215     block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1216     else
1217     block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1218 adx 30 };
1219    
1220     oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';'
1221     {
1222 michael 967 if (conf_parser_ctx.pass == 2)
1223 michael 1646 strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf));
1224 adx 30 };
1225    
1226 michael 2244 oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';'
1227 michael 2228 {
1228     if (conf_parser_ctx.pass == 2)
1229 michael 2229 strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf));
1230 michael 2228 };
1231    
1232 michael 2248 oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';'
1233     {
1234     if (conf_parser_ctx.pass != 2)
1235     break;
1236    
1237     if (yylval.number)
1238     block_state.flags.value |= CONF_FLAGS_SSL;
1239     else
1240     block_state.flags.value &= ~CONF_FLAGS_SSL;
1241     };
1242    
1243 adx 30 oper_class: CLASS '=' QSTRING ';'
1244     {
1245 michael 967 if (conf_parser_ctx.pass == 2)
1246 michael 1646 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1247 adx 30 };
1248    
1249 michael 56 oper_umodes: T_UMODES
1250     {
1251 michael 967 if (conf_parser_ctx.pass == 2)
1252 michael 1646 block_state.modes.value = 0;
1253 michael 56 } '=' oper_umodes_items ';' ;
1254    
1255     oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item;
1256     oper_umodes_item: T_BOTS
1257     {
1258 michael 967 if (conf_parser_ctx.pass == 2)
1259 michael 1646 block_state.modes.value |= UMODE_BOTS;
1260 michael 56 } | T_CCONN
1261     {
1262 michael 967 if (conf_parser_ctx.pass == 2)
1263 michael 1646 block_state.modes.value |= UMODE_CCONN;
1264 michael 56 } | T_DEAF
1265     {
1266 michael 967 if (conf_parser_ctx.pass == 2)
1267 michael 1646 block_state.modes.value |= UMODE_DEAF;
1268 michael 56 } | T_DEBUG
1269     {
1270 michael 967 if (conf_parser_ctx.pass == 2)
1271 michael 1646 block_state.modes.value |= UMODE_DEBUG;
1272 michael 56 } | T_FULL
1273     {
1274 michael 967 if (conf_parser_ctx.pass == 2)
1275 michael 1646 block_state.modes.value |= UMODE_FULL;
1276 michael 1294 } | HIDDEN
1277     {
1278     if (conf_parser_ctx.pass == 2)
1279 michael 1646 block_state.modes.value |= UMODE_HIDDEN;
1280 michael 3513 } | HIDE_CHANS
1281     {
1282     if (conf_parser_ctx.pass == 2)
1283     block_state.modes.value |= UMODE_HIDECHANS;
1284 michael 3506 } | HIDE_IDLE
1285     {
1286     if (conf_parser_ctx.pass == 2)
1287     block_state.modes.value |= UMODE_HIDEIDLE;
1288 michael 56 } | T_SKILL
1289     {
1290 michael 967 if (conf_parser_ctx.pass == 2)
1291 michael 1646 block_state.modes.value |= UMODE_SKILL;
1292 michael 56 } | T_NCHANGE
1293     {
1294 michael 967 if (conf_parser_ctx.pass == 2)
1295 michael 1646 block_state.modes.value |= UMODE_NCHANGE;
1296 michael 56 } | T_REJ
1297     {
1298 michael 967 if (conf_parser_ctx.pass == 2)
1299 michael 1646 block_state.modes.value |= UMODE_REJ;
1300 michael 56 } | T_UNAUTH
1301     {
1302 michael 967 if (conf_parser_ctx.pass == 2)
1303 michael 1646 block_state.modes.value |= UMODE_UNAUTH;
1304 michael 56 } | T_SPY
1305     {
1306 michael 967 if (conf_parser_ctx.pass == 2)
1307 michael 1646 block_state.modes.value |= UMODE_SPY;
1308 michael 56 } | T_EXTERNAL
1309     {
1310 michael 967 if (conf_parser_ctx.pass == 2)
1311 michael 1646 block_state.modes.value |= UMODE_EXTERNAL;
1312 michael 56 } | T_SERVNOTICE
1313     {
1314 michael 967 if (conf_parser_ctx.pass == 2)
1315 michael 1646 block_state.modes.value |= UMODE_SERVNOTICE;
1316 michael 56 } | T_INVISIBLE
1317     {
1318 michael 967 if (conf_parser_ctx.pass == 2)
1319 michael 1646 block_state.modes.value |= UMODE_INVISIBLE;
1320 michael 56 } | T_WALLOP
1321     {
1322 michael 967 if (conf_parser_ctx.pass == 2)
1323 michael 1646 block_state.modes.value |= UMODE_WALLOP;
1324 michael 56 } | T_SOFTCALLERID
1325     {
1326 michael 967 if (conf_parser_ctx.pass == 2)
1327 michael 1646 block_state.modes.value |= UMODE_SOFTCALLERID;
1328 michael 56 } | T_CALLERID
1329     {
1330 michael 967 if (conf_parser_ctx.pass == 2)
1331 michael 1646 block_state.modes.value |= UMODE_CALLERID;
1332 michael 56 } | T_LOCOPS
1333     {
1334 michael 967 if (conf_parser_ctx.pass == 2)
1335 michael 1646 block_state.modes.value |= UMODE_LOCOPS;
1336 michael 1855 } | T_NONONREG
1337     {
1338     if (conf_parser_ctx.pass == 2)
1339     block_state.modes.value |= UMODE_REGONLY;
1340 michael 1976 } | T_FARCONNECT
1341     {
1342     if (conf_parser_ctx.pass == 2)
1343     block_state.modes.value |= UMODE_FARCONNECT;
1344 michael 56 };
1345    
1346 adx 30 oper_flags: IRCD_FLAGS
1347     {
1348 michael 1228 if (conf_parser_ctx.pass == 2)
1349 michael 1646 block_state.port.value = 0;
1350 adx 30 } '=' oper_flags_items ';';
1351    
1352     oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item;
1353 michael 2012 oper_flags_item: KILL ':' REMOTE
1354 adx 30 {
1355 michael 967 if (conf_parser_ctx.pass == 2)
1356 michael 2012 block_state.port.value |= OPER_FLAG_KILL_REMOTE;
1357     } | KILL
1358 adx 30 {
1359 michael 967 if (conf_parser_ctx.pass == 2)
1360 michael 2012 block_state.port.value |= OPER_FLAG_KILL;
1361     } | CONNECT ':' REMOTE
1362     {
1363     if (conf_parser_ctx.pass == 2)
1364     block_state.port.value |= OPER_FLAG_CONNECT_REMOTE;
1365     } | CONNECT
1366     {
1367     if (conf_parser_ctx.pass == 2)
1368     block_state.port.value |= OPER_FLAG_CONNECT;
1369     } | SQUIT ':' REMOTE
1370     {
1371     if (conf_parser_ctx.pass == 2)
1372     block_state.port.value |= OPER_FLAG_SQUIT_REMOTE;
1373     } | SQUIT
1374     {
1375     if (conf_parser_ctx.pass == 2)
1376     block_state.port.value |= OPER_FLAG_SQUIT;
1377 adx 30 } | KLINE
1378     {
1379 michael 967 if (conf_parser_ctx.pass == 2)
1380 michael 4019 block_state.port.value |= OPER_FLAG_KLINE;
1381 adx 30 } | UNKLINE
1382     {
1383 michael 967 if (conf_parser_ctx.pass == 2)
1384 michael 1646 block_state.port.value |= OPER_FLAG_UNKLINE;
1385 michael 1301 } | T_DLINE
1386     {
1387     if (conf_parser_ctx.pass == 2)
1388 michael 1646 block_state.port.value |= OPER_FLAG_DLINE;
1389 michael 1301 } | T_UNDLINE
1390     {
1391     if (conf_parser_ctx.pass == 2)
1392 michael 1646 block_state.port.value |= OPER_FLAG_UNDLINE;
1393 adx 30 } | XLINE
1394     {
1395 michael 967 if (conf_parser_ctx.pass == 2)
1396 michael 2852 block_state.port.value |= OPER_FLAG_XLINE;
1397     } | T_UNXLINE
1398     {
1399     if (conf_parser_ctx.pass == 2)
1400     block_state.port.value |= OPER_FLAG_UNXLINE;
1401 adx 30 } | DIE
1402     {
1403 michael 967 if (conf_parser_ctx.pass == 2)
1404 michael 1646 block_state.port.value |= OPER_FLAG_DIE;
1405 michael 1228 } | T_RESTART
1406     {
1407     if (conf_parser_ctx.pass == 2)
1408 michael 1646 block_state.port.value |= OPER_FLAG_RESTART;
1409 adx 30 } | REHASH
1410     {
1411 michael 967 if (conf_parser_ctx.pass == 2)
1412 michael 1646 block_state.port.value |= OPER_FLAG_REHASH;
1413 adx 30 } | ADMIN
1414     {
1415 michael 967 if (conf_parser_ctx.pass == 2)
1416 michael 1646 block_state.port.value |= OPER_FLAG_ADMIN;
1417 michael 1216 } | T_GLOBOPS
1418     {
1419     if (conf_parser_ctx.pass == 2)
1420 michael 1646 block_state.port.value |= OPER_FLAG_GLOBOPS;
1421 michael 2038 } | T_WALLOPS
1422     {
1423     if (conf_parser_ctx.pass == 2)
1424     block_state.port.value |= OPER_FLAG_WALLOPS;
1425     } | T_LOCOPS
1426     {
1427     if (conf_parser_ctx.pass == 2)
1428     block_state.port.value |= OPER_FLAG_LOCOPS;
1429 adx 30 } | REMOTEBAN
1430     {
1431 michael 967 if (conf_parser_ctx.pass == 2)
1432 michael 1646 block_state.port.value |= OPER_FLAG_REMOTEBAN;
1433 michael 1460 } | T_SET
1434     {
1435     if (conf_parser_ctx.pass == 2)
1436 michael 1646 block_state.port.value |= OPER_FLAG_SET;
1437 michael 1228 } | MODULE
1438 adx 30 {
1439 michael 967 if (conf_parser_ctx.pass == 2)
1440 michael 1646 block_state.port.value |= OPER_FLAG_MODULE;
1441 michael 5004 } | T_OPME
1442     {
1443     if (conf_parser_ctx.pass == 2)
1444     block_state.port.value |= OPER_FLAG_OPME;
1445 adx 30 };
1446    
1447    
1448     /***************************************************************************
1449     * section class
1450     ***************************************************************************/
1451     class_entry: CLASS
1452     {
1453 michael 1651 if (conf_parser_ctx.pass != 1)
1454     break;
1455    
1456     reset_block_state();
1457    
1458     block_state.ping_freq.value = DEFAULT_PINGFREQUENCY;
1459     block_state.con_freq.value = DEFAULT_CONNECTFREQUENCY;
1460     block_state.max_total.value = MAXIMUM_LINKS_DEFAULT;
1461     block_state.max_sendq.value = DEFAULT_SENDQ;
1462     block_state.max_recvq.value = DEFAULT_RECVQ;
1463 michael 1285 } '{' class_items '}' ';'
1464 adx 30 {
1465 michael 1647 struct ClassItem *class = NULL;
1466 adx 30
1467 michael 1647 if (conf_parser_ctx.pass != 1)
1468     break;
1469 adx 30
1470 michael 1647 if (!block_state.class.buf[0])
1471     break;
1472 michael 671
1473 michael 1647 if (!(class = class_find(block_state.class.buf, 0)))
1474     class = class_make();
1475 michael 671
1476 michael 1647 class->active = 1;
1477     MyFree(class->name);
1478     class->name = xstrdup(block_state.class.buf);
1479     class->ping_freq = block_state.ping_freq.value;
1480     class->max_perip = block_state.max_perip.value;
1481     class->con_freq = block_state.con_freq.value;
1482     class->max_total = block_state.max_total.value;
1483     class->max_global = block_state.max_global.value;
1484     class->max_local = block_state.max_local.value;
1485     class->max_ident = block_state.max_ident.value;
1486     class->max_sendq = block_state.max_sendq.value;
1487     class->max_recvq = block_state.max_recvq.value;
1488 michael 3933 class->max_channels = block_state.max_channels.value;
1489 michael 671
1490 michael 1785 if (block_state.min_idle.value > block_state.max_idle.value)
1491     {
1492     block_state.min_idle.value = 0;
1493     block_state.max_idle.value = 0;
1494     block_state.flags.value &= ~CLASS_FLAGS_FAKE_IDLE;
1495     }
1496    
1497     class->flags = block_state.flags.value;
1498     class->min_idle = block_state.min_idle.value;
1499     class->max_idle = block_state.max_idle.value;
1500    
1501 michael 6008 rebuild_cidr_list(class);
1502 adx 30
1503 michael 1647 class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value;
1504     class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value;
1505     class->number_per_cidr = block_state.number_per_cidr.value;
1506 adx 30 };
1507    
1508     class_items: class_items class_item | class_item;
1509     class_item: class_name |
1510 michael 3439 class_cidr_bitlen_ipv4 |
1511     class_cidr_bitlen_ipv6 |
1512 adx 30 class_ping_time |
1513 michael 3439 class_number_per_cidr |
1514 adx 30 class_number_per_ip |
1515     class_connectfreq |
1516 michael 3933 class_max_channels |
1517 adx 30 class_max_number |
1518 michael 3439 class_max_global |
1519     class_max_local |
1520     class_max_ident |
1521 michael 1516 class_sendq | class_recvq |
1522 michael 1783 class_min_idle |
1523     class_max_idle |
1524     class_flags |
1525 michael 3439 error ';' ;
1526 adx 30
1527 michael 2916 class_name: NAME '=' QSTRING ';'
1528 adx 30 {
1529 michael 967 if (conf_parser_ctx.pass == 1)
1530 michael 1647 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1531 adx 30 };
1532    
1533     class_ping_time: PING_TIME '=' timespec ';'
1534     {
1535 michael 967 if (conf_parser_ctx.pass == 1)
1536 michael 1647 block_state.ping_freq.value = $3;
1537 adx 30 };
1538    
1539     class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';'
1540     {
1541 michael 967 if (conf_parser_ctx.pass == 1)
1542 michael 1647 block_state.max_perip.value = $3;
1543 adx 30 };
1544    
1545     class_connectfreq: CONNECTFREQ '=' timespec ';'
1546     {
1547 michael 967 if (conf_parser_ctx.pass == 1)
1548 michael 1647 block_state.con_freq.value = $3;
1549 adx 30 };
1550    
1551 michael 3933 class_max_channels: MAX_CHANNELS '=' NUMBER ';'
1552     {
1553     if (conf_parser_ctx.pass == 1)
1554     block_state.max_channels.value = $3;
1555     };
1556    
1557 adx 30 class_max_number: MAX_NUMBER '=' NUMBER ';'
1558     {
1559 michael 967 if (conf_parser_ctx.pass == 1)
1560 michael 1647 block_state.max_total.value = $3;
1561 adx 30 };
1562    
1563     class_max_global: MAX_GLOBAL '=' NUMBER ';'
1564     {
1565 michael 967 if (conf_parser_ctx.pass == 1)
1566 michael 1647 block_state.max_global.value = $3;
1567 adx 30 };
1568    
1569     class_max_local: MAX_LOCAL '=' NUMBER ';'
1570     {
1571 michael 967 if (conf_parser_ctx.pass == 1)
1572 michael 1647 block_state.max_local.value = $3;
1573 adx 30 };
1574    
1575     class_max_ident: MAX_IDENT '=' NUMBER ';'
1576     {
1577 michael 967 if (conf_parser_ctx.pass == 1)
1578 michael 1647 block_state.max_ident.value = $3;
1579 adx 30 };
1580    
1581     class_sendq: SENDQ '=' sizespec ';'
1582     {
1583 michael 967 if (conf_parser_ctx.pass == 1)
1584 michael 1647 block_state.max_sendq.value = $3;
1585 adx 30 };
1586    
1587 michael 1516 class_recvq: T_RECVQ '=' sizespec ';'
1588     {
1589     if (conf_parser_ctx.pass == 1)
1590     if ($3 >= CLIENT_FLOOD_MIN && $3 <= CLIENT_FLOOD_MAX)
1591 michael 1647 block_state.max_recvq.value = $3;
1592 michael 1516 };
1593    
1594 adx 30 class_cidr_bitlen_ipv4: CIDR_BITLEN_IPV4 '=' NUMBER ';'
1595     {
1596 michael 967 if (conf_parser_ctx.pass == 1)
1597 michael 1647 block_state.cidr_bitlen_ipv4.value = $3 > 32 ? 32 : $3;
1598 adx 30 };
1599    
1600     class_cidr_bitlen_ipv6: CIDR_BITLEN_IPV6 '=' NUMBER ';'
1601     {
1602 michael 967 if (conf_parser_ctx.pass == 1)
1603 michael 1647 block_state.cidr_bitlen_ipv6.value = $3 > 128 ? 128 : $3;
1604 adx 30 };
1605    
1606     class_number_per_cidr: NUMBER_PER_CIDR '=' NUMBER ';'
1607     {
1608 michael 967 if (conf_parser_ctx.pass == 1)
1609 michael 1647 block_state.number_per_cidr.value = $3;
1610 adx 30 };
1611    
1612 michael 1783 class_min_idle: MIN_IDLE '=' timespec ';'
1613     {
1614 michael 1785 if (conf_parser_ctx.pass != 1)
1615     break;
1616    
1617     block_state.min_idle.value = $3;
1618     block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1619 michael 1783 };
1620    
1621     class_max_idle: MAX_IDLE '=' timespec ';'
1622     {
1623 michael 1785 if (conf_parser_ctx.pass != 1)
1624     break;
1625    
1626     block_state.max_idle.value = $3;
1627     block_state.flags.value |= CLASS_FLAGS_FAKE_IDLE;
1628 michael 1783 };
1629    
1630     class_flags: IRCD_FLAGS
1631     {
1632     if (conf_parser_ctx.pass == 1)
1633 michael 1785 block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE;
1634 michael 1783 } '=' class_flags_items ';';
1635    
1636     class_flags_items: class_flags_items ',' class_flags_item | class_flags_item;
1637     class_flags_item: RANDOM_IDLE
1638     {
1639     if (conf_parser_ctx.pass == 1)
1640     block_state.flags.value |= CLASS_FLAGS_RANDOM_IDLE;
1641     } | HIDE_IDLE_FROM_OPERS
1642     {
1643     if (conf_parser_ctx.pass == 1)
1644     block_state.flags.value |= CLASS_FLAGS_HIDE_IDLE_FROM_OPERS;
1645     };
1646    
1647    
1648 adx 30 /***************************************************************************
1649     * section listen
1650     ***************************************************************************/
1651     listen_entry: LISTEN
1652     {
1653 michael 967 if (conf_parser_ctx.pass == 2)
1654 michael 1646 reset_block_state();
1655     } '{' listen_items '}' ';';
1656 adx 30
1657     listen_flags: IRCD_FLAGS
1658     {
1659 michael 1646 block_state.flags.value = 0;
1660 adx 30 } '=' listen_flags_items ';';
1661    
1662     listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item;
1663     listen_flags_item: T_SSL
1664     {
1665 michael 967 if (conf_parser_ctx.pass == 2)
1666 michael 1646 block_state.flags.value |= LISTENER_SSL;
1667 adx 30 } | HIDDEN
1668     {
1669 michael 967 if (conf_parser_ctx.pass == 2)
1670 michael 1647 block_state.flags.value |= LISTENER_HIDDEN;
1671 michael 900 } | T_SERVER
1672     {
1673 michael 967 if (conf_parser_ctx.pass == 2)
1674 michael 1647 block_state.flags.value |= LISTENER_SERVER;
1675 adx 30 };
1676    
1677     listen_items: listen_items listen_item | listen_item;
1678 michael 440 listen_item: listen_port | listen_flags | listen_address | listen_host | error ';';
1679 adx 30
1680 michael 1648 listen_port: PORT '=' port_items { block_state.flags.value = 0; } ';';
1681 adx 30
1682     port_items: port_items ',' port_item | port_item;
1683    
1684     port_item: NUMBER
1685     {
1686 michael 967 if (conf_parser_ctx.pass == 2)
1687 adx 30 {
1688 michael 4499 #ifndef HAVE_LIBCRYPTO
1689 michael 1646 if (block_state.flags.value & LISTENER_SSL)
1690 michael 4499 {
1691     conf_error_report("SSL not available - port closed");
1692     break;
1693     }
1694 adx 30 #endif
1695 michael 1646 add_listener($1, block_state.addr.buf, block_state.flags.value);
1696 adx 30 }
1697     } | NUMBER TWODOTS NUMBER
1698     {
1699 michael 967 if (conf_parser_ctx.pass == 2)
1700 adx 30 {
1701 michael 4499 #ifndef HAVE_LIBCRYPTO
1702 michael 1646 if (block_state.flags.value & LISTENER_SSL)
1703 michael 4499 {
1704     conf_error_report("SSL not available - port closed");
1705     break;
1706     }
1707 adx 30 #endif
1708    
1709 michael 3439 for (int i = $1; i <= $3; ++i)
1710 michael 1646 add_listener(i, block_state.addr.buf, block_state.flags.value);
1711 adx 30 }
1712     };
1713    
1714     listen_address: IP '=' QSTRING ';'
1715     {
1716 michael 967 if (conf_parser_ctx.pass == 2)
1717 michael 1646 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1718 adx 30 };
1719    
1720     listen_host: HOST '=' QSTRING ';'
1721     {
1722 michael 967 if (conf_parser_ctx.pass == 2)
1723 michael 1646 strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf));
1724 adx 30 };
1725    
1726     /***************************************************************************
1727     * section auth
1728     ***************************************************************************/
1729     auth_entry: IRCD_AUTH
1730     {
1731 michael 967 if (conf_parser_ctx.pass == 2)
1732 michael 1646 reset_block_state();
1733 adx 30 } '{' auth_items '}' ';'
1734     {
1735 michael 4915 dlink_node *node = NULL;
1736 adx 30
1737 michael 1646 if (conf_parser_ctx.pass != 2)
1738     break;
1739 adx 30
1740 michael 4915 DLINK_FOREACH(node, block_state.mask.list.head)
1741 michael 1646 {
1742     struct MaskItem *conf = NULL;
1743     struct split_nuh_item nuh;
1744 adx 30
1745 michael 4915 nuh.nuhmask = node->data;
1746 michael 1646 nuh.nickptr = NULL;
1747 michael 1647 nuh.userptr = block_state.user.buf;
1748     nuh.hostptr = block_state.host.buf;
1749 michael 1646 nuh.nicksize = 0;
1750 michael 1647 nuh.usersize = sizeof(block_state.user.buf);
1751     nuh.hostsize = sizeof(block_state.host.buf);
1752 michael 1646 split_nuh(&nuh);
1753 adx 30
1754 michael 1646 conf = conf_make(CONF_CLIENT);
1755 michael 2106 conf->user = xstrdup(block_state.user.buf);
1756     conf->host = xstrdup(block_state.host.buf);
1757 adx 30
1758 michael 1647 if (block_state.rpass.buf[0])
1759     conf->passwd = xstrdup(block_state.rpass.buf);
1760 michael 1646 if (block_state.name.buf[0])
1761 michael 1911 conf->name = xstrdup(block_state.name.buf);
1762 adx 30
1763 michael 1646 conf->flags = block_state.flags.value;
1764     conf->port = block_state.port.value;
1765 adx 30
1766 michael 1646 conf_add_class_to_conf(conf, block_state.class.buf);
1767     add_conf_by_address(CONF_CLIENT, conf);
1768 adx 30 }
1769 michael 2916 };
1770 adx 30
1771     auth_items: auth_items auth_item | auth_item;
1772 michael 3439 auth_item: auth_user |
1773     auth_passwd |
1774     auth_class |
1775     auth_flags |
1776     auth_spoof |
1777 michael 3441 auth_redir_serv |
1778 michael 3439 auth_redir_port |
1779     auth_encrypted |
1780     error ';' ;
1781 adx 30
1782     auth_user: USER '=' QSTRING ';'
1783     {
1784 michael 967 if (conf_parser_ctx.pass == 2)
1785 michael 1646 dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list);
1786 adx 30 };
1787    
1788     auth_passwd: PASSWORD '=' QSTRING ';'
1789     {
1790 michael 967 if (conf_parser_ctx.pass == 2)
1791 michael 1647 strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf));
1792 adx 30 };
1793    
1794     auth_class: CLASS '=' QSTRING ';'
1795     {
1796 michael 967 if (conf_parser_ctx.pass == 2)
1797 michael 1646 strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf));
1798 adx 30 };
1799    
1800     auth_encrypted: ENCRYPTED '=' TBOOL ';'
1801     {
1802 michael 967 if (conf_parser_ctx.pass == 2)
1803 adx 30 {
1804     if (yylval.number)
1805 michael 1646 block_state.flags.value |= CONF_FLAGS_ENCRYPTED;
1806 adx 30 else
1807 michael 1646 block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED;
1808 adx 30 }
1809     };
1810    
1811     auth_flags: IRCD_FLAGS
1812     {
1813 michael 1646 if (conf_parser_ctx.pass == 2)
1814 michael 2093 block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP);
1815 adx 30 } '=' auth_flags_items ';';
1816    
1817     auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item;
1818 michael 1228 auth_flags_item: SPOOF_NOTICE
1819 adx 30 {
1820 michael 967 if (conf_parser_ctx.pass == 2)
1821 michael 1646 block_state.flags.value |= CONF_FLAGS_SPOOF_NOTICE;
1822 adx 30 } | EXCEED_LIMIT
1823     {
1824 michael 967 if (conf_parser_ctx.pass == 2)
1825 michael 1646 block_state.flags.value |= CONF_FLAGS_NOLIMIT;
1826 adx 30 } | KLINE_EXEMPT
1827     {
1828 michael 967 if (conf_parser_ctx.pass == 2)
1829 michael 1646 block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE;
1830 michael 5985 } | XLINE_EXEMPT
1831     {
1832     if (conf_parser_ctx.pass == 2)
1833     block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE;
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 michael 1072 general_ping_cookie |
2565 michael 2916 general_disable_auth |
2566 michael 3439 general_tkline_expire_notices |
2567 michael 5805 general_dline_min_cidr |
2568     general_dline_min_cidr6 |
2569     general_kline_min_cidr |
2570     general_kline_min_cidr6 |
2571 michael 3439 general_stats_e_disabled |
2572     general_max_watch |
2573     general_cycle_on_host_change |
2574     error;
2575 adx 30
2576    
2577 michael 4313 general_away_count: AWAY_COUNT '=' NUMBER ';'
2578     {
2579 michael 4340 ConfigGeneral.away_count = $3;
2580 michael 4313 };
2581    
2582     general_away_time: AWAY_TIME '=' timespec ';'
2583     {
2584 michael 4340 ConfigGeneral.away_time = $3;
2585 michael 4313 };
2586    
2587 michael 876 general_max_watch: MAX_WATCH '=' NUMBER ';'
2588     {
2589 michael 4340 ConfigGeneral.max_watch = $3;
2590 michael 876 };
2591 adx 30
2592 michael 2283 general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';'
2593     {
2594     if (conf_parser_ctx.pass == 2)
2595 michael 4340 ConfigGeneral.cycle_on_host_change = yylval.number;
2596 michael 2283 };
2597    
2598 michael 5805 general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';'
2599 michael 1459 {
2600 michael 5805 ConfigGeneral.dline_min_cidr = $3;
2601 michael 1459 };
2602    
2603 michael 5805 general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';'
2604 michael 1459 {
2605 michael 5805 ConfigGeneral.dline_min_cidr6 = $3;
2606 michael 1459 };
2607    
2608 michael 5805 general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';'
2609 michael 1459 {
2610 michael 5805 ConfigGeneral.kline_min_cidr = $3;
2611 michael 1459 };
2612    
2613 michael 5805 general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';'
2614 adx 30 {
2615 michael 5805 ConfigGeneral.kline_min_cidr6 = $3;
2616 adx 30 };
2617    
2618     general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';'
2619     {
2620 michael 4340 ConfigGeneral.tkline_expire_notices = yylval.number;
2621 adx 30 };
2622    
2623 michael 1074 general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';'
2624 adx 30 {
2625 michael 4340 ConfigGeneral.kill_chase_time_limit = $3;
2626 adx 30 };
2627    
2628     general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';'
2629     {
2630 michael 4340 ConfigGeneral.ignore_bogus_ts = yylval.number;
2631 adx 30 };
2632    
2633     general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';'
2634     {
2635 michael 4340 ConfigGeneral.failed_oper_notice = yylval.number;
2636 adx 30 };
2637    
2638     general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';'
2639     {
2640 michael 4340 ConfigGeneral.anti_nick_flood = yylval.number;
2641 adx 30 };
2642    
2643     general_max_nick_time: MAX_NICK_TIME '=' timespec ';'
2644     {
2645 michael 4340 ConfigGeneral.max_nick_time = $3;
2646 adx 30 };
2647    
2648     general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';'
2649     {
2650 michael 4340 ConfigGeneral.max_nick_changes = $3;
2651 adx 30 };
2652    
2653     general_max_accept: MAX_ACCEPT '=' NUMBER ';'
2654     {
2655 michael 4340 ConfigGeneral.max_accept = $3;
2656 adx 30 };
2657    
2658     general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';'
2659     {
2660 michael 4340 ConfigGeneral.anti_spam_exit_message_time = $3;
2661 adx 30 };
2662    
2663     general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';'
2664     {
2665 michael 4340 ConfigGeneral.ts_warn_delta = $3;
2666 adx 30 };
2667    
2668     general_ts_max_delta: TS_MAX_DELTA '=' timespec ';'
2669     {
2670 michael 967 if (conf_parser_ctx.pass == 2)
2671 michael 4340 ConfigGeneral.ts_max_delta = $3;
2672 adx 30 };
2673    
2674     general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';'
2675     {
2676 michael 4340 ConfigGeneral.invisible_on_connect = yylval.number;
2677 adx 30 };
2678    
2679 michael 3473 general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';'
2680 adx 30 {
2681 michael 4340 ConfigGeneral.warn_no_connect_block = yylval.number;
2682 adx 30 };
2683    
2684 michael 584 general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';'
2685     {
2686 michael 4340 ConfigGeneral.stats_e_disabled = yylval.number;
2687 michael 584 };
2688    
2689 michael 5025 general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';'
2690     {
2691     ConfigGeneral.stats_m_oper_only = yylval.number;
2692     };
2693    
2694 adx 30 general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';'
2695     {
2696 michael 4340 ConfigGeneral.stats_o_oper_only = yylval.number;
2697 adx 30 };
2698    
2699     general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';'
2700     {
2701 michael 4340 ConfigGeneral.stats_P_oper_only = yylval.number;
2702 adx 30 };
2703    
2704 michael 2269 general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';'
2705     {
2706 michael 4340 ConfigGeneral.stats_u_oper_only = yylval.number;
2707 michael 2269 };
2708    
2709 adx 30 general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';'
2710     {
2711 michael 4340 ConfigGeneral.stats_k_oper_only = 2 * yylval.number;
2712 adx 30 } | STATS_K_OPER_ONLY '=' TMASKED ';'
2713     {
2714 michael 4340 ConfigGeneral.stats_k_oper_only = 1;
2715 adx 30 };
2716    
2717     general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';'
2718     {
2719 michael 4340 ConfigGeneral.stats_i_oper_only = 2 * yylval.number;
2720 adx 30 } | STATS_I_OPER_ONLY '=' TMASKED ';'
2721     {
2722 michael 4340 ConfigGeneral.stats_i_oper_only = 1;
2723 adx 30 };
2724    
2725     general_pace_wait: PACE_WAIT '=' timespec ';'
2726     {
2727 michael 4340 ConfigGeneral.pace_wait = $3;
2728 adx 30 };
2729    
2730     general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';'
2731     {
2732 michael 4340 ConfigGeneral.caller_id_wait = $3;
2733 adx 30 };
2734    
2735     general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';'
2736     {
2737 michael 4340 ConfigGeneral.opers_bypass_callerid = yylval.number;
2738 adx 30 };
2739    
2740     general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';'
2741     {
2742 michael 4340 ConfigGeneral.pace_wait_simple = $3;
2743 adx 30 };
2744    
2745     general_short_motd: SHORT_MOTD '=' TBOOL ';'
2746     {
2747 michael 4340 ConfigGeneral.short_motd = yylval.number;
2748 adx 30 };
2749 michael 2916
2750 adx 30 general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';'
2751     {
2752 michael 4340 ConfigGeneral.no_oper_flood = yylval.number;
2753 adx 30 };
2754    
2755     general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';'
2756     {
2757 michael 4340 ConfigGeneral.oper_pass_resv = yylval.number;
2758 adx 30 };
2759    
2760     general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';'
2761     {
2762 michael 4340 ConfigGeneral.dots_in_ident = $3;
2763 adx 30 };
2764    
2765     general_max_targets: MAX_TARGETS '=' NUMBER ';'
2766     {
2767 michael 4340 ConfigGeneral.max_targets = $3;
2768 adx 30 };
2769    
2770     general_ping_cookie: PING_COOKIE '=' TBOOL ';'
2771     {
2772 michael 4340 ConfigGeneral.ping_cookie = yylval.number;
2773 adx 30 };
2774    
2775     general_disable_auth: DISABLE_AUTH '=' TBOOL ';'
2776     {
2777 michael 4340 ConfigGeneral.disable_auth = yylval.number;
2778 adx 30 };
2779    
2780 michael 3877 general_throttle_count: THROTTLE_COUNT '=' NUMBER ';'
2781     {
2782 michael 4340 ConfigGeneral.throttle_count = $3;
2783 michael 3877 };
2784    
2785 adx 30 general_throttle_time: THROTTLE_TIME '=' timespec ';'
2786     {
2787 michael 4340 ConfigGeneral.throttle_time = $3;
2788 adx 30 };
2789    
2790     general_oper_umodes: OPER_UMODES
2791     {
2792 michael 4340 ConfigGeneral.oper_umodes = 0;
2793 adx 30 } '=' umode_oitems ';' ;
2794    
2795     umode_oitems: umode_oitems ',' umode_oitem | umode_oitem;
2796     umode_oitem: T_BOTS
2797     {
2798 michael 4340 ConfigGeneral.oper_umodes |= UMODE_BOTS;
2799 adx 30 } | T_CCONN
2800     {
2801 michael 4340 ConfigGeneral.oper_umodes |= UMODE_CCONN;
2802 adx 30 } | T_DEAF
2803     {
2804 michael 4340 ConfigGeneral.oper_umodes |= UMODE_DEAF;
2805 adx 30 } | T_DEBUG
2806     {
2807 michael 4340 ConfigGeneral.oper_umodes |= UMODE_DEBUG;
2808 adx 30 } | T_FULL
2809     {
2810 michael 4340 ConfigGeneral.oper_umodes |= UMODE_FULL;
2811 michael 1294 } | HIDDEN
2812     {
2813 michael 4340 ConfigGeneral.oper_umodes |= UMODE_HIDDEN;
2814 michael 3513 } | HIDE_CHANS
2815     {
2816 michael 4340 ConfigGeneral.oper_umodes |= UMODE_HIDECHANS;
2817 michael 3506 } | HIDE_IDLE
2818     {
2819 michael 4340 ConfigGeneral.oper_umodes |= UMODE_HIDEIDLE;
2820 adx 30 } | T_SKILL
2821     {
2822 michael 4340 ConfigGeneral.oper_umodes |= UMODE_SKILL;
2823 adx 30 } | T_NCHANGE
2824     {
2825 michael 4340 ConfigGeneral.oper_umodes |= UMODE_NCHANGE;
2826 adx 30 } | T_REJ
2827     {
2828 michael 4340 ConfigGeneral.oper_umodes |= UMODE_REJ;
2829 adx 30 } | T_UNAUTH
2830     {
2831 michael 4340 ConfigGeneral.oper_umodes |= UMODE_UNAUTH;
2832 adx 30 } | T_SPY
2833     {
2834 michael 4340 ConfigGeneral.oper_umodes |= UMODE_SPY;
2835 adx 30 } | T_EXTERNAL
2836     {
2837 michael 4340 ConfigGeneral.oper_umodes |= UMODE_EXTERNAL;
2838 adx 30 } | T_SERVNOTICE
2839     {
2840 michael 4340 ConfigGeneral.oper_umodes |= UMODE_SERVNOTICE;
2841 adx 30 } | T_INVISIBLE
2842     {
2843 michael 4340 ConfigGeneral.oper_umodes |= UMODE_INVISIBLE;
2844 adx 30 } | T_WALLOP
2845     {
2846 michael 4340 ConfigGeneral.oper_umodes |= UMODE_WALLOP;
2847 adx 30 } | T_SOFTCALLERID
2848     {
2849 michael 4340 ConfigGeneral.oper_umodes |= UMODE_SOFTCALLERID;
2850 adx 30 } | T_CALLERID
2851     {
2852 michael 4340 ConfigGeneral.oper_umodes |= UMODE_CALLERID;
2853 adx 30 } | T_LOCOPS
2854     {
2855 michael 4340 ConfigGeneral.oper_umodes |= UMODE_LOCOPS;
2856 michael 1979 } | T_NONONREG
2857     {
2858 michael 4340 ConfigGeneral.oper_umodes |= UMODE_REGONLY;
2859 michael 1976 } | T_FARCONNECT
2860     {
2861 michael 4340 ConfigGeneral.oper_umodes |= UMODE_FARCONNECT;
2862 adx 30 };
2863    
2864 michael 2916 general_oper_only_umodes: OPER_ONLY_UMODES
2865 adx 30 {
2866 michael 4340 ConfigGeneral.oper_only_umodes = 0;
2867 adx 30 } '=' umode_items ';' ;
2868    
2869 michael 3439 umode_items: umode_items ',' umode_item | umode_item;
2870     umode_item: T_BOTS
2871 adx 30 {
2872 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_BOTS;
2873 adx 30 } | T_CCONN
2874     {
2875 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_CCONN;
2876 adx 30 } | T_DEAF
2877     {
2878 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_DEAF;
2879 adx 30 } | T_DEBUG
2880     {
2881 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_DEBUG;
2882 adx 30 } | T_FULL
2883 michael 2916 {
2884 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_FULL;
2885 adx 30 } | T_SKILL
2886     {
2887 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_SKILL;
2888 michael 1294 } | HIDDEN
2889     {
2890 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_HIDDEN;
2891 adx 30 } | T_NCHANGE
2892     {
2893 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_NCHANGE;
2894 adx 30 } | T_REJ
2895     {
2896 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_REJ;
2897 adx 30 } | T_UNAUTH
2898     {
2899 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH;
2900 adx 30 } | T_SPY
2901     {
2902 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_SPY;
2903 adx 30 } | T_EXTERNAL
2904     {
2905 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_EXTERNAL;
2906 adx 30 } | T_SERVNOTICE
2907     {
2908 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_SERVNOTICE;
2909 adx 30 } | T_INVISIBLE
2910     {
2911 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_INVISIBLE;
2912 adx 30 } | T_WALLOP
2913     {
2914 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_WALLOP;
2915 adx 30 } | T_SOFTCALLERID
2916     {
2917 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_SOFTCALLERID;
2918 adx 30 } | T_CALLERID
2919     {
2920 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_CALLERID;
2921 adx 30 } | T_LOCOPS
2922     {
2923 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_LOCOPS;
2924 michael 1855 } | T_NONONREG
2925     {
2926 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_REGONLY;
2927 michael 1976 } | T_FARCONNECT
2928     {
2929 michael 4340 ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT;
2930 adx 30 };
2931    
2932     general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
2933     {
2934 michael 4340 ConfigGeneral.min_nonwildcard = $3;
2935 adx 30 };
2936    
2937     general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';'
2938     {
2939 michael 4340 ConfigGeneral.min_nonwildcard_simple = $3;
2940 adx 30 };
2941    
2942     general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';'
2943     {
2944 michael 4340 ConfigGeneral.default_floodcount = $3;
2945 adx 30 };
2946    
2947    
2948     /***************************************************************************
2949     * section channel
2950     ***************************************************************************/
2951     channel_entry: CHANNEL
2952     '{' channel_items '}' ';';
2953    
2954     channel_items: channel_items channel_item | channel_item;
2955 michael 1495 channel_item: channel_max_bans |
2956 michael 3860 channel_invite_client_count |
2957     channel_invite_client_time |
2958     channel_knock_client_count |
2959     channel_knock_client_time |
2960 michael 3439 channel_knock_delay_channel |
2961 michael 3933 channel_max_channels |
2962 michael 1946 channel_default_split_user_count |
2963 adx 201 channel_default_split_server_count |
2964 michael 1858 channel_no_create_on_split |
2965 michael 1401 channel_no_join_on_split |
2966 michael 5489 channel_default_join_flood_count |
2967     channel_default_join_flood_time |
2968 michael 3439 channel_disable_fake_channels |
2969     error;
2970 adx 30
2971 michael 632 channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';'
2972     {
2973     ConfigChannel.disable_fake_channels = yylval.number;
2974     };
2975    
2976 michael 3860 channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';'
2977 adx 30 {
2978 michael 3860 ConfigChannel.invite_client_count = $3;
2979 adx 30 };
2980    
2981 michael 3860 channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';'
2982 adx 30 {
2983 michael 3860 ConfigChannel.invite_client_time = $3;
2984 adx 30 };
2985    
2986 michael 3860 channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';'
2987 michael 3762 {
2988 michael 3860 ConfigChannel.knock_client_count = $3;
2989 michael 3762 };
2990    
2991 michael 3860 channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';'
2992 michael 3762 {
2993 michael 3860 ConfigChannel.knock_client_time = $3;
2994 michael 3762 };
2995    
2996 michael 3860 channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';'
2997     {
2998     ConfigChannel.knock_delay_channel = $3;
2999     };
3000    
3001 michael 3933 channel_max_channels: MAX_CHANNELS '=' NUMBER ';'
3002 adx 30 {
3003 michael 3933 ConfigChannel.max_channels = $3;
3004 adx 30 };
3005    
3006     channel_max_bans: MAX_BANS '=' NUMBER ';'
3007     {
3008     ConfigChannel.max_bans = $3;
3009     };
3010    
3011     channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';'
3012     {
3013     ConfigChannel.default_split_user_count = $3;
3014     };
3015    
3016     channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';'
3017     {
3018     ConfigChannel.default_split_server_count = $3;
3019     };
3020    
3021     channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';'
3022     {
3023     ConfigChannel.no_create_on_split = yylval.number;
3024     };
3025    
3026     channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';'
3027     {
3028     ConfigChannel.no_join_on_split = yylval.number;
3029     };
3030    
3031 michael 5489 channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';'
3032 adx 30 {
3033 michael 5489 ConfigChannel.default_join_flood_count = yylval.number;
3034 adx 30 };
3035    
3036 michael 5489 channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';'
3037 adx 30 {
3038 michael 5489 ConfigChannel.default_join_flood_time = $3;
3039 adx 30 };
3040    
3041     /***************************************************************************
3042     * section serverhide
3043     ***************************************************************************/
3044     serverhide_entry: SERVERHIDE
3045     '{' serverhide_items '}' ';';
3046    
3047     serverhide_items: serverhide_items serverhide_item | serverhide_item;
3048 michael 3439 serverhide_item: serverhide_flatten_links |
3049     serverhide_disable_remote_commands |
3050 michael 2196 serverhide_hide_servers |
3051 michael 3439 serverhide_hide_services |
3052     serverhide_links_delay |
3053     serverhide_hidden |
3054     serverhide_hidden_name |
3055     serverhide_hide_server_ips |
3056 adx 30 error;
3057    
3058     serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';'
3059     {
3060 michael 967 if (conf_parser_ctx.pass == 2)
3061 adx 30 ConfigServerHide.flatten_links = yylval.number;
3062     };
3063    
3064 michael 2196 serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';'
3065     {
3066     if (conf_parser_ctx.pass == 2)
3067     ConfigServerHide.disable_remote_commands = yylval.number;
3068     };
3069    
3070 adx 30 serverhide_hide_servers: HIDE_SERVERS '=' TBOOL ';'
3071     {
3072 michael 967 if (conf_parser_ctx.pass == 2)
3073 adx 30 ConfigServerHide.hide_servers = yylval.number;
3074     };
3075    
3076 michael 1851 serverhide_hide_services: HIDE_SERVICES '=' TBOOL ';'
3077     {
3078     if (conf_parser_ctx.pass == 2)
3079     ConfigServerHide.hide_services = yylval.number;
3080     };
3081    
3082 adx 30 serverhide_hidden_name: HIDDEN_NAME '=' QSTRING ';'
3083     {
3084 michael 967 if (conf_parser_ctx.pass == 2)
3085 adx 30 {
3086     MyFree(ConfigServerHide.hidden_name);
3087 michael 1646 ConfigServerHide.hidden_name = xstrdup(yylval.string);
3088 adx 30 }
3089     };
3090    
3091     serverhide_links_delay: LINKS_DELAY '=' timespec ';'
3092     {
3093 michael 967 if (conf_parser_ctx.pass == 2)
3094 adx 30 {
3095     if (($3 > 0) && ConfigServerHide.links_disabled == 1)
3096     {
3097 michael 4094 event_write_links_file.when = $3;
3098     event_addish(&event_write_links_file, NULL);
3099 adx 30 ConfigServerHide.links_disabled = 0;
3100     }
3101    
3102     ConfigServerHide.links_delay = $3;
3103     }
3104     };
3105    
3106     serverhide_hidden: HIDDEN '=' TBOOL ';'
3107     {
3108 michael 967 if (conf_parser_ctx.pass == 2)
3109 adx 30 ConfigServerHide.hidden = yylval.number;
3110     };
3111    
3112     serverhide_hide_server_ips: HIDE_SERVER_IPS '=' TBOOL ';'
3113     {
3114 michael 967 if (conf_parser_ctx.pass == 2)
3115 adx 30 ConfigServerHide.hide_server_ips = yylval.number;
3116     };

Properties

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