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