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