| 1 |
|
/* |
| 2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (c) 2000-2015 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 |
| 27 |
|
|
| 28 |
|
%{ |
| 29 |
|
|
| 30 |
– |
#include <sys/types.h> |
| 31 |
– |
#include <string.h> |
| 32 |
– |
|
| 30 |
|
#include "config.h" |
| 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" |
| 38 |
+ |
#include "conf_gecos.h" |
| 39 |
|
#include "conf_pseudo.h" |
| 40 |
+ |
#include "conf_resv.h" |
| 41 |
+ |
#include "conf_service.h" |
| 42 |
+ |
#include "conf_shared.h" |
| 43 |
|
#include "event.h" |
| 44 |
|
#include "id.h" |
| 45 |
|
#include "log.h" |
| 43 |
– |
#include "client.h" /* for UMODE_SERVNOTICE only */ |
| 46 |
|
#include "irc_string.h" |
| 47 |
|
#include "memory.h" |
| 48 |
|
#include "modules.h" |
| 49 |
|
#include "server.h" |
| 50 |
|
#include "hostmask.h" |
| 49 |
– |
#include "send.h" |
| 51 |
|
#include "listener.h" |
| 51 |
– |
#include "resv.h" |
| 52 |
– |
#include "numeric.h" |
| 52 |
|
#include "user.h" |
| 53 |
|
#include "motd.h" |
| 54 |
|
|
| 56 |
– |
#ifdef HAVE_LIBCRYPTO |
| 57 |
– |
#include <openssl/rsa.h> |
| 58 |
– |
#include <openssl/bio.h> |
| 59 |
– |
#include <openssl/pem.h> |
| 60 |
– |
#include <openssl/dh.h> |
| 61 |
– |
#endif |
| 62 |
– |
|
| 63 |
– |
#include "rsa.h" |
| 64 |
– |
|
| 55 |
|
int yylex(void); |
| 56 |
|
|
| 57 |
|
static struct |
| 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, |
| 111 |
– |
max_global, |
| 112 |
– |
max_local, |
| 113 |
– |
max_ident, |
| 102 |
|
max_sendq, |
| 103 |
|
max_recvq, |
| 104 |
|
max_channels, |
| 114 |
|
|
| 115 |
|
DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head) |
| 116 |
|
{ |
| 117 |
< |
MyFree(node->data); |
| 117 |
> |
xfree(node->data); |
| 118 |
|
dlinkDelete(node, &block_state.mask.list); |
| 119 |
|
free_dlink_node(node); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head) |
| 123 |
|
{ |
| 124 |
< |
MyFree(node->data); |
| 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 |
< |
MyFree(node->data); |
| 131 |
> |
xfree(node->data); |
| 132 |
|
dlinkDelete(node, &block_state.hub.list); |
| 133 |
|
free_dlink_node(node); |
| 134 |
|
} |
| 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 |
| 211 |
– |
%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 |
| 221 |
|
%token MASK |
| 222 |
|
%token MAX_ACCEPT |
| 223 |
|
%token MAX_BANS |
| 224 |
+ |
%token MAX_BANS_LARGE |
| 225 |
|
%token MAX_CHANNELS |
| 235 |
– |
%token MAX_GLOBAL |
| 236 |
– |
%token MAX_IDENT |
| 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 |
| 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 |
| 358 |
|
%token VHOST6 |
| 359 |
|
%token WARN_NO_CONNECT_BLOCK |
| 360 |
|
%token WHOIS |
| 361 |
+ |
%token WHOWAS_HISTORY_LENGTH |
| 362 |
|
%token XLINE |
| 363 |
|
%token XLINE_EXEMPT |
| 364 |
|
|
| 469 |
|
|
| 470 |
|
serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';' |
| 471 |
|
{ |
| 481 |
– |
#ifdef HAVE_LIBCRYPTO |
| 472 |
|
if (conf_parser_ctx.pass == 2) |
| 473 |
|
{ |
| 474 |
< |
if (!ConfigServerInfo.rsa_private_key_file) |
| 475 |
< |
{ |
| 486 |
< |
conf_error_report("No rsa_private_key_file specified, SSL disabled"); |
| 487 |
< |
break; |
| 488 |
< |
} |
| 489 |
< |
|
| 490 |
< |
if (SSL_CTX_use_certificate_chain_file(ConfigServerInfo.server_ctx, yylval.string) <= 0 || |
| 491 |
< |
SSL_CTX_use_certificate_chain_file(ConfigServerInfo.client_ctx, yylval.string) <= 0) |
| 492 |
< |
{ |
| 493 |
< |
report_crypto_errors(); |
| 494 |
< |
conf_error_report("Could not open/read certificate file"); |
| 495 |
< |
break; |
| 496 |
< |
} |
| 497 |
< |
|
| 498 |
< |
if (SSL_CTX_use_PrivateKey_file(ConfigServerInfo.server_ctx, ConfigServerInfo.rsa_private_key_file, |
| 499 |
< |
SSL_FILETYPE_PEM) <= 0 || |
| 500 |
< |
SSL_CTX_use_PrivateKey_file(ConfigServerInfo.client_ctx, ConfigServerInfo.rsa_private_key_file, |
| 501 |
< |
SSL_FILETYPE_PEM) <= 0) |
| 502 |
< |
{ |
| 503 |
< |
report_crypto_errors(); |
| 504 |
< |
conf_error_report("Could not read RSA private key"); |
| 505 |
< |
break; |
| 506 |
< |
} |
| 507 |
< |
|
| 508 |
< |
if (!SSL_CTX_check_private_key(ConfigServerInfo.server_ctx) || |
| 509 |
< |
!SSL_CTX_check_private_key(ConfigServerInfo.client_ctx)) |
| 510 |
< |
{ |
| 511 |
< |
report_crypto_errors(); |
| 512 |
< |
conf_error_report("Could not read RSA private key"); |
| 513 |
< |
break; |
| 514 |
< |
} |
| 474 |
> |
xfree(ConfigServerInfo.ssl_certificate_file); |
| 475 |
> |
ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string); |
| 476 |
|
} |
| 516 |
– |
#endif |
| 477 |
|
}; |
| 478 |
|
|
| 479 |
|
serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';' |
| 480 |
|
{ |
| 481 |
< |
#ifdef HAVE_LIBCRYPTO |
| 522 |
< |
BIO *file = NULL; |
| 523 |
< |
|
| 524 |
< |
if (conf_parser_ctx.pass != 1) |
| 525 |
< |
break; |
| 526 |
< |
|
| 527 |
< |
if (ConfigServerInfo.rsa_private_key) |
| 528 |
< |
{ |
| 529 |
< |
RSA_free(ConfigServerInfo.rsa_private_key); |
| 530 |
< |
ConfigServerInfo.rsa_private_key = NULL; |
| 531 |
< |
} |
| 532 |
< |
|
| 533 |
< |
if (ConfigServerInfo.rsa_private_key_file) |
| 534 |
< |
{ |
| 535 |
< |
MyFree(ConfigServerInfo.rsa_private_key_file); |
| 536 |
< |
ConfigServerInfo.rsa_private_key_file = NULL; |
| 537 |
< |
} |
| 538 |
< |
|
| 539 |
< |
ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string); |
| 540 |
< |
|
| 541 |
< |
if ((file = BIO_new_file(yylval.string, "r")) == NULL) |
| 542 |
< |
{ |
| 543 |
< |
conf_error_report("File open failed, ignoring"); |
| 544 |
< |
break; |
| 545 |
< |
} |
| 546 |
< |
|
| 547 |
< |
ConfigServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL); |
| 548 |
< |
|
| 549 |
< |
BIO_set_close(file, BIO_CLOSE); |
| 550 |
< |
BIO_free(file); |
| 551 |
< |
|
| 552 |
< |
if (ConfigServerInfo.rsa_private_key == NULL) |
| 553 |
< |
{ |
| 554 |
< |
conf_error_report("Couldn't extract key, ignoring"); |
| 555 |
< |
break; |
| 556 |
< |
} |
| 557 |
< |
|
| 558 |
< |
if (!RSA_check_key(ConfigServerInfo.rsa_private_key)) |
| 559 |
< |
{ |
| 560 |
< |
RSA_free(ConfigServerInfo.rsa_private_key); |
| 561 |
< |
ConfigServerInfo.rsa_private_key = NULL; |
| 562 |
< |
|
| 563 |
< |
conf_error_report("Invalid key, ignoring"); |
| 564 |
< |
break; |
| 565 |
< |
} |
| 566 |
< |
|
| 567 |
< |
if (RSA_size(ConfigServerInfo.rsa_private_key) < 128) |
| 481 |
> |
if (conf_parser_ctx.pass == 2) |
| 482 |
|
{ |
| 483 |
< |
RSA_free(ConfigServerInfo.rsa_private_key); |
| 484 |
< |
ConfigServerInfo.rsa_private_key = NULL; |
| 571 |
< |
|
| 572 |
< |
conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size"); |
| 483 |
> |
xfree(ConfigServerInfo.rsa_private_key_file); |
| 484 |
> |
ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string); |
| 485 |
|
} |
| 574 |
– |
#endif |
| 486 |
|
}; |
| 487 |
|
|
| 488 |
|
serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';' |
| 489 |
|
{ |
| 579 |
– |
#ifdef HAVE_LIBCRYPTO |
| 490 |
|
if (conf_parser_ctx.pass == 2) |
| 491 |
|
{ |
| 492 |
< |
BIO *file = BIO_new_file(yylval.string, "r"); |
| 493 |
< |
|
| 584 |
< |
if (file) |
| 585 |
< |
{ |
| 586 |
< |
DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL); |
| 587 |
< |
|
| 588 |
< |
BIO_free(file); |
| 589 |
< |
|
| 590 |
< |
if (dh) |
| 591 |
< |
{ |
| 592 |
< |
if (DH_size(dh) < 128) |
| 593 |
< |
conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size"); |
| 594 |
< |
else |
| 595 |
< |
SSL_CTX_set_tmp_dh(ConfigServerInfo.server_ctx, dh); |
| 596 |
< |
|
| 597 |
< |
DH_free(dh); |
| 598 |
< |
} |
| 599 |
< |
} |
| 600 |
< |
else |
| 601 |
< |
conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- could not open/read Diffie-Hellman parameter file"); |
| 492 |
> |
xfree(ConfigServerInfo.ssl_dh_param_file); |
| 493 |
> |
ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string); |
| 494 |
|
} |
| 603 |
– |
#endif |
| 495 |
|
}; |
| 496 |
|
|
| 497 |
|
serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';' |
| 498 |
|
{ |
| 608 |
– |
#ifdef HAVE_LIBCRYPTO |
| 499 |
|
if (conf_parser_ctx.pass == 2) |
| 500 |
< |
SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, yylval.string); |
| 501 |
< |
#endif |
| 500 |
> |
{ |
| 501 |
> |
xfree(ConfigServerInfo.ssl_cipher_list); |
| 502 |
> |
ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string); |
| 503 |
> |
} |
| 504 |
|
}; |
| 505 |
|
|
| 506 |
|
serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';' |
| 507 |
|
{ |
| 616 |
– |
#ifdef HAVE_LIBCRYPTO |
| 508 |
|
if (conf_parser_ctx.pass == 2) |
| 509 |
|
{ |
| 510 |
< |
if ((ConfigServerInfo.message_digest_algorithm = EVP_get_digestbyname(yylval.string)) == NULL) |
| 511 |
< |
{ |
| 621 |
< |
ConfigServerInfo.message_digest_algorithm = EVP_sha256(); |
| 622 |
< |
conf_error_report("Ignoring serverinfo::ssl_message_digest_algorithm -- unknown message digest algorithm"); |
| 623 |
< |
} |
| 510 |
> |
xfree(ConfigServerInfo.ssl_message_digest_algorithm); |
| 511 |
> |
ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string); |
| 512 |
|
} |
| 625 |
– |
#endif |
| 513 |
|
} |
| 514 |
|
|
| 515 |
|
serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';' |
| 516 |
|
{ |
| 630 |
– |
#ifdef HAVE_LIBCRYPTO |
| 631 |
– |
#if OPENSSL_VERSION_NUMBER >= 0x009080FFL && !defined(OPENSSL_NO_ECDH) |
| 632 |
– |
int nid = 0; |
| 633 |
– |
EC_KEY *key = NULL; |
| 634 |
– |
|
| 517 |
|
if (conf_parser_ctx.pass == 2) |
| 518 |
|
{ |
| 519 |
< |
if ((nid = OBJ_sn2nid(yylval.string)) == 0) |
| 520 |
< |
{ |
| 639 |
< |
conf_error_report("Ignoring serverinfo::ssl_dh_elliptic_curve -- unknown curve name"); |
| 640 |
< |
break; |
| 641 |
< |
} |
| 642 |
< |
|
| 643 |
< |
if ((key = EC_KEY_new_by_curve_name(nid)) == NULL) |
| 644 |
< |
{ |
| 645 |
< |
conf_error_report("Ignoring serverinfo::ssl_dh_elliptic_curve -- could not create curve"); |
| 646 |
< |
break; |
| 647 |
< |
} |
| 648 |
< |
|
| 649 |
< |
SSL_CTX_set_tmp_ecdh(ConfigServerInfo.server_ctx, key); |
| 650 |
< |
EC_KEY_free(key); |
| 519 |
> |
xfree(ConfigServerInfo.ssl_dh_elliptic_curve); |
| 520 |
> |
ConfigServerInfo.ssl_dh_elliptic_curve = xstrdup(yylval.string); |
| 521 |
|
} |
| 652 |
– |
#endif |
| 653 |
– |
#endif |
| 522 |
|
}; |
| 523 |
|
|
| 524 |
|
serverinfo_name: NAME '=' QSTRING ';' |
| 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 |
|
{ |
| 555 |
|
{ |
| 556 |
|
if (conf_parser_ctx.pass == 2) |
| 557 |
|
{ |
| 558 |
< |
MyFree(ConfigServerInfo.description); |
| 558 |
> |
xfree(ConfigServerInfo.description); |
| 559 |
|
ConfigServerInfo.description = xstrdup(yylval.string); |
| 560 |
|
strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info)); |
| 561 |
|
} |
| 570 |
|
if ((p = strchr(yylval.string, ' '))) |
| 571 |
|
*p = '\0'; |
| 572 |
|
|
| 573 |
< |
MyFree(ConfigServerInfo.network_name); |
| 573 |
> |
xfree(ConfigServerInfo.network_name); |
| 574 |
|
ConfigServerInfo.network_name = xstrdup(yylval.string); |
| 575 |
|
} |
| 576 |
|
}; |
| 580 |
|
if (conf_parser_ctx.pass != 2) |
| 581 |
|
break; |
| 582 |
|
|
| 583 |
< |
MyFree(ConfigServerInfo.network_desc); |
| 583 |
> |
xfree(ConfigServerInfo.network_desc); |
| 584 |
|
ConfigServerInfo.network_desc = xstrdup(yylval.string); |
| 585 |
|
}; |
| 586 |
|
|
| 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 |
< |
|
| 784 |
< |
snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN); |
| 785 |
< |
conf_error_report(buf); |
| 786 |
< |
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 |
|
} |
| 729 |
|
if (conf_parser_ctx.pass != 2) |
| 730 |
|
break; |
| 731 |
|
|
| 732 |
< |
MyFree(ConfigAdminInfo.name); |
| 732 |
> |
xfree(ConfigAdminInfo.name); |
| 733 |
|
ConfigAdminInfo.name = xstrdup(yylval.string); |
| 734 |
|
}; |
| 735 |
|
|
| 738 |
|
if (conf_parser_ctx.pass != 2) |
| 739 |
|
break; |
| 740 |
|
|
| 741 |
< |
MyFree(ConfigAdminInfo.email); |
| 741 |
> |
xfree(ConfigAdminInfo.email); |
| 742 |
|
ConfigAdminInfo.email = xstrdup(yylval.string); |
| 743 |
|
}; |
| 744 |
|
|
| 747 |
|
if (conf_parser_ctx.pass != 2) |
| 748 |
|
break; |
| 749 |
|
|
| 750 |
< |
MyFree(ConfigAdminInfo.description); |
| 750 |
> |
xfree(ConfigAdminInfo.description); |
| 751 |
|
ConfigAdminInfo.description = xstrdup(yylval.string); |
| 752 |
|
}; |
| 753 |
|
|
| 971 |
|
{ |
| 972 |
|
struct MaskItem *conf = NULL; |
| 973 |
|
struct split_nuh_item nuh; |
| 974 |
+ |
char *s = node->data; |
| 975 |
|
|
| 976 |
< |
nuh.nuhmask = node->data; |
| 976 |
> |
if (EmptyString(s)) |
| 977 |
> |
continue; |
| 978 |
> |
|
| 979 |
> |
nuh.nuhmask = s; |
| 980 |
|
nuh.nickptr = NULL; |
| 981 |
|
nuh.userptr = block_state.user.buf; |
| 982 |
|
nuh.hostptr = block_state.host.buf; |
| 1239 |
|
{ |
| 1240 |
|
if (conf_parser_ctx.pass == 2) |
| 1241 |
|
block_state.port.value |= OPER_FLAG_RESTART; |
| 1242 |
+ |
} | REHASH ':' REMOTE |
| 1243 |
+ |
{ |
| 1244 |
+ |
if (conf_parser_ctx.pass == 2) |
| 1245 |
+ |
block_state.port.value |= OPER_FLAG_REHASH_REMOTE; |
| 1246 |
|
} | REHASH |
| 1247 |
|
{ |
| 1248 |
|
if (conf_parser_ctx.pass == 2) |
| 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 |
< |
MyFree(class->name); |
| 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; |
| 1467 |
– |
class->max_global = block_state.max_global.value; |
| 1468 |
– |
class->max_local = block_state.max_local.value; |
| 1469 |
– |
class->max_ident = block_state.max_ident.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 | |
| 1377 |
< |
class_max_global | |
| 1378 |
< |
class_max_local | |
| 1504 |
< |
class_max_ident | |
| 1505 |
< |
class_sendq | class_recvq | |
| 1377 |
> |
class_sendq | |
| 1378 |
> |
class_recvq | |
| 1379 |
|
class_min_idle | |
| 1380 |
|
class_max_idle | |
| 1381 |
|
class_flags | |
| 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 |
|
|
| 1547 |
– |
class_max_global: MAX_GLOBAL '=' NUMBER ';' |
| 1548 |
– |
{ |
| 1549 |
– |
if (conf_parser_ctx.pass == 1) |
| 1550 |
– |
block_state.max_global.value = $3; |
| 1551 |
– |
}; |
| 1552 |
– |
|
| 1553 |
– |
class_max_local: MAX_LOCAL '=' NUMBER ';' |
| 1554 |
– |
{ |
| 1555 |
– |
if (conf_parser_ctx.pass == 1) |
| 1556 |
– |
block_state.max_local.value = $3; |
| 1557 |
– |
}; |
| 1558 |
– |
|
| 1559 |
– |
class_max_ident: MAX_IDENT '=' NUMBER ';' |
| 1560 |
– |
{ |
| 1561 |
– |
if (conf_parser_ctx.pass == 1) |
| 1562 |
– |
block_state.max_ident.value = $3; |
| 1563 |
– |
}; |
| 1564 |
– |
|
| 1426 |
|
class_sendq: SENDQ '=' sizespec ';' |
| 1427 |
|
{ |
| 1428 |
|
if (conf_parser_ctx.pass == 1) |
| 1530 |
|
{ |
| 1531 |
|
if (conf_parser_ctx.pass == 2) |
| 1532 |
|
{ |
| 1533 |
< |
#ifndef HAVE_LIBCRYPTO |
| 1533 |
> |
#ifndef HAVE_TLS |
| 1534 |
|
if (block_state.flags.value & LISTENER_SSL) |
| 1535 |
|
{ |
| 1536 |
< |
conf_error_report("SSL not available - port closed"); |
| 1536 |
> |
conf_error_report("TLS not available - port closed"); |
| 1537 |
|
break; |
| 1538 |
|
} |
| 1539 |
|
#endif |
| 1543 |
|
{ |
| 1544 |
|
if (conf_parser_ctx.pass == 2) |
| 1545 |
|
{ |
| 1546 |
< |
#ifndef HAVE_LIBCRYPTO |
| 1546 |
> |
#ifndef HAVE_TLS |
| 1547 |
|
if (block_state.flags.value & LISTENER_SSL) |
| 1548 |
|
{ |
| 1549 |
< |
conf_error_report("SSL not available - port closed"); |
| 1549 |
> |
conf_error_report("TLS not available - port closed"); |
| 1550 |
|
break; |
| 1551 |
|
} |
| 1552 |
|
#endif |
| 1587 |
|
{ |
| 1588 |
|
struct MaskItem *conf = NULL; |
| 1589 |
|
struct split_nuh_item nuh; |
| 1590 |
+ |
char *s = node->data; |
| 1591 |
+ |
|
| 1592 |
+ |
if (EmptyString(s)) |
| 1593 |
+ |
continue; |
| 1594 |
|
|
| 1595 |
< |
nuh.nuhmask = node->data; |
| 1595 |
> |
nuh.nuhmask = s; |
| 1596 |
|
nuh.nickptr = NULL; |
| 1597 |
|
nuh.userptr = block_state.user.buf; |
| 1598 |
|
nuh.hostptr = block_state.host.buf; |
| 1755 |
|
if (conf_parser_ctx.pass != 2) |
| 1756 |
|
break; |
| 1757 |
|
|
| 1758 |
< |
create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list); |
| 1758 |
> |
resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list); |
| 1759 |
|
}; |
| 1760 |
|
|
| 1761 |
|
resv_items: resv_items resv_item | resv_item; |
| 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 MaskItem *conf = conf_make(CONF_SERVICE); |
| 1799 |
< |
conf->name = xstrdup(yylval.string); |
| 1798 |
> |
struct ServiceItem *service = service_make(); |
| 1799 |
> |
service->name = xstrdup(yylval.string); |
| 1800 |
|
} |
| 1801 |
|
}; |
| 1802 |
|
|
| 1817 |
|
block_state.flags.value = SHARED_ALL; |
| 1818 |
|
} '{' shared_items '}' ';' |
| 1819 |
|
{ |
| 1955 |
– |
struct MaskItem *conf = NULL; |
| 1956 |
– |
|
| 1820 |
|
if (conf_parser_ctx.pass != 2) |
| 1821 |
|
break; |
| 1822 |
|
|
| 1823 |
< |
conf = conf_make(CONF_SHARED); |
| 1824 |
< |
conf->flags = block_state.flags.value; |
| 1825 |
< |
conf->name = xstrdup(block_state.name.buf); |
| 1826 |
< |
conf->user = xstrdup(block_state.user.buf); |
| 1827 |
< |
conf->host = xstrdup(block_state.host.buf); |
| 1823 |
> |
struct SharedItem *shared = shared_make(); |
| 1824 |
> |
shared->type = block_state.flags.value; |
| 1825 |
> |
shared->server = xstrdup(block_state.name.buf); |
| 1826 |
> |
shared->user = xstrdup(block_state.user.buf); |
| 1827 |
> |
shared->host = xstrdup(block_state.host.buf); |
| 1828 |
|
}; |
| 1829 |
|
|
| 1830 |
|
shared_items: shared_items shared_item | shared_item; |
| 1916 |
|
reset_block_state(); |
| 1917 |
|
|
| 1918 |
|
strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf)); |
| 1919 |
< |
block_state.flags.value = SHARED_ALL; |
| 1919 |
> |
block_state.flags.value = CLUSTER_ALL; |
| 1920 |
|
} '{' cluster_items '}' ';' |
| 1921 |
|
{ |
| 2059 |
– |
struct MaskItem *conf = NULL; |
| 2060 |
– |
|
| 1922 |
|
if (conf_parser_ctx.pass != 2) |
| 1923 |
|
break; |
| 1924 |
|
|
| 1925 |
< |
conf = conf_make(CONF_CLUSTER); |
| 1926 |
< |
conf->flags = block_state.flags.value; |
| 1927 |
< |
conf->name = xstrdup(block_state.name.buf); |
| 1925 |
> |
struct ClusterItem *cluster = cluster_make(); |
| 1926 |
> |
cluster->type = block_state.flags.value; |
| 1927 |
> |
cluster->server = xstrdup(block_state.name.buf); |
| 1928 |
|
}; |
| 1929 |
|
|
| 1930 |
|
cluster_items: cluster_items cluster_item | cluster_item; |
| 1946 |
|
cluster_type_item: KLINE |
| 1947 |
|
{ |
| 1948 |
|
if (conf_parser_ctx.pass == 2) |
| 1949 |
< |
block_state.flags.value |= SHARED_KLINE; |
| 1949 |
> |
block_state.flags.value |= CLUSTER_KLINE; |
| 1950 |
|
} | UNKLINE |
| 1951 |
|
{ |
| 1952 |
|
if (conf_parser_ctx.pass == 2) |
| 1953 |
< |
block_state.flags.value |= SHARED_UNKLINE; |
| 1953 |
> |
block_state.flags.value |= CLUSTER_UNKLINE; |
| 1954 |
|
} | T_DLINE |
| 1955 |
|
{ |
| 1956 |
|
if (conf_parser_ctx.pass == 2) |
| 1957 |
< |
block_state.flags.value |= SHARED_DLINE; |
| 1957 |
> |
block_state.flags.value |= CLUSTER_DLINE; |
| 1958 |
|
} | T_UNDLINE |
| 1959 |
|
{ |
| 1960 |
|
if (conf_parser_ctx.pass == 2) |
| 1961 |
< |
block_state.flags.value |= SHARED_UNDLINE; |
| 1961 |
> |
block_state.flags.value |= CLUSTER_UNDLINE; |
| 1962 |
|
} | XLINE |
| 1963 |
|
{ |
| 1964 |
|
if (conf_parser_ctx.pass == 2) |
| 1965 |
< |
block_state.flags.value |= SHARED_XLINE; |
| 1965 |
> |
block_state.flags.value |= CLUSTER_XLINE; |
| 1966 |
|
} | T_UNXLINE |
| 1967 |
|
{ |
| 1968 |
|
if (conf_parser_ctx.pass == 2) |
| 1969 |
< |
block_state.flags.value |= SHARED_UNXLINE; |
| 1969 |
> |
block_state.flags.value |= CLUSTER_UNXLINE; |
| 1970 |
|
} | RESV |
| 1971 |
|
{ |
| 1972 |
|
if (conf_parser_ctx.pass == 2) |
| 1973 |
< |
block_state.flags.value |= SHARED_RESV; |
| 1973 |
> |
block_state.flags.value |= CLUSTER_RESV; |
| 1974 |
|
} | T_UNRESV |
| 1975 |
|
{ |
| 1976 |
|
if (conf_parser_ctx.pass == 2) |
| 1977 |
< |
block_state.flags.value |= SHARED_UNRESV; |
| 1977 |
> |
block_state.flags.value |= CLUSTER_UNRESV; |
| 1978 |
|
} | T_LOCOPS |
| 1979 |
|
{ |
| 1980 |
|
if (conf_parser_ctx.pass == 2) |
| 1981 |
< |
block_state.flags.value |= SHARED_LOCOPS; |
| 1981 |
> |
block_state.flags.value |= CLUSTER_LOCOPS; |
| 1982 |
|
} | T_ALL |
| 1983 |
|
{ |
| 1984 |
|
if (conf_parser_ctx.pass == 2) |
| 1985 |
< |
block_state.flags.value = SHARED_ALL; |
| 1985 |
> |
block_state.flags.value = CLUSTER_ALL; |
| 1986 |
|
}; |
| 1987 |
|
|
| 1988 |
|
|
| 2191 |
|
|
| 2192 |
|
connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';' |
| 2193 |
|
{ |
| 2194 |
< |
#ifdef HAVE_LIBCRYPTO |
| 2194 |
> |
#ifdef HAVE_TLS |
| 2195 |
|
if (conf_parser_ctx.pass == 2) |
| 2196 |
|
strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf)); |
| 2197 |
|
#else |
| 2198 |
|
if (conf_parser_ctx.pass == 2) |
| 2199 |
< |
conf_error_report("Ignoring connect::ciphers -- no OpenSSL support"); |
| 2199 |
> |
conf_error_report("Ignoring connect::ciphers -- no TLS support"); |
| 2200 |
|
#endif |
| 2201 |
|
}; |
| 2202 |
|
|
| 2337 |
|
reset_block_state(); |
| 2338 |
|
} '{' gecos_items '}' ';' |
| 2339 |
|
{ |
| 2479 |
– |
struct MaskItem *conf = NULL; |
| 2480 |
– |
|
| 2340 |
|
if (conf_parser_ctx.pass != 2) |
| 2341 |
|
break; |
| 2342 |
|
|
| 2343 |
|
if (!block_state.name.buf[0]) |
| 2344 |
|
break; |
| 2345 |
|
|
| 2346 |
< |
conf = conf_make(CONF_XLINE); |
| 2347 |
< |
conf->name = xstrdup(block_state.name.buf); |
| 2346 |
> |
struct GecosItem *gecos = gecos_make(); |
| 2347 |
> |
gecos->mask = xstrdup(block_state.name.buf); |
| 2348 |
|
|
| 2349 |
|
if (block_state.rpass.buf[0]) |
| 2350 |
< |
conf->reason = xstrdup(block_state.rpass.buf); |
| 2350 |
> |
gecos->reason = xstrdup(block_state.rpass.buf); |
| 2351 |
|
else |
| 2352 |
< |
conf->reason = xstrdup(CONF_NOREASON); |
| 2352 |
> |
gecos->reason = xstrdup(CONF_NOREASON); |
| 2353 |
|
}; |
| 2354 |
|
|
| 2355 |
|
gecos_items: gecos_items gecos_item | gecos_item; |
| 2376 |
|
general_items: general_items general_item | general_item; |
| 2377 |
|
general_item: general_away_count | |
| 2378 |
|
general_away_time | |
| 2520 |
– |
general_ignore_bogus_ts | |
| 2379 |
|
general_failed_oper_notice | |
| 2380 |
|
general_anti_nick_flood | |
| 2381 |
|
general_max_nick_time | |
| 2382 |
|
general_max_nick_changes | |
| 2383 |
|
general_max_accept | |
| 2384 |
+ |
general_whowas_history_length | |
| 2385 |
|
general_anti_spam_exit_message_time | |
| 2386 |
|
general_ts_warn_delta | |
| 2387 |
|
general_ts_max_delta | |
| 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 | |
| 2438 |
|
ConfigGeneral.max_watch = $3; |
| 2439 |
|
}; |
| 2440 |
|
|
| 2441 |
+ |
general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';' |
| 2442 |
+ |
{ |
| 2443 |
+ |
ConfigGeneral.whowas_history_length = $3; |
| 2444 |
+ |
}; |
| 2445 |
+ |
|
| 2446 |
|
general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';' |
| 2447 |
|
{ |
| 2448 |
|
if (conf_parser_ctx.pass == 2) |
| 2479 |
|
ConfigGeneral.kill_chase_time_limit = $3; |
| 2480 |
|
}; |
| 2481 |
|
|
| 2617 |
– |
general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';' |
| 2618 |
– |
{ |
| 2619 |
– |
ConfigGeneral.ignore_bogus_ts = yylval.number; |
| 2620 |
– |
}; |
| 2621 |
– |
|
| 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 | |
| 2831 |
|
ConfigChannel.invite_client_time = $3; |
| 2832 |
|
}; |
| 2833 |
|
|
| 2834 |
+ |
channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';' |
| 2835 |
+ |
{ |
| 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; |
| 2930 |
|
{ |
| 2931 |
|
if (conf_parser_ctx.pass == 2) |
| 2932 |
|
{ |
| 2933 |
< |
MyFree(ConfigServerHide.flatten_links_file); |
| 2933 |
> |
xfree(ConfigServerHide.flatten_links_file); |
| 2934 |
|
ConfigServerHide.flatten_links_file = xstrdup(yylval.string); |
| 2935 |
|
} |
| 2936 |
|
}; |
| 2957 |
|
{ |
| 2958 |
|
if (conf_parser_ctx.pass == 2) |
| 2959 |
|
{ |
| 2960 |
< |
MyFree(ConfigServerHide.hidden_name); |
| 2960 |
> |
xfree(ConfigServerHide.hidden_name); |
| 2961 |
|
ConfigServerHide.hidden_name = xstrdup(yylval.string); |
| 2962 |
|
} |
| 2963 |
|
}; |