| 1 |
|
/* |
| 2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (c) 2000-2018 ircd-hybrid development team |
| 4 |
> |
* Copyright (c) 2000-2021 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 |
| 31 |
|
#include "stdinc.h" |
| 32 |
|
#include "ircd.h" |
| 33 |
|
#include "list.h" |
| 34 |
+ |
#include "parse.h" |
| 35 |
|
#include "conf.h" |
| 36 |
|
#include "conf_class.h" |
| 37 |
|
#include "conf_cluster.h" |
| 91 |
|
size, |
| 92 |
|
type, |
| 93 |
|
port, |
| 94 |
+ |
timeout, |
| 95 |
|
aftype, |
| 96 |
|
ping_freq, |
| 97 |
< |
max_perip, |
| 97 |
> |
max_perip_local, |
| 98 |
> |
max_perip_global, |
| 99 |
|
con_freq, |
| 100 |
|
min_idle, |
| 101 |
|
max_idle, |
| 102 |
|
max_total, |
| 100 |
– |
max_global, |
| 101 |
– |
max_local, |
| 103 |
|
max_sendq, |
| 104 |
|
max_recvq, |
| 105 |
|
max_channels, |
| 111 |
|
static void |
| 112 |
|
reset_block_state(void) |
| 113 |
|
{ |
| 114 |
< |
dlink_node *node = NULL, *node_next = NULL; |
| 114 |
> |
dlink_node *node, *node_next; |
| 115 |
> |
dlink_list *tab[] = { &block_state.mask.list, |
| 116 |
> |
&block_state.leaf.list, &block_state.hub.list, NULL }; |
| 117 |
|
|
| 118 |
< |
DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head) |
| 118 |
> |
for (dlink_list **list = tab; *list; ++list) |
| 119 |
|
{ |
| 120 |
< |
xfree(node->data); |
| 121 |
< |
dlinkDelete(node, &block_state.mask.list); |
| 122 |
< |
free_dlink_node(node); |
| 123 |
< |
} |
| 124 |
< |
|
| 125 |
< |
DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head) |
| 123 |
< |
{ |
| 124 |
< |
xfree(node->data); |
| 125 |
< |
dlinkDelete(node, &block_state.leaf.list); |
| 126 |
< |
free_dlink_node(node); |
| 127 |
< |
} |
| 128 |
< |
|
| 129 |
< |
DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head) |
| 130 |
< |
{ |
| 131 |
< |
xfree(node->data); |
| 132 |
< |
dlinkDelete(node, &block_state.hub.list); |
| 133 |
< |
free_dlink_node(node); |
| 120 |
> |
DLINK_FOREACH_SAFE(node, node_next, (*list)->head) |
| 121 |
> |
{ |
| 122 |
> |
xfree(node->data); |
| 123 |
> |
dlinkDelete(node, *list); |
| 124 |
> |
free_dlink_node(node); |
| 125 |
> |
} |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
memset(&block_state, 0, sizeof(block_state)); |
| 143 |
|
%token AUTOCONN |
| 144 |
|
%token AWAY_COUNT |
| 145 |
|
%token AWAY_TIME |
| 146 |
+ |
%token BOT |
| 147 |
|
%token BYTES KBYTES MBYTES |
| 148 |
|
%token CALLER_ID_WAIT |
| 149 |
|
%token CAN_FLOOD |
| 151 |
|
%token CIDR_BITLEN_IPV4 |
| 152 |
|
%token CIDR_BITLEN_IPV6 |
| 153 |
|
%token CLASS |
| 154 |
+ |
%token CLIENT |
| 155 |
|
%token CLOSE |
| 156 |
|
%token CONNECT |
| 157 |
|
%token CONNECTFREQ |
| 161 |
|
%token DEFAULT_JOIN_FLOOD_COUNT |
| 162 |
|
%token DEFAULT_JOIN_FLOOD_TIME |
| 163 |
|
%token DEFAULT_MAX_CLIENTS |
| 164 |
+ |
%token DEFER |
| 165 |
|
%token DENY |
| 166 |
|
%token DESCRIPTION |
| 167 |
|
%token DIE |
| 172 |
|
%token DLINE_MIN_CIDR6 |
| 173 |
|
%token DOTS_IN_IDENT |
| 174 |
|
%token EMAIL |
| 175 |
+ |
%token ENABLE_EXTBANS |
| 176 |
|
%token ENCRYPTED |
| 177 |
|
%token EXCEED_LIMIT |
| 178 |
|
%token EXEMPT |
| 179 |
+ |
%token EXPIRATION |
| 180 |
|
%token FAILED_OPER_NOTICE |
| 181 |
|
%token FLATTEN_LINKS |
| 182 |
|
%token FLATTEN_LINKS_DELAY |
| 194 |
|
%token HOST |
| 195 |
|
%token HUB |
| 196 |
|
%token HUB_MASK |
| 200 |
– |
%token IGNORE_BOGUS_TS |
| 197 |
|
%token INVISIBLE_ON_CONNECT |
| 198 |
|
%token INVITE_CLIENT_COUNT |
| 199 |
|
%token INVITE_CLIENT_TIME |
| 220 |
|
%token MAX_BANS |
| 221 |
|
%token MAX_BANS_LARGE |
| 222 |
|
%token MAX_CHANNELS |
| 227 |
– |
%token MAX_GLOBAL |
| 223 |
|
%token MAX_IDLE |
| 224 |
|
%token MAX_INVITES |
| 225 |
< |
%token MAX_LOCAL |
| 225 |
> |
%token MAX_MONITOR |
| 226 |
|
%token MAX_NICK_CHANGES |
| 227 |
|
%token MAX_NICK_LENGTH |
| 228 |
|
%token MAX_NICK_TIME |
| 229 |
|
%token MAX_NUMBER |
| 230 |
|
%token MAX_TARGETS |
| 231 |
|
%token MAX_TOPIC_LENGTH |
| 237 |
– |
%token MAX_WATCH |
| 232 |
|
%token MIN_IDLE |
| 233 |
|
%token MIN_NONWILDCARD |
| 234 |
|
%token MIN_NONWILDCARD_SIMPLE |
| 238 |
|
%token NAME |
| 239 |
|
%token NEED_IDENT |
| 240 |
|
%token NEED_PASSWORD |
| 241 |
< |
%token NETWORK_DESC |
| 241 |
> |
%token NETWORK_DESCRIPTION |
| 242 |
|
%token NETWORK_NAME |
| 243 |
|
%token NICK |
| 244 |
|
%token NO_OPER_FLOOD |
| 245 |
|
%token NO_TILDE |
| 252 |
– |
%token NUMBER |
| 246 |
|
%token NUMBER_PER_CIDR |
| 247 |
< |
%token NUMBER_PER_IP |
| 247 |
> |
%token NUMBER_PER_IP_GLOBAL |
| 248 |
> |
%token NUMBER_PER_IP_LOCAL |
| 249 |
|
%token OPER_ONLY_UMODES |
| 250 |
|
%token OPER_UMODES |
| 251 |
|
%token OPERATOR |
| 257 |
|
%token PING_COOKIE |
| 258 |
|
%token PING_TIME |
| 259 |
|
%token PORT |
| 266 |
– |
%token QSTRING |
| 260 |
|
%token RANDOM_IDLE |
| 261 |
|
%token REASON |
| 262 |
|
%token REDIRPORT |
| 274 |
|
%token SERVERINFO |
| 275 |
|
%token SHORT_MOTD |
| 276 |
|
%token SPOOF |
| 284 |
– |
%token SPOOF_NOTICE |
| 277 |
|
%token SQUIT |
| 286 |
– |
%token SSL_CERTIFICATE_FILE |
| 287 |
– |
%token SSL_CERTIFICATE_FINGERPRINT |
| 288 |
– |
%token SSL_CONNECTION_REQUIRED |
| 289 |
– |
%token SSL_DH_ELLIPTIC_CURVE |
| 290 |
– |
%token SSL_DH_PARAM_FILE |
| 291 |
– |
%token SSL_MESSAGE_DIGEST_ALGORITHM |
| 278 |
|
%token STATS_E_DISABLED |
| 279 |
|
%token STATS_I_OPER_ONLY |
| 280 |
|
%token STATS_K_OPER_ONLY |
| 283 |
|
%token STATS_P_OPER_ONLY |
| 284 |
|
%token STATS_U_OPER_ONLY |
| 285 |
|
%token T_ALL |
| 286 |
< |
%token T_BOTS |
| 286 |
> |
%token T_BIND |
| 287 |
|
%token T_CALLERID |
| 288 |
|
%token T_CCONN |
| 289 |
|
%token T_COMMAND |
| 294 |
|
%token T_EXTERNAL |
| 295 |
|
%token T_FARCONNECT |
| 296 |
|
%token T_FILE |
| 297 |
< |
%token T_FULL |
| 297 |
> |
%token T_FLOOD |
| 298 |
|
%token T_GLOBOPS |
| 299 |
|
%token T_INVISIBLE |
| 300 |
|
%token T_IPV4 |
| 318 |
|
%token T_SKILL |
| 319 |
|
%token T_SOFTCALLERID |
| 320 |
|
%token T_SPY |
| 335 |
– |
%token T_SSL |
| 336 |
– |
%token T_SSL_CIPHER_LIST |
| 321 |
|
%token T_TARGET |
| 322 |
+ |
%token T_TLS |
| 323 |
|
%token T_UMODES |
| 339 |
– |
%token T_UNAUTH |
| 324 |
|
%token T_UNDLINE |
| 325 |
|
%token T_UNLIMITED |
| 326 |
|
%token T_UNRESV |
| 331 |
|
%token TBOOL |
| 332 |
|
%token THROTTLE_COUNT |
| 333 |
|
%token THROTTLE_TIME |
| 334 |
< |
%token TKLINE_EXPIRE_NOTICES |
| 335 |
< |
%token TMASKED |
| 334 |
> |
%token TIMEOUT |
| 335 |
> |
%token TLS_CERTIFICATE_FILE |
| 336 |
> |
%token TLS_CERTIFICATE_FINGERPRINT |
| 337 |
> |
%token TLS_CIPHER_LIST |
| 338 |
> |
%token TLS_CIPHER_SUITES |
| 339 |
> |
%token TLS_CONNECTION_REQUIRED |
| 340 |
> |
%token TLS_DH_PARAM_FILE |
| 341 |
> |
%token TLS_MESSAGE_DIGEST_ALGORITHM |
| 342 |
> |
%token TLS_SUPPORTED_GROUPS |
| 343 |
|
%token TS_MAX_DELTA |
| 344 |
|
%token TS_WARN_DELTA |
| 345 |
|
%token TWODOTS |
| 355 |
|
%token XLINE |
| 356 |
|
%token XLINE_EXEMPT |
| 357 |
|
|
| 358 |
< |
%type <string> QSTRING |
| 359 |
< |
%type <number> NUMBER |
| 358 |
> |
%token <string> QSTRING |
| 359 |
> |
%token <number> NUMBER |
| 360 |
|
%type <number> timespec |
| 361 |
|
%type <number> timespec_ |
| 362 |
|
%type <number> sizespec |
| 435 |
|
|
| 436 |
|
|
| 437 |
|
/*************************************************************************** |
| 438 |
< |
* serverinfo {} section |
| 438 |
> |
* serverinfo {} section |
| 439 |
|
***************************************************************************/ |
| 440 |
|
serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';'; |
| 441 |
|
|
| 442 |
|
serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ; |
| 443 |
|
serverinfo_item: serverinfo_name | |
| 453 |
– |
serverinfo_vhost | |
| 444 |
|
serverinfo_hub | |
| 445 |
|
serverinfo_description | |
| 446 |
|
serverinfo_network_name | |
| 447 |
< |
serverinfo_network_desc | |
| 447 |
> |
serverinfo_network_description | |
| 448 |
|
serverinfo_default_max_clients | |
| 449 |
|
serverinfo_max_nick_length | |
| 450 |
|
serverinfo_max_topic_length | |
| 451 |
< |
serverinfo_ssl_dh_param_file | |
| 452 |
< |
serverinfo_ssl_dh_elliptic_curve | |
| 451 |
> |
serverinfo_tls_dh_param_file | |
| 452 |
> |
serverinfo_tls_supported_groups | |
| 453 |
|
serverinfo_rsa_private_key_file | |
| 464 |
– |
serverinfo_vhost6 | |
| 454 |
|
serverinfo_sid | |
| 455 |
< |
serverinfo_ssl_certificate_file | |
| 456 |
< |
serverinfo_ssl_cipher_list | |
| 457 |
< |
serverinfo_ssl_message_digest_algorithm | |
| 455 |
> |
serverinfo_tls_certificate_file | |
| 456 |
> |
serverinfo_tls_cipher_list | |
| 457 |
> |
serverinfo_tls_cipher_suites | |
| 458 |
> |
serverinfo_tls_message_digest_algorithm | |
| 459 |
|
error ';' ; |
| 460 |
|
|
| 461 |
|
|
| 462 |
< |
serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';' |
| 462 |
> |
serverinfo_tls_certificate_file: TLS_CERTIFICATE_FILE '=' QSTRING ';' |
| 463 |
|
{ |
| 464 |
|
if (conf_parser_ctx.pass == 2) |
| 465 |
|
{ |
| 466 |
< |
xfree(ConfigServerInfo.ssl_certificate_file); |
| 467 |
< |
ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string); |
| 466 |
> |
xfree(ConfigServerInfo.tls_certificate_file); |
| 467 |
> |
ConfigServerInfo.tls_certificate_file = xstrdup(yylval.string); |
| 468 |
|
} |
| 469 |
|
}; |
| 470 |
|
|
| 477 |
|
} |
| 478 |
|
}; |
| 479 |
|
|
| 480 |
< |
serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';' |
| 480 |
> |
serverinfo_tls_dh_param_file: TLS_DH_PARAM_FILE '=' QSTRING ';' |
| 481 |
|
{ |
| 482 |
|
if (conf_parser_ctx.pass == 2) |
| 483 |
|
{ |
| 484 |
< |
xfree(ConfigServerInfo.ssl_dh_param_file); |
| 485 |
< |
ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string); |
| 484 |
> |
xfree(ConfigServerInfo.tls_dh_param_file); |
| 485 |
> |
ConfigServerInfo.tls_dh_param_file = xstrdup(yylval.string); |
| 486 |
|
} |
| 487 |
|
}; |
| 488 |
|
|
| 489 |
< |
serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';' |
| 489 |
> |
serverinfo_tls_cipher_list: TLS_CIPHER_LIST '=' QSTRING ';' |
| 490 |
|
{ |
| 491 |
|
if (conf_parser_ctx.pass == 2) |
| 492 |
|
{ |
| 493 |
< |
xfree(ConfigServerInfo.ssl_cipher_list); |
| 494 |
< |
ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string); |
| 493 |
> |
xfree(ConfigServerInfo.tls_cipher_list); |
| 494 |
> |
ConfigServerInfo.tls_cipher_list = xstrdup(yylval.string); |
| 495 |
|
} |
| 496 |
|
}; |
| 497 |
|
|
| 498 |
< |
serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';' |
| 498 |
> |
serverinfo_tls_cipher_suites: TLS_CIPHER_SUITES '=' QSTRING ';' |
| 499 |
|
{ |
| 500 |
|
if (conf_parser_ctx.pass == 2) |
| 501 |
|
{ |
| 502 |
< |
xfree(ConfigServerInfo.ssl_message_digest_algorithm); |
| 503 |
< |
ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string); |
| 502 |
> |
xfree(ConfigServerInfo.tls_cipher_suites); |
| 503 |
> |
ConfigServerInfo.tls_cipher_suites = xstrdup(yylval.string); |
| 504 |
> |
} |
| 505 |
> |
}; |
| 506 |
> |
|
| 507 |
> |
serverinfo_tls_message_digest_algorithm: TLS_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';' |
| 508 |
> |
{ |
| 509 |
> |
if (conf_parser_ctx.pass == 2) |
| 510 |
> |
{ |
| 511 |
> |
xfree(ConfigServerInfo.tls_message_digest_algorithm); |
| 512 |
> |
ConfigServerInfo.tls_message_digest_algorithm = xstrdup(yylval.string); |
| 513 |
|
} |
| 514 |
|
} |
| 515 |
|
|
| 516 |
< |
serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';' |
| 516 |
> |
serverinfo_tls_supported_groups: TLS_SUPPORTED_GROUPS '=' QSTRING ';' |
| 517 |
|
{ |
| 518 |
|
if (conf_parser_ctx.pass == 2) |
| 519 |
|
{ |
| 520 |
< |
xfree(ConfigServerInfo.ssl_dh_elliptic_curve); |
| 521 |
< |
ConfigServerInfo.ssl_dh_elliptic_curve = xstrdup(yylval.string); |
| 520 |
> |
xfree(ConfigServerInfo.tls_supported_groups); |
| 521 |
> |
ConfigServerInfo.tls_supported_groups = xstrdup(yylval.string); |
| 522 |
|
} |
| 523 |
|
}; |
| 524 |
|
|
| 525 |
|
serverinfo_name: NAME '=' QSTRING ';' |
| 526 |
|
{ |
| 527 |
|
/* This isn't rehashable */ |
| 528 |
< |
if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name) |
| 528 |
> |
if (conf_parser_ctx.pass == 2 && ConfigServerInfo.name == NULL) |
| 529 |
|
{ |
| 530 |
< |
if (valid_servname(yylval.string)) |
| 530 |
> |
if (server_valid_name(yylval.string) == true) |
| 531 |
|
ConfigServerInfo.name = xstrdup(yylval.string); |
| 532 |
|
else |
| 533 |
|
{ |
| 540 |
|
serverinfo_sid: IRCD_SID '=' QSTRING ';' |
| 541 |
|
{ |
| 542 |
|
/* This isn't rehashable */ |
| 543 |
< |
if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid) |
| 543 |
> |
if (conf_parser_ctx.pass == 2 && ConfigServerInfo.sid == NULL) |
| 544 |
|
{ |
| 545 |
|
if (valid_sid(yylval.string)) |
| 546 |
|
ConfigServerInfo.sid = xstrdup(yylval.string); |
| 566 |
|
{ |
| 567 |
|
if (conf_parser_ctx.pass == 2) |
| 568 |
|
{ |
| 569 |
< |
char *p; |
| 569 |
> |
char *p = strchr(yylval.string, ' '); |
| 570 |
|
|
| 571 |
< |
if ((p = strchr(yylval.string, ' '))) |
| 571 |
> |
if (p) |
| 572 |
|
*p = '\0'; |
| 573 |
|
|
| 574 |
|
xfree(ConfigServerInfo.network_name); |
| 576 |
|
} |
| 577 |
|
}; |
| 578 |
|
|
| 579 |
< |
serverinfo_network_desc: NETWORK_DESC '=' QSTRING ';' |
| 579 |
> |
serverinfo_network_description: NETWORK_DESCRIPTION '=' QSTRING ';' |
| 580 |
|
{ |
| 581 |
|
if (conf_parser_ctx.pass != 2) |
| 582 |
|
break; |
| 583 |
|
|
| 584 |
< |
xfree(ConfigServerInfo.network_desc); |
| 585 |
< |
ConfigServerInfo.network_desc = xstrdup(yylval.string); |
| 587 |
< |
}; |
| 588 |
< |
|
| 589 |
< |
serverinfo_vhost: VHOST '=' QSTRING ';' |
| 590 |
< |
{ |
| 591 |
< |
if (conf_parser_ctx.pass == 2 && *yylval.string != '*') |
| 592 |
< |
{ |
| 593 |
< |
struct addrinfo hints, *res; |
| 594 |
< |
|
| 595 |
< |
memset(&hints, 0, sizeof(hints)); |
| 596 |
< |
|
| 597 |
< |
hints.ai_family = AF_UNSPEC; |
| 598 |
< |
hints.ai_socktype = SOCK_STREAM; |
| 599 |
< |
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
| 600 |
< |
|
| 601 |
< |
if (getaddrinfo(yylval.string, NULL, &hints, &res)) |
| 602 |
< |
ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string); |
| 603 |
< |
else |
| 604 |
< |
{ |
| 605 |
< |
assert(res); |
| 606 |
< |
|
| 607 |
< |
memcpy(&ConfigServerInfo.ip, res->ai_addr, res->ai_addrlen); |
| 608 |
< |
ConfigServerInfo.ip.ss.ss_family = res->ai_family; |
| 609 |
< |
ConfigServerInfo.ip.ss_len = res->ai_addrlen; |
| 610 |
< |
freeaddrinfo(res); |
| 611 |
< |
|
| 612 |
< |
ConfigServerInfo.specific_ipv4_vhost = 1; |
| 613 |
< |
} |
| 614 |
< |
} |
| 615 |
< |
}; |
| 616 |
< |
|
| 617 |
< |
serverinfo_vhost6: VHOST6 '=' QSTRING ';' |
| 618 |
< |
{ |
| 619 |
< |
if (conf_parser_ctx.pass == 2 && *yylval.string != '*') |
| 620 |
< |
{ |
| 621 |
< |
struct addrinfo hints, *res; |
| 622 |
< |
|
| 623 |
< |
memset(&hints, 0, sizeof(hints)); |
| 624 |
< |
|
| 625 |
< |
hints.ai_family = AF_UNSPEC; |
| 626 |
< |
hints.ai_socktype = SOCK_STREAM; |
| 627 |
< |
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
| 628 |
< |
|
| 629 |
< |
if (getaddrinfo(yylval.string, NULL, &hints, &res)) |
| 630 |
< |
ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string); |
| 631 |
< |
else |
| 632 |
< |
{ |
| 633 |
< |
assert(res); |
| 634 |
< |
|
| 635 |
< |
memcpy(&ConfigServerInfo.ip6, res->ai_addr, res->ai_addrlen); |
| 636 |
< |
ConfigServerInfo.ip6.ss.ss_family = res->ai_family; |
| 637 |
< |
ConfigServerInfo.ip6.ss_len = res->ai_addrlen; |
| 638 |
< |
freeaddrinfo(res); |
| 639 |
< |
|
| 640 |
< |
ConfigServerInfo.specific_ipv6_vhost = 1; |
| 641 |
< |
} |
| 642 |
< |
} |
| 584 |
> |
xfree(ConfigServerInfo.network_description); |
| 585 |
> |
ConfigServerInfo.network_description = xstrdup(yylval.string); |
| 586 |
|
}; |
| 587 |
|
|
| 588 |
|
serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';' |
| 590 |
|
if (conf_parser_ctx.pass != 2) |
| 591 |
|
break; |
| 592 |
|
|
| 593 |
< |
if ($3 < MAXCLIENTS_MIN) |
| 593 |
> |
if ($3 < 1) |
| 594 |
|
{ |
| 595 |
< |
char buf[IRCD_BUFSIZE] = ""; |
| 596 |
< |
|
| 654 |
< |
snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN); |
| 655 |
< |
conf_error_report(buf); |
| 656 |
< |
ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN; |
| 595 |
> |
conf_error_report("default_max_clients too low, setting to 1"); |
| 596 |
> |
ConfigServerInfo.default_max_clients = 1; |
| 597 |
|
} |
| 598 |
|
else if ($3 > MAXCLIENTS_MAX) |
| 599 |
|
{ |
| 600 |
< |
char buf[IRCD_BUFSIZE] = ""; |
| 600 |
> |
char buf[IRCD_BUFSIZE]; |
| 601 |
|
|
| 602 |
< |
snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX); |
| 602 |
> |
snprintf(buf, sizeof(buf), "default_max_clients too high, setting to %d", MAXCLIENTS_MAX); |
| 603 |
|
conf_error_report(buf); |
| 604 |
+ |
|
| 605 |
|
ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX; |
| 606 |
|
} |
| 607 |
|
else |
| 620 |
|
} |
| 621 |
|
else if ($3 > NICKLEN) |
| 622 |
|
{ |
| 623 |
< |
char buf[IRCD_BUFSIZE] = ""; |
| 623 |
> |
char buf[IRCD_BUFSIZE]; |
| 624 |
|
|
| 625 |
|
snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN); |
| 626 |
|
conf_error_report(buf); |
| 627 |
+ |
|
| 628 |
|
ConfigServerInfo.max_nick_length = NICKLEN; |
| 629 |
|
} |
| 630 |
|
else |
| 643 |
|
} |
| 644 |
|
else if ($3 > TOPICLEN) |
| 645 |
|
{ |
| 646 |
< |
char buf[IRCD_BUFSIZE] = ""; |
| 646 |
> |
char buf[IRCD_BUFSIZE]; |
| 647 |
|
|
| 648 |
|
snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN); |
| 649 |
|
conf_error_report(buf); |
| 650 |
+ |
|
| 651 |
|
ConfigServerInfo.max_topic_length = TOPICLEN; |
| 652 |
|
} |
| 653 |
|
else |
| 664 |
|
/*************************************************************************** |
| 665 |
|
* admin {} section |
| 666 |
|
***************************************************************************/ |
| 667 |
< |
admin_entry: ADMIN '{' admin_items '}' ';' ; |
| 667 |
> |
admin_entry: ADMIN '{' admin_items '}' ';' ; |
| 668 |
|
|
| 669 |
|
admin_items: admin_items admin_item | admin_item; |
| 670 |
|
admin_item: admin_name | |
| 709 |
|
reset_block_state(); |
| 710 |
|
} '{' motd_items '}' ';' |
| 711 |
|
{ |
| 712 |
< |
dlink_node *node = NULL; |
| 712 |
> |
dlink_node *node; |
| 713 |
|
|
| 714 |
|
if (conf_parser_ctx.pass != 2) |
| 715 |
|
break; |
| 802 |
|
/*************************************************************************** |
| 803 |
|
* log {} section |
| 804 |
|
***************************************************************************/ |
| 805 |
< |
logging_entry: T_LOG '{' logging_items '}' ';' ; |
| 805 |
> |
logging_entry: T_LOG '{' logging_items '}' ';' ; |
| 806 |
|
logging_items: logging_items logging_item | logging_item ; |
| 807 |
|
|
| 808 |
|
logging_item: logging_use_logging | logging_file_entry | |
| 854 |
|
{ |
| 855 |
|
if (conf_parser_ctx.pass == 2) |
| 856 |
|
block_state.type.value = 0; |
| 857 |
< |
} '=' logging_file_type_items ';' ; |
| 857 |
> |
} '=' logging_file_type_items ';' ; |
| 858 |
|
|
| 859 |
|
logging_file_type_items: logging_file_type_items ',' logging_file_type_item | logging_file_type_item; |
| 860 |
|
logging_file_type_item: USER |
| 904 |
|
block_state.flags.value |= CONF_FLAGS_ENCRYPTED; |
| 905 |
|
} '{' oper_items '}' ';' |
| 906 |
|
{ |
| 907 |
< |
dlink_node *node = NULL; |
| 907 |
> |
dlink_node *node; |
| 908 |
|
|
| 909 |
|
if (conf_parser_ctx.pass != 2) |
| 910 |
|
break; |
| 917 |
|
|
| 918 |
|
DLINK_FOREACH(node, block_state.mask.list.head) |
| 919 |
|
{ |
| 977 |
– |
struct MaskItem *conf = NULL; |
| 920 |
|
struct split_nuh_item nuh; |
| 921 |
|
char *s = node->data; |
| 922 |
|
|
| 927 |
|
nuh.nickptr = NULL; |
| 928 |
|
nuh.userptr = block_state.user.buf; |
| 929 |
|
nuh.hostptr = block_state.host.buf; |
| 930 |
+ |
|
| 931 |
|
nuh.nicksize = 0; |
| 932 |
|
nuh.usersize = sizeof(block_state.user.buf); |
| 933 |
|
nuh.hostsize = sizeof(block_state.host.buf); |
| 934 |
+ |
|
| 935 |
|
split_nuh(&nuh); |
| 936 |
|
|
| 937 |
< |
conf = conf_make(CONF_OPER); |
| 938 |
< |
conf->name = xstrdup(block_state.name.buf); |
| 939 |
< |
conf->user = xstrdup(block_state.user.buf); |
| 940 |
< |
conf->host = xstrdup(block_state.host.buf); |
| 937 |
> |
struct MaskItem *conf = conf_make(CONF_OPER); |
| 938 |
> |
conf->addr = xcalloc(sizeof(*conf->addr)); |
| 939 |
> |
conf->name = xstrdup(block_state.name.buf); |
| 940 |
> |
conf->user = xstrdup(block_state.user.buf); |
| 941 |
> |
conf->host = xstrdup(block_state.host.buf); |
| 942 |
|
|
| 943 |
|
if (block_state.cert.buf[0]) |
| 944 |
|
conf->certfp = xstrdup(block_state.cert.buf); |
| 952 |
|
conf->flags = block_state.flags.value; |
| 953 |
|
conf->modes = block_state.modes.value; |
| 954 |
|
conf->port = block_state.port.value; |
| 955 |
< |
conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits); |
| 955 |
> |
conf->htype = parse_netmask(conf->host, conf->addr, &conf->bits); |
| 956 |
|
|
| 957 |
|
conf_add_class_to_conf(conf, block_state.class.buf); |
| 958 |
|
} |
| 966 |
|
oper_umodes | |
| 967 |
|
oper_class | |
| 968 |
|
oper_encrypted | |
| 969 |
< |
oper_ssl_certificate_fingerprint | |
| 970 |
< |
oper_ssl_connection_required | |
| 969 |
> |
oper_tls_certificate_fingerprint | |
| 970 |
> |
oper_tls_connection_required | |
| 971 |
|
oper_flags | |
| 972 |
|
error ';' ; |
| 973 |
|
|
| 1006 |
|
block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED; |
| 1007 |
|
}; |
| 1008 |
|
|
| 1009 |
< |
oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';' |
| 1009 |
> |
oper_tls_certificate_fingerprint: TLS_CERTIFICATE_FINGERPRINT '=' QSTRING ';' |
| 1010 |
|
{ |
| 1011 |
|
if (conf_parser_ctx.pass == 2) |
| 1012 |
|
strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf)); |
| 1013 |
|
}; |
| 1014 |
|
|
| 1015 |
< |
oper_ssl_connection_required: SSL_CONNECTION_REQUIRED '=' TBOOL ';' |
| 1015 |
> |
oper_tls_connection_required: TLS_CONNECTION_REQUIRED '=' TBOOL ';' |
| 1016 |
|
{ |
| 1017 |
|
if (conf_parser_ctx.pass != 2) |
| 1018 |
|
break; |
| 1019 |
|
|
| 1020 |
|
if (yylval.number) |
| 1021 |
< |
block_state.flags.value |= CONF_FLAGS_SSL; |
| 1021 |
> |
block_state.flags.value |= CONF_FLAGS_TLS; |
| 1022 |
|
else |
| 1023 |
< |
block_state.flags.value &= ~CONF_FLAGS_SSL; |
| 1023 |
> |
block_state.flags.value &= ~CONF_FLAGS_TLS; |
| 1024 |
|
}; |
| 1025 |
|
|
| 1026 |
|
oper_class: CLASS '=' QSTRING ';' |
| 1033 |
|
{ |
| 1034 |
|
if (conf_parser_ctx.pass == 2) |
| 1035 |
|
block_state.modes.value = 0; |
| 1036 |
< |
} '=' oper_umodes_items ';' ; |
| 1036 |
> |
} '=' oper_umodes_items ';' ; |
| 1037 |
|
|
| 1038 |
|
oper_umodes_items: oper_umodes_items ',' oper_umodes_item | oper_umodes_item; |
| 1039 |
< |
oper_umodes_item: T_BOTS |
| 1039 |
> |
oper_umodes_item: BOT |
| 1040 |
|
{ |
| 1041 |
|
if (conf_parser_ctx.pass == 2) |
| 1042 |
< |
block_state.modes.value |= UMODE_BOTS; |
| 1042 |
> |
block_state.modes.value |= UMODE_BOT; |
| 1043 |
|
} | T_CCONN |
| 1044 |
|
{ |
| 1045 |
|
if (conf_parser_ctx.pass == 2) |
| 1052 |
|
{ |
| 1053 |
|
if (conf_parser_ctx.pass == 2) |
| 1054 |
|
block_state.modes.value |= UMODE_DEBUG; |
| 1055 |
< |
} | T_FULL |
| 1055 |
> |
} | T_FLOOD |
| 1056 |
|
{ |
| 1057 |
|
if (conf_parser_ctx.pass == 2) |
| 1058 |
< |
block_state.modes.value |= UMODE_FULL; |
| 1058 |
> |
block_state.modes.value |= UMODE_FLOOD; |
| 1059 |
|
} | HIDDEN |
| 1060 |
|
{ |
| 1061 |
|
if (conf_parser_ctx.pass == 2) |
| 1080 |
|
{ |
| 1081 |
|
if (conf_parser_ctx.pass == 2) |
| 1082 |
|
block_state.modes.value |= UMODE_REJ; |
| 1138 |
– |
} | T_UNAUTH |
| 1139 |
– |
{ |
| 1140 |
– |
if (conf_parser_ctx.pass == 2) |
| 1141 |
– |
block_state.modes.value |= UMODE_UNAUTH; |
| 1083 |
|
} | T_SPY |
| 1084 |
|
{ |
| 1085 |
|
if (conf_parser_ctx.pass == 2) |
| 1120 |
|
{ |
| 1121 |
|
if (conf_parser_ctx.pass == 2) |
| 1122 |
|
block_state.modes.value |= UMODE_FARCONNECT; |
| 1123 |
+ |
} | EXPIRATION |
| 1124 |
+ |
{ |
| 1125 |
+ |
if (conf_parser_ctx.pass == 2) |
| 1126 |
+ |
block_state.modes.value |= UMODE_EXPIRATION; |
| 1127 |
|
}; |
| 1128 |
|
|
| 1129 |
|
oper_flags: IRCD_FLAGS |
| 1130 |
|
{ |
| 1131 |
|
if (conf_parser_ctx.pass == 2) |
| 1132 |
|
block_state.port.value = 0; |
| 1133 |
< |
} '=' oper_flags_items ';'; |
| 1133 |
> |
} '=' oper_flags_items ';'; |
| 1134 |
|
|
| 1135 |
|
oper_flags_items: oper_flags_items ',' oper_flags_item | oper_flags_item; |
| 1136 |
|
oper_flags_item: KILL ':' REMOTE |
| 1264 |
|
|
| 1265 |
|
block_state.ping_freq.value = DEFAULT_PINGFREQUENCY; |
| 1266 |
|
block_state.con_freq.value = DEFAULT_CONNECTFREQUENCY; |
| 1322 |
– |
block_state.max_total.value = MAXIMUM_LINKS_DEFAULT; |
| 1267 |
|
block_state.max_sendq.value = DEFAULT_SENDQ; |
| 1268 |
|
block_state.max_recvq.value = DEFAULT_RECVQ; |
| 1269 |
|
} '{' class_items '}' ';' |
| 1270 |
|
{ |
| 1327 |
– |
struct ClassItem *class = NULL; |
| 1328 |
– |
|
| 1271 |
|
if (conf_parser_ctx.pass != 1) |
| 1272 |
|
break; |
| 1273 |
|
|
| 1274 |
|
if (!block_state.class.buf[0]) |
| 1275 |
|
break; |
| 1276 |
|
|
| 1277 |
< |
if (!(class = class_find(block_state.class.buf, 0))) |
| 1277 |
> |
struct ClassItem *class = class_find(block_state.class.buf, false); |
| 1278 |
> |
if (class == NULL) |
| 1279 |
|
class = class_make(); |
| 1280 |
|
|
| 1281 |
< |
class->active = 1; |
| 1281 |
> |
class->active = true; |
| 1282 |
|
xfree(class->name); |
| 1283 |
|
class->name = xstrdup(block_state.class.buf); |
| 1284 |
|
class->ping_freq = block_state.ping_freq.value; |
| 1285 |
< |
class->max_perip = block_state.max_perip.value; |
| 1285 |
> |
class->max_perip_local = block_state.max_perip_local.value; |
| 1286 |
> |
class->max_perip_global = block_state.max_perip_global.value; |
| 1287 |
|
class->con_freq = block_state.con_freq.value; |
| 1288 |
|
class->max_total = block_state.max_total.value; |
| 1345 |
– |
class->max_global = block_state.max_global.value; |
| 1346 |
– |
class->max_local = block_state.max_local.value; |
| 1289 |
|
class->max_sendq = block_state.max_sendq.value; |
| 1290 |
|
class->max_recvq = block_state.max_recvq.value; |
| 1291 |
|
class->max_channels = block_state.max_channels.value; |
| 1301 |
|
class->min_idle = block_state.min_idle.value; |
| 1302 |
|
class->max_idle = block_state.max_idle.value; |
| 1303 |
|
|
| 1304 |
< |
rebuild_cidr_list(class); |
| 1305 |
< |
|
| 1304 |
> |
bool diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value || |
| 1305 |
> |
class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value); |
| 1306 |
|
class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value; |
| 1307 |
|
class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value; |
| 1308 |
|
class->number_per_cidr = block_state.number_per_cidr.value; |
| 1309 |
+ |
|
| 1310 |
+ |
if (diff) |
| 1311 |
+ |
class_ip_limit_rebuild(class); |
| 1312 |
|
}; |
| 1313 |
|
|
| 1314 |
|
class_items: class_items class_item | class_item; |
| 1317 |
|
class_cidr_bitlen_ipv6 | |
| 1318 |
|
class_ping_time | |
| 1319 |
|
class_number_per_cidr | |
| 1320 |
< |
class_number_per_ip | |
| 1320 |
> |
class_number_per_ip_local | |
| 1321 |
> |
class_number_per_ip_global | |
| 1322 |
|
class_connectfreq | |
| 1323 |
|
class_max_channels | |
| 1324 |
|
class_max_number | |
| 1379 |
– |
class_max_global | |
| 1380 |
– |
class_max_local | |
| 1325 |
|
class_sendq | |
| 1326 |
|
class_recvq | |
| 1327 |
|
class_min_idle | |
| 1341 |
|
block_state.ping_freq.value = $3; |
| 1342 |
|
}; |
| 1343 |
|
|
| 1344 |
< |
class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';' |
| 1344 |
> |
class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';' |
| 1345 |
> |
{ |
| 1346 |
> |
if (conf_parser_ctx.pass == 1) |
| 1347 |
> |
block_state.max_perip_local.value = $3; |
| 1348 |
> |
}; |
| 1349 |
> |
|
| 1350 |
> |
class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';' |
| 1351 |
|
{ |
| 1352 |
|
if (conf_parser_ctx.pass == 1) |
| 1353 |
< |
block_state.max_perip.value = $3; |
| 1353 |
> |
block_state.max_perip_global.value = $3; |
| 1354 |
|
}; |
| 1355 |
|
|
| 1356 |
|
class_connectfreq: CONNECTFREQ '=' timespec ';' |
| 1371 |
|
block_state.max_total.value = $3; |
| 1372 |
|
}; |
| 1373 |
|
|
| 1424 |
– |
class_max_global: MAX_GLOBAL '=' NUMBER ';' |
| 1425 |
– |
{ |
| 1426 |
– |
if (conf_parser_ctx.pass == 1) |
| 1427 |
– |
block_state.max_global.value = $3; |
| 1428 |
– |
}; |
| 1429 |
– |
|
| 1430 |
– |
class_max_local: MAX_LOCAL '=' NUMBER ';' |
| 1431 |
– |
{ |
| 1432 |
– |
if (conf_parser_ctx.pass == 1) |
| 1433 |
– |
block_state.max_local.value = $3; |
| 1434 |
– |
}; |
| 1435 |
– |
|
| 1374 |
|
class_sendq: SENDQ '=' sizespec ';' |
| 1375 |
|
{ |
| 1376 |
|
if (conf_parser_ctx.pass == 1) |
| 1424 |
|
{ |
| 1425 |
|
if (conf_parser_ctx.pass == 1) |
| 1426 |
|
block_state.flags.value &= CLASS_FLAGS_FAKE_IDLE; |
| 1427 |
< |
} '=' class_flags_items ';'; |
| 1427 |
> |
} '=' class_flags_items ';'; |
| 1428 |
|
|
| 1429 |
|
class_flags_items: class_flags_items ',' class_flags_item | class_flags_item; |
| 1430 |
|
class_flags_item: RANDOM_IDLE |
| 1450 |
|
listen_flags: IRCD_FLAGS |
| 1451 |
|
{ |
| 1452 |
|
block_state.flags.value = 0; |
| 1453 |
< |
} '=' listen_flags_items ';'; |
| 1453 |
> |
} '=' listen_flags_items ';'; |
| 1454 |
|
|
| 1455 |
|
listen_flags_items: listen_flags_items ',' listen_flags_item | listen_flags_item; |
| 1456 |
< |
listen_flags_item: T_SSL |
| 1456 |
> |
listen_flags_item: T_TLS |
| 1457 |
|
{ |
| 1458 |
|
if (conf_parser_ctx.pass == 2) |
| 1459 |
< |
block_state.flags.value |= LISTENER_SSL; |
| 1459 |
> |
block_state.flags.value |= LISTENER_TLS; |
| 1460 |
|
} | HIDDEN |
| 1461 |
|
{ |
| 1462 |
|
if (conf_parser_ctx.pass == 2) |
| 1465 |
|
{ |
| 1466 |
|
if (conf_parser_ctx.pass == 2) |
| 1467 |
|
block_state.flags.value |= LISTENER_SERVER; |
| 1468 |
+ |
} | CLIENT |
| 1469 |
+ |
{ |
| 1470 |
+ |
if (conf_parser_ctx.pass == 2) |
| 1471 |
+ |
block_state.flags.value |= LISTENER_CLIENT; |
| 1472 |
+ |
} | DEFER |
| 1473 |
+ |
{ |
| 1474 |
+ |
if (conf_parser_ctx.pass == 2) |
| 1475 |
+ |
block_state.flags.value |= LISTENER_DEFER; |
| 1476 |
|
}; |
| 1477 |
|
|
| 1478 |
|
listen_items: listen_items listen_item | listen_item; |
| 1487 |
|
if (conf_parser_ctx.pass == 2) |
| 1488 |
|
{ |
| 1489 |
|
#ifndef HAVE_TLS |
| 1490 |
< |
if (block_state.flags.value & LISTENER_SSL) |
| 1490 |
> |
if (block_state.flags.value & LISTENER_TLS) |
| 1491 |
|
{ |
| 1492 |
|
conf_error_report("TLS not available - port closed"); |
| 1493 |
|
break; |
| 1500 |
|
if (conf_parser_ctx.pass == 2) |
| 1501 |
|
{ |
| 1502 |
|
#ifndef HAVE_TLS |
| 1503 |
< |
if (block_state.flags.value & LISTENER_SSL) |
| 1503 |
> |
if (block_state.flags.value & LISTENER_TLS) |
| 1504 |
|
{ |
| 1505 |
|
conf_error_report("TLS not available - port closed"); |
| 1506 |
|
break; |
| 1534 |
|
reset_block_state(); |
| 1535 |
|
} '{' auth_items '}' ';' |
| 1536 |
|
{ |
| 1537 |
< |
dlink_node *node = NULL; |
| 1537 |
> |
dlink_node *node; |
| 1538 |
|
|
| 1539 |
|
if (conf_parser_ctx.pass != 2) |
| 1540 |
|
break; |
| 1541 |
|
|
| 1542 |
|
DLINK_FOREACH(node, block_state.mask.list.head) |
| 1543 |
|
{ |
| 1598 |
– |
struct MaskItem *conf = NULL; |
| 1544 |
|
struct split_nuh_item nuh; |
| 1545 |
|
char *s = node->data; |
| 1546 |
|
|
| 1551 |
|
nuh.nickptr = NULL; |
| 1552 |
|
nuh.userptr = block_state.user.buf; |
| 1553 |
|
nuh.hostptr = block_state.host.buf; |
| 1554 |
+ |
|
| 1555 |
|
nuh.nicksize = 0; |
| 1556 |
|
nuh.usersize = sizeof(block_state.user.buf); |
| 1557 |
|
nuh.hostsize = sizeof(block_state.host.buf); |
| 1558 |
+ |
|
| 1559 |
|
split_nuh(&nuh); |
| 1560 |
|
|
| 1561 |
< |
conf = conf_make(CONF_CLIENT); |
| 1562 |
< |
conf->user = xstrdup(block_state.user.buf); |
| 1563 |
< |
conf->host = xstrdup(block_state.host.buf); |
| 1561 |
> |
struct MaskItem *conf = conf_make(CONF_CLIENT); |
| 1562 |
> |
conf->user = xstrdup(block_state.user.buf); |
| 1563 |
> |
conf->host = xstrdup(block_state.host.buf); |
| 1564 |
|
|
| 1565 |
|
if (block_state.rpass.buf[0]) |
| 1566 |
|
conf->passwd = xstrdup(block_state.rpass.buf); |
| 1568 |
|
conf->name = xstrdup(block_state.name.buf); |
| 1569 |
|
|
| 1570 |
|
conf->flags = block_state.flags.value; |
| 1571 |
< |
conf->port = block_state.port.value; |
| 1571 |
> |
conf->port = block_state.port.value; |
| 1572 |
|
|
| 1573 |
|
conf_add_class_to_conf(conf, block_state.class.buf); |
| 1574 |
|
add_conf_by_address(CONF_CLIENT, conf); |
| 1619 |
|
{ |
| 1620 |
|
if (conf_parser_ctx.pass == 2) |
| 1621 |
|
block_state.flags.value &= (CONF_FLAGS_ENCRYPTED | CONF_FLAGS_SPOOF_IP); |
| 1622 |
< |
} '=' auth_flags_items ';'; |
| 1622 |
> |
} '=' auth_flags_items ';'; |
| 1623 |
|
|
| 1624 |
|
auth_flags_items: auth_flags_items ',' auth_flags_item | auth_flags_item; |
| 1625 |
< |
auth_flags_item: SPOOF_NOTICE |
| 1679 |
< |
{ |
| 1680 |
< |
if (conf_parser_ctx.pass == 2) |
| 1681 |
< |
block_state.flags.value |= CONF_FLAGS_SPOOF_NOTICE; |
| 1682 |
< |
} | EXCEED_LIMIT |
| 1625 |
> |
auth_flags_item: EXCEED_LIMIT |
| 1626 |
|
{ |
| 1627 |
|
if (conf_parser_ctx.pass == 2) |
| 1628 |
|
block_state.flags.value |= CONF_FLAGS_NOLIMIT; |
| 1746 |
|
if (conf_parser_ctx.pass != 2) |
| 1747 |
|
break; |
| 1748 |
|
|
| 1749 |
< |
if (valid_servname(yylval.string)) |
| 1749 |
> |
if (server_valid_name(yylval.string) == true) |
| 1750 |
|
{ |
| 1751 |
|
struct ServiceItem *service = service_make(); |
| 1752 |
|
service->name = xstrdup(yylval.string); |
| 1951 |
|
reset_block_state(); |
| 1952 |
|
block_state.aftype.value = AF_INET; |
| 1953 |
|
block_state.port.value = PORTNUM; |
| 1954 |
+ |
block_state.timeout.value = CONNECTTIMEOUT; |
| 1955 |
|
} '{' connect_items '}' ';' |
| 1956 |
|
{ |
| 2013 |
– |
struct MaskItem *conf = NULL; |
| 1957 |
|
struct addrinfo hints, *res; |
| 1958 |
|
|
| 1959 |
|
if (conf_parser_ctx.pass != 2) |
| 1967 |
|
!block_state.spass.buf[0]) |
| 1968 |
|
break; |
| 1969 |
|
|
| 1970 |
+ |
if (server_valid_name(block_state.name.buf) == false) |
| 1971 |
+ |
break; |
| 1972 |
+ |
|
| 1973 |
|
if (has_wildcards(block_state.name.buf) || |
| 1974 |
|
has_wildcards(block_state.host.buf)) |
| 1975 |
|
break; |
| 1976 |
|
|
| 1977 |
< |
conf = conf_make(CONF_SERVER); |
| 1977 |
> |
struct MaskItem *conf = conf_make(CONF_SERVER); |
| 1978 |
> |
conf->addr = xcalloc(sizeof(*conf->addr)); |
| 1979 |
|
conf->port = block_state.port.value; |
| 1980 |
+ |
conf->timeout = block_state.timeout.value; |
| 1981 |
|
conf->flags = block_state.flags.value; |
| 1982 |
|
conf->aftype = block_state.aftype.value; |
| 1983 |
|
conf->host = xstrdup(block_state.host.buf); |
| 2003 |
|
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; |
| 2004 |
|
|
| 2005 |
|
if (getaddrinfo(block_state.bind.buf, NULL, &hints, &res)) |
| 2006 |
< |
ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf); |
| 2006 |
> |
ilog(LOG_TYPE_IRCD, "Invalid netmask for server bind(%s)", block_state.bind.buf); |
| 2007 |
|
else |
| 2008 |
|
{ |
| 2009 |
|
assert(res); |
| 2010 |
|
|
| 2011 |
< |
memcpy(&conf->bind, res->ai_addr, res->ai_addrlen); |
| 2012 |
< |
conf->bind.ss.ss_family = res->ai_family; |
| 2013 |
< |
conf->bind.ss_len = res->ai_addrlen; |
| 2011 |
> |
conf->bind = xcalloc(sizeof(*conf->bind)); |
| 2012 |
> |
|
| 2013 |
> |
memcpy(conf->bind, res->ai_addr, res->ai_addrlen); |
| 2014 |
> |
conf->bind->ss_len = res->ai_addrlen; |
| 2015 |
|
freeaddrinfo(res); |
| 2016 |
|
} |
| 2017 |
|
} |
| 2018 |
|
|
| 2019 |
|
conf_add_class_to_conf(conf, block_state.class.buf); |
| 2020 |
< |
lookup_confhost(conf); |
| 2020 |
> |
conf_dns_lookup(conf); |
| 2021 |
|
}; |
| 2022 |
|
|
| 2023 |
|
connect_items: connect_items connect_item | connect_item; |
| 2024 |
|
connect_item: connect_name | |
| 2025 |
|
connect_host | |
| 2026 |
< |
connect_vhost | |
| 2026 |
> |
connect_timeout | |
| 2027 |
> |
connect_bind | |
| 2028 |
|
connect_send_password | |
| 2029 |
|
connect_accept_password | |
| 2030 |
< |
connect_ssl_certificate_fingerprint | |
| 2030 |
> |
connect_tls_certificate_fingerprint | |
| 2031 |
|
connect_aftype | |
| 2032 |
|
connect_port | |
| 2033 |
< |
connect_ssl_cipher_list | |
| 2033 |
> |
connect_tls_cipher_list | |
| 2034 |
|
connect_flags | |
| 2035 |
|
connect_hub_mask | |
| 2036 |
|
connect_leaf_mask | |
| 2050 |
|
strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf)); |
| 2051 |
|
}; |
| 2052 |
|
|
| 2053 |
< |
connect_vhost: VHOST '=' QSTRING ';' |
| 2053 |
> |
connect_timeout: TIMEOUT '=' timespec ';' |
| 2054 |
> |
{ |
| 2055 |
> |
if (conf_parser_ctx.pass == 2) |
| 2056 |
> |
block_state.timeout.value = $3; |
| 2057 |
> |
}; |
| 2058 |
> |
|
| 2059 |
> |
connect_bind: T_BIND '=' QSTRING ';' |
| 2060 |
|
{ |
| 2061 |
|
if (conf_parser_ctx.pass == 2) |
| 2062 |
|
strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf)); |
| 2067 |
|
if (conf_parser_ctx.pass != 2) |
| 2068 |
|
break; |
| 2069 |
|
|
| 2070 |
< |
if ($3[0] == ':') |
| 2070 |
> |
if (*yylval.string == ':') |
| 2071 |
|
conf_error_report("Server passwords cannot begin with a colon"); |
| 2072 |
< |
else if (strchr($3, ' ')) |
| 2072 |
> |
else if (strchr(yylval.string, ' ')) |
| 2073 |
|
conf_error_report("Server passwords cannot contain spaces"); |
| 2074 |
|
else |
| 2075 |
|
strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf)); |
| 2080 |
|
if (conf_parser_ctx.pass != 2) |
| 2081 |
|
break; |
| 2082 |
|
|
| 2083 |
< |
if ($3[0] == ':') |
| 2083 |
> |
if (*yylval.string == ':') |
| 2084 |
|
conf_error_report("Server passwords cannot begin with a colon"); |
| 2085 |
< |
else if (strchr($3, ' ')) |
| 2085 |
> |
else if (strchr(yylval.string, ' ')) |
| 2086 |
|
conf_error_report("Server passwords cannot contain spaces"); |
| 2087 |
|
else |
| 2088 |
|
strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); |
| 2089 |
|
}; |
| 2090 |
|
|
| 2091 |
< |
connect_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';' |
| 2091 |
> |
connect_tls_certificate_fingerprint: TLS_CERTIFICATE_FINGERPRINT '=' QSTRING ';' |
| 2092 |
|
{ |
| 2093 |
|
if (conf_parser_ctx.pass == 2) |
| 2094 |
|
strlcpy(block_state.cert.buf, yylval.string, sizeof(block_state.cert.buf)); |
| 2113 |
|
connect_flags: IRCD_FLAGS |
| 2114 |
|
{ |
| 2115 |
|
block_state.flags.value &= CONF_FLAGS_ENCRYPTED; |
| 2116 |
< |
} '=' connect_flags_items ';'; |
| 2116 |
> |
} '=' connect_flags_items ';'; |
| 2117 |
|
|
| 2118 |
|
connect_flags_items: connect_flags_items ',' connect_flags_item | connect_flags_item; |
| 2119 |
|
connect_flags_item: AUTOCONN |
| 2120 |
|
{ |
| 2121 |
|
if (conf_parser_ctx.pass == 2) |
| 2122 |
|
block_state.flags.value |= CONF_FLAGS_ALLOW_AUTO_CONN; |
| 2123 |
< |
} | T_SSL |
| 2123 |
> |
} | T_TLS |
| 2124 |
|
{ |
| 2125 |
|
if (conf_parser_ctx.pass == 2) |
| 2126 |
< |
block_state.flags.value |= CONF_FLAGS_SSL; |
| 2126 |
> |
block_state.flags.value |= CONF_FLAGS_TLS; |
| 2127 |
|
}; |
| 2128 |
|
|
| 2129 |
|
connect_encrypted: ENCRYPTED '=' TBOOL ';' |
| 2155 |
|
strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf)); |
| 2156 |
|
}; |
| 2157 |
|
|
| 2158 |
< |
connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';' |
| 2158 |
> |
connect_tls_cipher_list: TLS_CIPHER_LIST '=' QSTRING ';' |
| 2159 |
|
{ |
| 2160 |
|
#ifdef HAVE_TLS |
| 2161 |
|
if (conf_parser_ctx.pass == 2) |
| 2162 |
|
strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf)); |
| 2163 |
|
#else |
| 2164 |
|
if (conf_parser_ctx.pass == 2) |
| 2165 |
< |
conf_error_report("Ignoring connect::ciphers -- no TLS support"); |
| 2165 |
> |
conf_error_report("Ignoring connect::tls_cipher_list -- no TLS support"); |
| 2166 |
|
#endif |
| 2167 |
|
}; |
| 2168 |
|
|
| 2176 |
|
reset_block_state(); |
| 2177 |
|
} '{' kill_items '}' ';' |
| 2178 |
|
{ |
| 2223 |
– |
struct MaskItem *conf = NULL; |
| 2224 |
– |
|
| 2179 |
|
if (conf_parser_ctx.pass != 2) |
| 2180 |
|
break; |
| 2181 |
|
|
| 2183 |
|
!block_state.host.buf[0]) |
| 2184 |
|
break; |
| 2185 |
|
|
| 2186 |
< |
conf = conf_make(CONF_KLINE); |
| 2186 |
> |
struct MaskItem *conf = conf_make(CONF_KLINE); |
| 2187 |
|
conf->user = xstrdup(block_state.user.buf); |
| 2188 |
|
conf->host = xstrdup(block_state.host.buf); |
| 2189 |
|
|
| 2233 |
|
reset_block_state(); |
| 2234 |
|
} '{' deny_items '}' ';' |
| 2235 |
|
{ |
| 2282 |
– |
struct MaskItem *conf = NULL; |
| 2283 |
– |
|
| 2236 |
|
if (conf_parser_ctx.pass != 2) |
| 2237 |
|
break; |
| 2238 |
|
|
| 2241 |
|
|
| 2242 |
|
if (parse_netmask(block_state.addr.buf, NULL, NULL) != HM_HOST) |
| 2243 |
|
{ |
| 2244 |
< |
conf = conf_make(CONF_DLINE); |
| 2244 |
> |
struct MaskItem *conf = conf_make(CONF_DLINE); |
| 2245 |
|
conf->host = xstrdup(block_state.addr.buf); |
| 2246 |
|
|
| 2247 |
|
if (block_state.rpass.buf[0]) |
| 2338 |
|
general_items: general_items general_item | general_item; |
| 2339 |
|
general_item: general_away_count | |
| 2340 |
|
general_away_time | |
| 2389 |
– |
general_ignore_bogus_ts | |
| 2341 |
|
general_failed_oper_notice | |
| 2342 |
|
general_anti_nick_flood | |
| 2343 |
|
general_max_nick_time | |
| 2374 |
|
general_throttle_time | |
| 2375 |
|
general_ping_cookie | |
| 2376 |
|
general_disable_auth | |
| 2426 |
– |
general_tkline_expire_notices | |
| 2377 |
|
general_dline_min_cidr | |
| 2378 |
|
general_dline_min_cidr6 | |
| 2379 |
|
general_kline_min_cidr | |
| 2380 |
|
general_kline_min_cidr6 | |
| 2381 |
|
general_stats_e_disabled | |
| 2382 |
< |
general_max_watch | |
| 2382 |
> |
general_max_monitor | |
| 2383 |
|
general_cycle_on_host_change | |
| 2384 |
|
error; |
| 2385 |
|
|
| 2394 |
|
ConfigGeneral.away_time = $3; |
| 2395 |
|
}; |
| 2396 |
|
|
| 2397 |
< |
general_max_watch: MAX_WATCH '=' NUMBER ';' |
| 2397 |
> |
general_max_monitor: MAX_MONITOR '=' NUMBER ';' |
| 2398 |
|
{ |
| 2399 |
< |
ConfigGeneral.max_watch = $3; |
| 2399 |
> |
ConfigGeneral.max_monitor = $3; |
| 2400 |
|
}; |
| 2401 |
|
|
| 2402 |
|
general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';' |
| 2406 |
|
|
| 2407 |
|
general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';' |
| 2408 |
|
{ |
| 2409 |
< |
if (conf_parser_ctx.pass == 2) |
| 2460 |
< |
ConfigGeneral.cycle_on_host_change = yylval.number; |
| 2409 |
> |
ConfigGeneral.cycle_on_host_change = yylval.number; |
| 2410 |
|
}; |
| 2411 |
|
|
| 2412 |
|
general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';' |
| 2429 |
|
ConfigGeneral.kline_min_cidr6 = $3; |
| 2430 |
|
}; |
| 2431 |
|
|
| 2483 |
– |
general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';' |
| 2484 |
– |
{ |
| 2485 |
– |
ConfigGeneral.tkline_expire_notices = yylval.number; |
| 2486 |
– |
}; |
| 2487 |
– |
|
| 2432 |
|
general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';' |
| 2433 |
|
{ |
| 2434 |
|
ConfigGeneral.kill_chase_time_limit = $3; |
| 2435 |
|
}; |
| 2436 |
|
|
| 2493 |
– |
general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';' |
| 2494 |
– |
{ |
| 2495 |
– |
ConfigGeneral.ignore_bogus_ts = yylval.number; |
| 2496 |
– |
}; |
| 2497 |
– |
|
| 2437 |
|
general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';' |
| 2438 |
|
{ |
| 2439 |
|
ConfigGeneral.failed_oper_notice = yylval.number; |
| 2471 |
|
|
| 2472 |
|
general_ts_max_delta: TS_MAX_DELTA '=' timespec ';' |
| 2473 |
|
{ |
| 2474 |
< |
if (conf_parser_ctx.pass == 2) |
| 2536 |
< |
ConfigGeneral.ts_max_delta = $3; |
| 2474 |
> |
ConfigGeneral.ts_max_delta = $3; |
| 2475 |
|
}; |
| 2476 |
|
|
| 2477 |
|
general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';' |
| 2511 |
|
|
| 2512 |
|
general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';' |
| 2513 |
|
{ |
| 2514 |
< |
ConfigGeneral.stats_k_oper_only = 2 * yylval.number; |
| 2577 |
< |
} | STATS_K_OPER_ONLY '=' TMASKED ';' |
| 2578 |
< |
{ |
| 2579 |
< |
ConfigGeneral.stats_k_oper_only = 1; |
| 2514 |
> |
ConfigGeneral.stats_k_oper_only = yylval.number; |
| 2515 |
|
}; |
| 2516 |
|
|
| 2517 |
|
general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';' |
| 2518 |
|
{ |
| 2519 |
< |
ConfigGeneral.stats_i_oper_only = 2 * yylval.number; |
| 2585 |
< |
} | STATS_I_OPER_ONLY '=' TMASKED ';' |
| 2586 |
< |
{ |
| 2587 |
< |
ConfigGeneral.stats_i_oper_only = 1; |
| 2519 |
> |
ConfigGeneral.stats_i_oper_only = yylval.number; |
| 2520 |
|
}; |
| 2521 |
|
|
| 2522 |
|
general_pace_wait: PACE_WAIT '=' timespec ';' |
| 2582 |
|
general_oper_umodes: OPER_UMODES |
| 2583 |
|
{ |
| 2584 |
|
ConfigGeneral.oper_umodes = 0; |
| 2585 |
< |
} '=' umode_oitems ';' ; |
| 2585 |
> |
} '=' umode_oitems ';' ; |
| 2586 |
|
|
| 2587 |
|
umode_oitems: umode_oitems ',' umode_oitem | umode_oitem; |
| 2588 |
< |
umode_oitem: T_BOTS |
| 2588 |
> |
umode_oitem: BOT |
| 2589 |
|
{ |
| 2590 |
< |
ConfigGeneral.oper_umodes |= UMODE_BOTS; |
| 2590 |
> |
ConfigGeneral.oper_umodes |= UMODE_BOT; |
| 2591 |
|
} | T_CCONN |
| 2592 |
|
{ |
| 2593 |
|
ConfigGeneral.oper_umodes |= UMODE_CCONN; |
| 2597 |
|
} | T_DEBUG |
| 2598 |
|
{ |
| 2599 |
|
ConfigGeneral.oper_umodes |= UMODE_DEBUG; |
| 2600 |
< |
} | T_FULL |
| 2600 |
> |
} | T_FLOOD |
| 2601 |
|
{ |
| 2602 |
< |
ConfigGeneral.oper_umodes |= UMODE_FULL; |
| 2602 |
> |
ConfigGeneral.oper_umodes |= UMODE_FLOOD; |
| 2603 |
|
} | HIDDEN |
| 2604 |
|
{ |
| 2605 |
|
ConfigGeneral.oper_umodes |= UMODE_HIDDEN; |
| 2618 |
|
} | T_REJ |
| 2619 |
|
{ |
| 2620 |
|
ConfigGeneral.oper_umodes |= UMODE_REJ; |
| 2689 |
– |
} | T_UNAUTH |
| 2690 |
– |
{ |
| 2691 |
– |
ConfigGeneral.oper_umodes |= UMODE_UNAUTH; |
| 2621 |
|
} | T_SPY |
| 2622 |
|
{ |
| 2623 |
|
ConfigGeneral.oper_umodes |= UMODE_SPY; |
| 2648 |
|
} | T_FARCONNECT |
| 2649 |
|
{ |
| 2650 |
|
ConfigGeneral.oper_umodes |= UMODE_FARCONNECT; |
| 2651 |
+ |
} | EXPIRATION |
| 2652 |
+ |
{ |
| 2653 |
+ |
ConfigGeneral.oper_umodes |= UMODE_EXPIRATION; |
| 2654 |
|
}; |
| 2655 |
|
|
| 2656 |
|
general_oper_only_umodes: OPER_ONLY_UMODES |
| 2657 |
|
{ |
| 2658 |
|
ConfigGeneral.oper_only_umodes = 0; |
| 2659 |
< |
} '=' umode_items ';' ; |
| 2659 |
> |
} '=' umode_items ';' ; |
| 2660 |
|
|
| 2661 |
|
umode_items: umode_items ',' umode_item | umode_item; |
| 2662 |
< |
umode_item: T_BOTS |
| 2662 |
> |
umode_item: BOT |
| 2663 |
|
{ |
| 2664 |
< |
ConfigGeneral.oper_only_umodes |= UMODE_BOTS; |
| 2664 |
> |
ConfigGeneral.oper_only_umodes |= UMODE_BOT; |
| 2665 |
|
} | T_CCONN |
| 2666 |
|
{ |
| 2667 |
|
ConfigGeneral.oper_only_umodes |= UMODE_CCONN; |
| 2671 |
|
} | T_DEBUG |
| 2672 |
|
{ |
| 2673 |
|
ConfigGeneral.oper_only_umodes |= UMODE_DEBUG; |
| 2674 |
< |
} | T_FULL |
| 2674 |
> |
} | T_FLOOD |
| 2675 |
|
{ |
| 2676 |
< |
ConfigGeneral.oper_only_umodes |= UMODE_FULL; |
| 2676 |
> |
ConfigGeneral.oper_only_umodes |= UMODE_FLOOD; |
| 2677 |
|
} | T_SKILL |
| 2678 |
|
{ |
| 2679 |
|
ConfigGeneral.oper_only_umodes |= UMODE_SKILL; |
| 2686 |
|
} | T_REJ |
| 2687 |
|
{ |
| 2688 |
|
ConfigGeneral.oper_only_umodes |= UMODE_REJ; |
| 2757 |
– |
} | T_UNAUTH |
| 2758 |
– |
{ |
| 2759 |
– |
ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH; |
| 2689 |
|
} | T_SPY |
| 2690 |
|
{ |
| 2691 |
|
ConfigGeneral.oper_only_umodes |= UMODE_SPY; |
| 2716 |
|
} | T_FARCONNECT |
| 2717 |
|
{ |
| 2718 |
|
ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT; |
| 2719 |
+ |
} | EXPIRATION |
| 2720 |
+ |
{ |
| 2721 |
+ |
ConfigGeneral.oper_only_umodes |= UMODE_EXPIRATION; |
| 2722 |
|
}; |
| 2723 |
|
|
| 2724 |
|
general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';' |
| 2762 |
|
channel_default_join_flood_count | |
| 2763 |
|
channel_default_join_flood_time | |
| 2764 |
|
channel_disable_fake_channels | |
| 2765 |
+ |
channel_enable_extbans | |
| 2766 |
|
error; |
| 2767 |
|
|
| 2768 |
+ |
channel_enable_extbans: ENABLE_EXTBANS '=' TBOOL ';' |
| 2769 |
+ |
{ |
| 2770 |
+ |
ConfigChannel.enable_extbans = yylval.number; |
| 2771 |
+ |
}; |
| 2772 |
+ |
|
| 2773 |
|
channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';' |
| 2774 |
|
{ |
| 2775 |
|
ConfigChannel.disable_fake_channels = yylval.number; |