| 1 |
|
/* |
| 2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (c) 2000-2016 ircd-hybrid development team |
| 4 |
> |
* Copyright (c) 2000-2019 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" |
| 93 |
|
port, |
| 94 |
|
aftype, |
| 95 |
|
ping_freq, |
| 96 |
< |
max_perip, |
| 96 |
> |
max_perip_local, |
| 97 |
> |
max_perip_global, |
| 98 |
|
con_freq, |
| 99 |
|
min_idle, |
| 100 |
|
max_idle, |
| 101 |
|
max_total, |
| 100 |
– |
max_global, |
| 101 |
– |
max_local, |
| 102 |
|
max_sendq, |
| 103 |
|
max_recvq, |
| 104 |
|
max_channels, |
| 155 |
|
%token CALLER_ID_WAIT |
| 156 |
|
%token CAN_FLOOD |
| 157 |
|
%token CHANNEL |
| 158 |
– |
%token CHECK_CACHE |
| 158 |
|
%token CIDR_BITLEN_IPV4 |
| 159 |
|
%token CIDR_BITLEN_IPV6 |
| 160 |
|
%token CLASS |
| 163 |
|
%token CONNECTFREQ |
| 164 |
|
%token CYCLE_ON_HOST_CHANGE |
| 165 |
|
%token DEFAULT_FLOODCOUNT |
| 166 |
+ |
%token DEFAULT_FLOODTIME |
| 167 |
|
%token DEFAULT_JOIN_FLOOD_COUNT |
| 168 |
|
%token DEFAULT_JOIN_FLOOD_TIME |
| 169 |
|
%token DEFAULT_MAX_CLIENTS |
| 197 |
|
%token HOST |
| 198 |
|
%token HUB |
| 199 |
|
%token HUB_MASK |
| 200 |
– |
%token IGNORE_BOGUS_TS |
| 200 |
|
%token INVISIBLE_ON_CONNECT |
| 201 |
|
%token INVITE_CLIENT_COUNT |
| 202 |
|
%token INVITE_CLIENT_TIME |
| 203 |
|
%token INVITE_DELAY_CHANNEL |
| 204 |
+ |
%token INVITE_EXPIRE_TIME |
| 205 |
|
%token IP |
| 206 |
|
%token IRCD_AUTH |
| 207 |
|
%token IRCD_FLAGS |
| 217 |
|
%token KNOCK_CLIENT_TIME |
| 218 |
|
%token KNOCK_DELAY_CHANNEL |
| 219 |
|
%token LEAF_MASK |
| 220 |
– |
%token LIBGEOIP_DATABASE_OPTIONS |
| 221 |
– |
%token LIBGEOIP_IPV4_DATABASE_FILE |
| 222 |
– |
%token LIBGEOIP_IPV6_DATABASE_FILE |
| 220 |
|
%token LISTEN |
| 221 |
|
%token MASK |
| 222 |
|
%token MAX_ACCEPT |
| 223 |
|
%token MAX_BANS |
| 224 |
+ |
%token MAX_BANS_LARGE |
| 225 |
|
%token MAX_CHANNELS |
| 228 |
– |
%token MAX_GLOBAL |
| 226 |
|
%token MAX_IDLE |
| 227 |
< |
%token MAX_LOCAL |
| 227 |
> |
%token MAX_INVITES |
| 228 |
|
%token MAX_NICK_CHANGES |
| 229 |
|
%token MAX_NICK_LENGTH |
| 230 |
|
%token MAX_NICK_TIME |
| 232 |
|
%token MAX_TARGETS |
| 233 |
|
%token MAX_TOPIC_LENGTH |
| 234 |
|
%token MAX_WATCH |
| 238 |
– |
%token MEMORY_CACHE |
| 235 |
|
%token MIN_IDLE |
| 236 |
|
%token MIN_NONWILDCARD |
| 237 |
|
%token MIN_NONWILDCARD_SIMPLE |
| 242 |
– |
%token MMAP_CACHE |
| 238 |
|
%token MODULE |
| 239 |
|
%token MODULES |
| 240 |
|
%token MOTD |
| 248 |
|
%token NO_TILDE |
| 249 |
|
%token NUMBER |
| 250 |
|
%token NUMBER_PER_CIDR |
| 251 |
< |
%token NUMBER_PER_IP |
| 251 |
> |
%token NUMBER_PER_IP_GLOBAL |
| 252 |
> |
%token NUMBER_PER_IP_LOCAL |
| 253 |
|
%token OPER_ONLY_UMODES |
| 254 |
|
%token OPER_UMODES |
| 255 |
|
%token OPERATOR |
| 287 |
|
%token SSL_DH_ELLIPTIC_CURVE |
| 288 |
|
%token SSL_DH_PARAM_FILE |
| 289 |
|
%token SSL_MESSAGE_DIGEST_ALGORITHM |
| 294 |
– |
%token STANDARD |
| 290 |
|
%token STATS_E_DISABLED |
| 291 |
|
%token STATS_I_OPER_ONLY |
| 292 |
|
%token STATS_K_OPER_ONLY |
| 464 |
|
serverinfo_ssl_certificate_file | |
| 465 |
|
serverinfo_ssl_cipher_list | |
| 466 |
|
serverinfo_ssl_message_digest_algorithm | |
| 472 |
– |
serverinfo_libgeoip_database_options | |
| 473 |
– |
serverinfo_libgeoip_ipv4_database_file | |
| 474 |
– |
serverinfo_libgeoip_ipv6_database_file | |
| 467 |
|
error ';' ; |
| 468 |
|
|
| 469 |
|
|
| 521 |
|
} |
| 522 |
|
}; |
| 523 |
|
|
| 532 |
– |
serverinfo_libgeoip_database_options: LIBGEOIP_DATABASE_OPTIONS |
| 533 |
– |
{ |
| 534 |
– |
if (conf_parser_ctx.pass == 1) |
| 535 |
– |
ConfigServerInfo.libgeoip_database_options = 0; |
| 536 |
– |
} '=' options_items ';'; |
| 537 |
– |
|
| 538 |
– |
options_items: options_items ',' options_item | options_item; |
| 539 |
– |
options_item: STANDARD |
| 540 |
– |
{ |
| 541 |
– |
#ifdef HAVE_LIBGEOIP |
| 542 |
– |
if (conf_parser_ctx.pass == 1) |
| 543 |
– |
ConfigServerInfo.libgeoip_database_options |= GEOIP_STANDARD; |
| 544 |
– |
#endif |
| 545 |
– |
} | MEMORY_CACHE |
| 546 |
– |
{ |
| 547 |
– |
#ifdef HAVE_LIBGEOIP |
| 548 |
– |
if (conf_parser_ctx.pass == 1) |
| 549 |
– |
ConfigServerInfo.libgeoip_database_options |= GEOIP_MEMORY_CACHE; |
| 550 |
– |
#endif |
| 551 |
– |
} | MMAP_CACHE |
| 552 |
– |
{ |
| 553 |
– |
#ifdef HAVE_LIBGEOIP |
| 554 |
– |
if (conf_parser_ctx.pass == 1) |
| 555 |
– |
ConfigServerInfo.libgeoip_database_options |= GEOIP_MMAP_CACHE; |
| 556 |
– |
#endif |
| 557 |
– |
} | CHECK_CACHE |
| 558 |
– |
{ |
| 559 |
– |
#ifdef HAVE_LIBGEOIP |
| 560 |
– |
if (conf_parser_ctx.pass == 1) |
| 561 |
– |
ConfigServerInfo.libgeoip_database_options |= GEOIP_CHECK_CACHE; |
| 562 |
– |
#endif |
| 563 |
– |
}; |
| 564 |
– |
|
| 565 |
– |
serverinfo_libgeoip_ipv4_database_file: LIBGEOIP_IPV4_DATABASE_FILE '=' QSTRING ';' |
| 566 |
– |
{ |
| 567 |
– |
if (conf_parser_ctx.pass == 2) |
| 568 |
– |
{ |
| 569 |
– |
xfree(ConfigServerInfo.libgeoip_ipv4_database_file); |
| 570 |
– |
ConfigServerInfo.libgeoip_ipv4_database_file = xstrdup(yylval.string); |
| 571 |
– |
|
| 572 |
– |
#ifdef HAVE_LIBGEOIP |
| 573 |
– |
if (GeoIPv4_ctx) |
| 574 |
– |
GeoIP_delete(GeoIPv4_ctx); |
| 575 |
– |
GeoIPv4_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options); |
| 576 |
– |
#endif |
| 577 |
– |
} |
| 578 |
– |
}; |
| 579 |
– |
|
| 580 |
– |
serverinfo_libgeoip_ipv6_database_file: LIBGEOIP_IPV6_DATABASE_FILE '=' QSTRING ';' |
| 581 |
– |
{ |
| 582 |
– |
if (conf_parser_ctx.pass == 2) |
| 583 |
– |
{ |
| 584 |
– |
xfree(ConfigServerInfo.libgeoip_ipv6_database_file); |
| 585 |
– |
ConfigServerInfo.libgeoip_ipv6_database_file = xstrdup(yylval.string); |
| 586 |
– |
|
| 587 |
– |
#ifdef HAVE_LIBGEOIP |
| 588 |
– |
if (GeoIPv6_ctx) |
| 589 |
– |
GeoIP_delete(GeoIPv6_ctx); |
| 590 |
– |
GeoIPv6_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options); |
| 591 |
– |
#endif |
| 592 |
– |
} |
| 593 |
– |
}; |
| 594 |
– |
|
| 524 |
|
serverinfo_name: NAME '=' QSTRING ';' |
| 525 |
|
{ |
| 526 |
|
/* This isn't rehashable */ |
| 527 |
|
if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name) |
| 528 |
|
{ |
| 529 |
< |
if (valid_servname(yylval.string)) |
| 529 |
> |
if (server_valid_name(yylval.string) == true) |
| 530 |
|
ConfigServerInfo.name = xstrdup(yylval.string); |
| 531 |
|
else |
| 532 |
|
{ |
| 645 |
|
if (conf_parser_ctx.pass != 2) |
| 646 |
|
break; |
| 647 |
|
|
| 648 |
< |
if ($3 < MAXCLIENTS_MIN) |
| 648 |
> |
if ($3 < 1) |
| 649 |
|
{ |
| 650 |
< |
char buf[IRCD_BUFSIZE] = ""; |
| 651 |
< |
|
| 723 |
< |
snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN); |
| 724 |
< |
conf_error_report(buf); |
| 725 |
< |
ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN; |
| 650 |
> |
conf_error_report("default_max_clients too low, setting to 1"); |
| 651 |
> |
ConfigServerInfo.default_max_clients = 1; |
| 652 |
|
} |
| 653 |
|
else if ($3 > MAXCLIENTS_MAX) |
| 654 |
|
{ |
| 655 |
|
char buf[IRCD_BUFSIZE] = ""; |
| 656 |
|
|
| 657 |
< |
snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX); |
| 657 |
> |
snprintf(buf, sizeof(buf), "default_max_clients too high, setting to %d", MAXCLIENTS_MAX); |
| 658 |
|
conf_error_report(buf); |
| 659 |
|
ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX; |
| 660 |
|
} |
| 1327 |
|
if (!block_state.class.buf[0]) |
| 1328 |
|
break; |
| 1329 |
|
|
| 1330 |
< |
if (!(class = class_find(block_state.class.buf, 0))) |
| 1330 |
> |
if (!(class = class_find(block_state.class.buf, false))) |
| 1331 |
|
class = class_make(); |
| 1332 |
|
|
| 1333 |
|
class->active = 1; |
| 1334 |
|
xfree(class->name); |
| 1335 |
|
class->name = xstrdup(block_state.class.buf); |
| 1336 |
|
class->ping_freq = block_state.ping_freq.value; |
| 1337 |
< |
class->max_perip = block_state.max_perip.value; |
| 1337 |
> |
class->max_perip_local = block_state.max_perip_local.value; |
| 1338 |
> |
class->max_perip_global = block_state.max_perip_global.value; |
| 1339 |
|
class->con_freq = block_state.con_freq.value; |
| 1340 |
|
class->max_total = block_state.max_total.value; |
| 1414 |
– |
class->max_global = block_state.max_global.value; |
| 1415 |
– |
class->max_local = block_state.max_local.value; |
| 1341 |
|
class->max_sendq = block_state.max_sendq.value; |
| 1342 |
|
class->max_recvq = block_state.max_recvq.value; |
| 1343 |
|
class->max_channels = block_state.max_channels.value; |
| 1353 |
|
class->min_idle = block_state.min_idle.value; |
| 1354 |
|
class->max_idle = block_state.max_idle.value; |
| 1355 |
|
|
| 1356 |
< |
rebuild_cidr_list(class); |
| 1357 |
< |
|
| 1356 |
> |
int diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value || |
| 1357 |
> |
class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value); |
| 1358 |
|
class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value; |
| 1359 |
|
class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value; |
| 1360 |
|
class->number_per_cidr = block_state.number_per_cidr.value; |
| 1361 |
+ |
|
| 1362 |
+ |
if (diff) |
| 1363 |
+ |
class_ip_limit_rebuild(class); |
| 1364 |
|
}; |
| 1365 |
|
|
| 1366 |
|
class_items: class_items class_item | class_item; |
| 1369 |
|
class_cidr_bitlen_ipv6 | |
| 1370 |
|
class_ping_time | |
| 1371 |
|
class_number_per_cidr | |
| 1372 |
< |
class_number_per_ip | |
| 1372 |
> |
class_number_per_ip_local | |
| 1373 |
> |
class_number_per_ip_global | |
| 1374 |
|
class_connectfreq | |
| 1375 |
|
class_max_channels | |
| 1376 |
|
class_max_number | |
| 1448 |
– |
class_max_global | |
| 1449 |
– |
class_max_local | |
| 1377 |
|
class_sendq | |
| 1378 |
|
class_recvq | |
| 1379 |
|
class_min_idle | |
| 1393 |
|
block_state.ping_freq.value = $3; |
| 1394 |
|
}; |
| 1395 |
|
|
| 1396 |
< |
class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';' |
| 1396 |
> |
class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';' |
| 1397 |
> |
{ |
| 1398 |
> |
if (conf_parser_ctx.pass == 1) |
| 1399 |
> |
block_state.max_perip_local.value = $3; |
| 1400 |
> |
}; |
| 1401 |
> |
|
| 1402 |
> |
class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';' |
| 1403 |
|
{ |
| 1404 |
|
if (conf_parser_ctx.pass == 1) |
| 1405 |
< |
block_state.max_perip.value = $3; |
| 1405 |
> |
block_state.max_perip_global.value = $3; |
| 1406 |
|
}; |
| 1407 |
|
|
| 1408 |
|
class_connectfreq: CONNECTFREQ '=' timespec ';' |
| 1423 |
|
block_state.max_total.value = $3; |
| 1424 |
|
}; |
| 1425 |
|
|
| 1493 |
– |
class_max_global: MAX_GLOBAL '=' NUMBER ';' |
| 1494 |
– |
{ |
| 1495 |
– |
if (conf_parser_ctx.pass == 1) |
| 1496 |
– |
block_state.max_global.value = $3; |
| 1497 |
– |
}; |
| 1498 |
– |
|
| 1499 |
– |
class_max_local: MAX_LOCAL '=' NUMBER ';' |
| 1500 |
– |
{ |
| 1501 |
– |
if (conf_parser_ctx.pass == 1) |
| 1502 |
– |
block_state.max_local.value = $3; |
| 1503 |
– |
}; |
| 1504 |
– |
|
| 1426 |
|
class_sendq: SENDQ '=' sizespec ';' |
| 1427 |
|
{ |
| 1428 |
|
if (conf_parser_ctx.pass == 1) |
| 1793 |
|
if (conf_parser_ctx.pass != 2) |
| 1794 |
|
break; |
| 1795 |
|
|
| 1796 |
< |
if (valid_servname(yylval.string)) |
| 1796 |
> |
if (server_valid_name(yylval.string) == true) |
| 1797 |
|
{ |
| 1798 |
|
struct ServiceItem *service = service_make(); |
| 1799 |
|
service->name = xstrdup(yylval.string); |
| 2376 |
|
general_items: general_items general_item | general_item; |
| 2377 |
|
general_item: general_away_count | |
| 2378 |
|
general_away_time | |
| 2458 |
– |
general_ignore_bogus_ts | |
| 2379 |
|
general_failed_oper_notice | |
| 2380 |
|
general_anti_nick_flood | |
| 2381 |
|
general_max_nick_time | |
| 2405 |
|
general_caller_id_wait | |
| 2406 |
|
general_opers_bypass_callerid | |
| 2407 |
|
general_default_floodcount | |
| 2408 |
+ |
general_default_floodtime | |
| 2409 |
|
general_min_nonwildcard | |
| 2410 |
|
general_min_nonwildcard_simple | |
| 2411 |
|
general_throttle_count | |
| 2479 |
|
ConfigGeneral.kill_chase_time_limit = $3; |
| 2480 |
|
}; |
| 2481 |
|
|
| 2561 |
– |
general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';' |
| 2562 |
– |
{ |
| 2563 |
– |
ConfigGeneral.ignore_bogus_ts = yylval.number; |
| 2564 |
– |
}; |
| 2565 |
– |
|
| 2482 |
|
general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';' |
| 2483 |
|
{ |
| 2484 |
|
ConfigGeneral.failed_oper_notice = yylval.number; |
| 2788 |
|
ConfigGeneral.default_floodcount = $3; |
| 2789 |
|
}; |
| 2790 |
|
|
| 2791 |
+ |
general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';' |
| 2792 |
+ |
{ |
| 2793 |
+ |
ConfigGeneral.default_floodtime = $3; |
| 2794 |
+ |
}; |
| 2795 |
+ |
|
| 2796 |
|
|
| 2797 |
|
/*************************************************************************** |
| 2798 |
|
* channel {} section |
| 2801 |
|
|
| 2802 |
|
channel_items: channel_items channel_item | channel_item; |
| 2803 |
|
channel_item: channel_max_bans | |
| 2804 |
+ |
channel_max_bans_large | |
| 2805 |
|
channel_invite_client_count | |
| 2806 |
|
channel_invite_client_time | |
| 2807 |
|
channel_invite_delay_channel | |
| 2808 |
+ |
channel_invite_expire_time | |
| 2809 |
|
channel_knock_client_count | |
| 2810 |
|
channel_knock_client_time | |
| 2811 |
|
channel_knock_delay_channel | |
| 2812 |
|
channel_max_channels | |
| 2813 |
+ |
channel_max_invites | |
| 2814 |
|
channel_default_join_flood_count | |
| 2815 |
|
channel_default_join_flood_time | |
| 2816 |
|
channel_disable_fake_channels | |
| 2836 |
|
ConfigChannel.invite_delay_channel = $3; |
| 2837 |
|
}; |
| 2838 |
|
|
| 2839 |
+ |
channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';' |
| 2840 |
+ |
{ |
| 2841 |
+ |
ConfigChannel.invite_expire_time = $3; |
| 2842 |
+ |
}; |
| 2843 |
+ |
|
| 2844 |
|
channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';' |
| 2845 |
|
{ |
| 2846 |
|
ConfigChannel.knock_client_count = $3; |
| 2861 |
|
ConfigChannel.max_channels = $3; |
| 2862 |
|
}; |
| 2863 |
|
|
| 2864 |
+ |
channel_max_invites: MAX_INVITES '=' NUMBER ';' |
| 2865 |
+ |
{ |
| 2866 |
+ |
ConfigChannel.max_invites = $3; |
| 2867 |
+ |
}; |
| 2868 |
+ |
|
| 2869 |
|
channel_max_bans: MAX_BANS '=' NUMBER ';' |
| 2870 |
|
{ |
| 2871 |
|
ConfigChannel.max_bans = $3; |
| 2872 |
|
}; |
| 2873 |
|
|
| 2874 |
+ |
channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';' |
| 2875 |
+ |
{ |
| 2876 |
+ |
ConfigChannel.max_bans_large = $3; |
| 2877 |
+ |
}; |
| 2878 |
+ |
|
| 2879 |
|
channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';' |
| 2880 |
|
{ |
| 2881 |
|
ConfigChannel.default_join_flood_count = yylval.number; |