--- ircd-hybrid/trunk/src/conf_parser.y 2014/06/09 17:56:42 3933 +++ ircd-hybrid/trunk/src/conf_parser.y 2016/06/23 12:44:09 7624 @@ -1,7 +1,7 @@ /* * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) * - * Copyright (c) 2000-2014 ircd-hybrid development team + * Copyright (c) 2000-2016 ircd-hybrid development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA */ @@ -27,40 +27,30 @@ %{ -#define YY_NO_UNPUT -#include -#include - #include "config.h" #include "stdinc.h" #include "ircd.h" #include "list.h" #include "conf.h" #include "conf_class.h" +#include "conf_cluster.h" +#include "conf_gecos.h" +#include "conf_pseudo.h" +#include "conf_resv.h" +#include "conf_service.h" +#include "conf_shared.h" #include "event.h" +#include "id.h" #include "log.h" -#include "client.h" /* for UMODE_ALL only */ #include "irc_string.h" #include "memory.h" #include "modules.h" #include "server.h" #include "hostmask.h" -#include "send.h" #include "listener.h" -#include "resv.h" -#include "numeric.h" #include "user.h" #include "motd.h" -#ifdef HAVE_LIBCRYPTO -#include -#include -#include -#include -#endif - -#include "rsa.h" - int yylex(void); static struct @@ -76,6 +66,7 @@ static struct { char buf[IRCD_BUFSIZE]; } name, + nick, user, host, addr, @@ -85,7 +76,11 @@ static struct cert, rpass, spass, - class; + whois, + class, + target, + prepend, + command; struct { @@ -104,7 +99,6 @@ static struct max_total, max_global, max_local, - max_ident, max_sendq, max_recvq, max_channels, @@ -116,27 +110,27 @@ static struct static void reset_block_state(void) { - dlink_node *ptr = NULL, *ptr_next = NULL; + dlink_node *node = NULL, *node_next = NULL; - DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.mask.list.head) + DLINK_FOREACH_SAFE(node, node_next, block_state.mask.list.head) { - MyFree(ptr->data); - dlinkDelete(ptr, &block_state.mask.list); - free_dlink_node(ptr); + xfree(node->data); + dlinkDelete(node, &block_state.mask.list); + free_dlink_node(node); } - DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.leaf.list.head) + DLINK_FOREACH_SAFE(node, node_next, block_state.leaf.list.head) { - MyFree(ptr->data); - dlinkDelete(ptr, &block_state.leaf.list); - free_dlink_node(ptr); + xfree(node->data); + dlinkDelete(node, &block_state.leaf.list); + free_dlink_node(node); } - DLINK_FOREACH_SAFE(ptr, ptr_next, block_state.hub.list.head) + DLINK_FOREACH_SAFE(node, node_next, block_state.hub.list.head) { - MyFree(ptr->data); - dlinkDelete(ptr, &block_state.hub.list); - free_dlink_node(ptr); + xfree(node->data); + dlinkDelete(node, &block_state.hub.list); + free_dlink_node(node); } memset(&block_state, 0, sizeof(block_state)); @@ -155,44 +149,43 @@ reset_block_state(void) %token ANTI_NICK_FLOOD %token ANTI_SPAM_EXIT_MESSAGE_TIME %token AUTOCONN +%token AWAY_COUNT +%token AWAY_TIME %token BYTES KBYTES MBYTES %token CALLER_ID_WAIT %token CAN_FLOOD %token CHANNEL +%token CHECK_CACHE %token CIDR_BITLEN_IPV4 %token CIDR_BITLEN_IPV6 %token CLASS +%token CLOSE %token CONNECT %token CONNECTFREQ %token CYCLE_ON_HOST_CHANGE %token DEFAULT_FLOODCOUNT -%token DEFAULT_SPLIT_SERVER_COUNT -%token DEFAULT_SPLIT_USER_COUNT +%token DEFAULT_JOIN_FLOOD_COUNT +%token DEFAULT_JOIN_FLOOD_TIME +%token DEFAULT_MAX_CLIENTS %token DENY %token DESCRIPTION %token DIE %token DISABLE_AUTH %token DISABLE_FAKE_CHANNELS %token DISABLE_REMOTE_COMMANDS +%token DLINE_MIN_CIDR +%token DLINE_MIN_CIDR6 %token DOTS_IN_IDENT -%token EGDPOOL_PATH %token EMAIL %token ENCRYPTED %token EXCEED_LIMIT %token EXEMPT %token FAILED_OPER_NOTICE %token FLATTEN_LINKS +%token FLATTEN_LINKS_DELAY +%token FLATTEN_LINKS_FILE %token GECOS %token GENERAL -%token GLINE -%token GLINE_DURATION -%token GLINE_ENABLE -%token GLINE_EXEMPT -%token GLINE_MIN_CIDR -%token GLINE_MIN_CIDR6 -%token GLINE_REQUEST_DURATION -%token GLOBAL_KILL -%token HAVENT_READ_CONF %token HIDDEN %token HIDDEN_NAME %token HIDE_CHANS @@ -201,7 +194,6 @@ reset_block_state(void) %token HIDE_SERVER_IPS %token HIDE_SERVERS %token HIDE_SERVICES -%token HIDE_SPOOF_IPS %token HOST %token HUB %token HUB_MASK @@ -209,28 +201,31 @@ reset_block_state(void) %token INVISIBLE_ON_CONNECT %token INVITE_CLIENT_COUNT %token INVITE_CLIENT_TIME +%token INVITE_DELAY_CHANNEL %token IP %token IRCD_AUTH %token IRCD_FLAGS %token IRCD_SID -%token JOIN_FLOOD_COUNT -%token JOIN_FLOOD_TIME +%token JOIN %token KILL %token KILL_CHASE_TIME_LIMIT %token KLINE %token KLINE_EXEMPT +%token KLINE_MIN_CIDR +%token KLINE_MIN_CIDR6 %token KNOCK_CLIENT_COUNT %token KNOCK_CLIENT_TIME %token KNOCK_DELAY_CHANNEL %token LEAF_MASK -%token LINKS_DELAY +%token LIBGEOIP_DATABASE_OPTIONS +%token LIBGEOIP_IPV4_DATABASE_FILE +%token LIBGEOIP_IPV6_DATABASE_FILE %token LISTEN %token MASK %token MAX_ACCEPT %token MAX_BANS %token MAX_CHANNELS %token MAX_GLOBAL -%token MAX_IDENT %token MAX_IDLE %token MAX_LOCAL %token MAX_NICK_CHANGES @@ -240,9 +235,11 @@ reset_block_state(void) %token MAX_TARGETS %token MAX_TOPIC_LENGTH %token MAX_WATCH +%token MEMORY_CACHE %token MIN_IDLE %token MIN_NONWILDCARD %token MIN_NONWILDCARD_SIMPLE +%token MMAP_CACHE %token MODULE %token MODULES %token MOTD @@ -252,15 +249,12 @@ reset_block_state(void) %token NETWORK_DESC %token NETWORK_NAME %token NICK -%token NO_CREATE_ON_SPLIT -%token NO_JOIN_ON_SPLIT %token NO_OPER_FLOOD %token NO_TILDE %token NUMBER %token NUMBER_PER_CIDR %token NUMBER_PER_IP %token OPER_ONLY_UMODES -%token OPER_PASS_RESV %token OPER_UMODES %token OPERATOR %token OPERS_BYPASS_CALLERID @@ -282,7 +276,6 @@ reset_block_state(void) %token RESV %token RESV_EXEMPT %token RSA_PRIVATE_KEY_FILE -%token RSA_PUBLIC_KEY_FILE %token SECONDS MINUTES HOURS DAYS WEEKS MONTHS YEARS %token SEND_PASSWORD %token SENDQ @@ -295,10 +288,14 @@ reset_block_state(void) %token SSL_CERTIFICATE_FILE %token SSL_CERTIFICATE_FINGERPRINT %token SSL_CONNECTION_REQUIRED +%token SSL_DH_ELLIPTIC_CURVE %token SSL_DH_PARAM_FILE +%token SSL_MESSAGE_DIGEST_ALGORITHM +%token STANDARD %token STATS_E_DISABLED %token STATS_I_OPER_ONLY %token STATS_K_OPER_ONLY +%token STATS_M_OPER_ONLY %token STATS_O_OPER_ONLY %token STATS_P_OPER_ONLY %token STATS_U_OPER_ONLY @@ -306,6 +303,7 @@ reset_block_state(void) %token T_BOTS %token T_CALLERID %token T_CCONN +%token T_COMMAND %token T_CLUSTER %token T_DEAF %token T_DEBUG @@ -320,15 +318,16 @@ reset_block_state(void) %token T_IPV6 %token T_LOCOPS %token T_LOG -%token T_MAX_CLIENTS %token T_NCHANGE %token T_NONONREG +%token T_OPME +%token T_PREPEND +%token T_PSEUDO %token T_RECVQ %token T_REJ %token T_RESTART %token T_SERVER %token T_SERVICE -%token T_SERVICES_NAME %token T_SERVNOTICE %token T_SET %token T_SHARED @@ -338,10 +337,7 @@ reset_block_state(void) %token T_SPY %token T_SSL %token T_SSL_CIPHER_LIST -%token T_SSL_CLIENT_METHOD -%token T_SSL_SERVER_METHOD -%token T_SSLV3 -%token T_TLSV1 +%token T_TARGET %token T_UMODES %token T_UNAUTH %token T_UNDLINE @@ -356,19 +352,20 @@ reset_block_state(void) %token THROTTLE_TIME %token TKLINE_EXPIRE_NOTICES %token TMASKED -%token TRUE_NO_OPER_FLOOD %token TS_MAX_DELTA %token TS_WARN_DELTA %token TWODOTS %token TYPE %token UNKLINE -%token USE_EGD %token USE_LOGGING %token USER %token VHOST %token VHOST6 %token WARN_NO_CONNECT_BLOCK +%token WHOIS +%token WHOWAS_HISTORY_LENGTH %token XLINE +%token XLINE_EXEMPT %type QSTRING %type NUMBER @@ -403,6 +400,7 @@ conf_item: admin_entry | gecos_entry | modules_entry | motd_entry + | pseudo_entry | error ';' | error '}' ; @@ -428,10 +426,9 @@ sizespec: NUMBER sizespec_ { $$ = $1 + /*************************************************************************** - * section modules + * modules {} section ***************************************************************************/ -modules_entry: MODULES - '{' modules_items '}' ';'; +modules_entry: MODULES '{' modules_items '}' ';'; modules_items: modules_items modules_item | modules_item; modules_item: modules_module | modules_path | error ';' ; @@ -449,6 +446,9 @@ modules_path: PATH '=' QSTRING ';' }; +/*************************************************************************** + * serverinfo {} section + ***************************************************************************/ serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';'; serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ; @@ -458,215 +458,166 @@ serverinfo_item: serverinfo_name serverinfo_description | serverinfo_network_name | serverinfo_network_desc | - serverinfo_max_clients | + serverinfo_default_max_clients | serverinfo_max_nick_length | serverinfo_max_topic_length | serverinfo_ssl_dh_param_file | + serverinfo_ssl_dh_elliptic_curve | serverinfo_rsa_private_key_file | serverinfo_vhost6 | serverinfo_sid | serverinfo_ssl_certificate_file | - serverinfo_ssl_client_method | - serverinfo_ssl_server_method | serverinfo_ssl_cipher_list | + serverinfo_ssl_message_digest_algorithm | + serverinfo_libgeoip_database_options | + serverinfo_libgeoip_ipv4_database_file | + serverinfo_libgeoip_ipv6_database_file | error ';' ; -serverinfo_ssl_client_method: T_SSL_CLIENT_METHOD '=' client_method_types ';' ; -serverinfo_ssl_server_method: T_SSL_SERVER_METHOD '=' server_method_types ';' ; - -client_method_types: client_method_types ',' client_method_type_item | client_method_type_item; -client_method_type_item: T_SSLV3 -{ -#ifdef HAVE_LIBCRYPTO - if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx) - SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv3); -#endif -} | T_TLSV1 -{ -#ifdef HAVE_LIBCRYPTO - if (conf_parser_ctx.pass == 2 && ServerInfo.client_ctx) - SSL_CTX_clear_options(ServerInfo.client_ctx, SSL_OP_NO_TLSv1); -#endif -}; - -server_method_types: server_method_types ',' server_method_type_item | server_method_type_item; -server_method_type_item: T_SSLV3 -{ -#ifdef HAVE_LIBCRYPTO - if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) - SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv3); -#endif -} | T_TLSV1 -{ -#ifdef HAVE_LIBCRYPTO - if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) - SSL_CTX_clear_options(ServerInfo.server_ctx, SSL_OP_NO_TLSv1); -#endif -}; - serverinfo_ssl_certificate_file: SSL_CERTIFICATE_FILE '=' QSTRING ';' { -#ifdef HAVE_LIBCRYPTO - if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) + if (conf_parser_ctx.pass == 2) { - if (!ServerInfo.rsa_private_key_file) - { - conf_error_report("No rsa_private_key_file specified, SSL disabled"); - break; - } - - if (SSL_CTX_use_certificate_file(ServerInfo.server_ctx, yylval.string, - SSL_FILETYPE_PEM) <= 0 || - SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string, - SSL_FILETYPE_PEM) <= 0) - { - report_crypto_errors(); - conf_error_report("Could not open/read certificate file"); - break; - } - - if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file, - SSL_FILETYPE_PEM) <= 0 || - SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file, - SSL_FILETYPE_PEM) <= 0) - { - report_crypto_errors(); - conf_error_report("Could not read RSA private key"); - break; - } - - if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) || - !SSL_CTX_check_private_key(ServerInfo.client_ctx)) - { - report_crypto_errors(); - conf_error_report("Could not read RSA private key"); - break; - } + xfree(ConfigServerInfo.ssl_certificate_file); + ConfigServerInfo.ssl_certificate_file = xstrdup(yylval.string); } -#endif }; serverinfo_rsa_private_key_file: RSA_PRIVATE_KEY_FILE '=' QSTRING ';' { -#ifdef HAVE_LIBCRYPTO - BIO *file = NULL; - - if (conf_parser_ctx.pass != 1) - break; - - if (ServerInfo.rsa_private_key) + if (conf_parser_ctx.pass == 2) { - RSA_free(ServerInfo.rsa_private_key); - ServerInfo.rsa_private_key = NULL; + xfree(ConfigServerInfo.rsa_private_key_file); + ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string); } +}; - if (ServerInfo.rsa_private_key_file) +serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) { - MyFree(ServerInfo.rsa_private_key_file); - ServerInfo.rsa_private_key_file = NULL; + xfree(ConfigServerInfo.ssl_dh_param_file); + ConfigServerInfo.ssl_dh_param_file = xstrdup(yylval.string); } +}; - ServerInfo.rsa_private_key_file = xstrdup(yylval.string); - - if ((file = BIO_new_file(yylval.string, "r")) == NULL) +serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) { - conf_error_report("File open failed, ignoring"); - break; + xfree(ConfigServerInfo.ssl_cipher_list); + ConfigServerInfo.ssl_cipher_list = xstrdup(yylval.string); } +}; - ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL); - - BIO_set_close(file, BIO_CLOSE); - BIO_free(file); - - if (ServerInfo.rsa_private_key == NULL) +serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) { - conf_error_report("Couldn't extract key, ignoring"); - break; + xfree(ConfigServerInfo.ssl_message_digest_algorithm); + ConfigServerInfo.ssl_message_digest_algorithm = xstrdup(yylval.string); } +} - if (!RSA_check_key(ServerInfo.rsa_private_key)) +serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) { - RSA_free(ServerInfo.rsa_private_key); - ServerInfo.rsa_private_key = NULL; - - conf_error_report("Invalid key, ignoring"); - break; + xfree(ConfigServerInfo.ssl_dh_elliptic_curve); + ConfigServerInfo.ssl_dh_elliptic_curve = xstrdup(yylval.string); } +}; - if (RSA_size(ServerInfo.rsa_private_key) < 128) - { - RSA_free(ServerInfo.rsa_private_key); - ServerInfo.rsa_private_key = NULL; +serverinfo_libgeoip_database_options: LIBGEOIP_DATABASE_OPTIONS +{ + if (conf_parser_ctx.pass == 1) + ConfigServerInfo.libgeoip_database_options = 0; +} '=' options_items ';'; - conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size"); - } +options_items: options_items ',' options_item | options_item; +options_item: STANDARD +{ +#ifdef HAVE_LIBGEOIP + if (conf_parser_ctx.pass == 1) + ConfigServerInfo.libgeoip_database_options |= GEOIP_STANDARD; +#endif +} | MEMORY_CACHE +{ +#ifdef HAVE_LIBGEOIP + if (conf_parser_ctx.pass == 1) + ConfigServerInfo.libgeoip_database_options |= GEOIP_MEMORY_CACHE; +#endif +} | MMAP_CACHE +{ +#ifdef HAVE_LIBGEOIP + if (conf_parser_ctx.pass == 1) + ConfigServerInfo.libgeoip_database_options |= GEOIP_MMAP_CACHE; +#endif +} | CHECK_CACHE +{ +#ifdef HAVE_LIBGEOIP + if (conf_parser_ctx.pass == 1) + ConfigServerInfo.libgeoip_database_options |= GEOIP_CHECK_CACHE; #endif }; -serverinfo_ssl_dh_param_file: SSL_DH_PARAM_FILE '=' QSTRING ';' +serverinfo_libgeoip_ipv4_database_file: LIBGEOIP_IPV4_DATABASE_FILE '=' QSTRING ';' { -/* TBD - XXX: error reporting */ -#ifdef HAVE_LIBCRYPTO - if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) + if (conf_parser_ctx.pass == 2) { - BIO *file = BIO_new_file(yylval.string, "r"); + xfree(ConfigServerInfo.libgeoip_ipv4_database_file); + ConfigServerInfo.libgeoip_ipv4_database_file = xstrdup(yylval.string); - if (file) - { - DH *dh = PEM_read_bio_DHparams(file, NULL, NULL, NULL); - - BIO_free(file); - - if (dh) - { - if (DH_size(dh) < 128) - conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- need at least a 1024 bit DH prime size"); - else - SSL_CTX_set_tmp_dh(ServerInfo.server_ctx, dh); - - DH_free(dh); - } - } - } +#ifdef HAVE_LIBGEOIP + if (GeoIPv4_ctx) + GeoIP_delete(GeoIPv4_ctx); + GeoIPv4_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options); #endif + } }; -serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';' +serverinfo_libgeoip_ipv6_database_file: LIBGEOIP_IPV6_DATABASE_FILE '=' QSTRING ';' { -#ifdef HAVE_LIBCRYPTO - if (conf_parser_ctx.pass == 2 && ServerInfo.server_ctx) - SSL_CTX_set_cipher_list(ServerInfo.server_ctx, yylval.string); + if (conf_parser_ctx.pass == 2) + { + xfree(ConfigServerInfo.libgeoip_ipv6_database_file); + ConfigServerInfo.libgeoip_ipv6_database_file = xstrdup(yylval.string); + +#ifdef HAVE_LIBGEOIP + if (GeoIPv6_ctx) + GeoIP_delete(GeoIPv6_ctx); + GeoIPv6_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options); #endif + } }; serverinfo_name: NAME '=' QSTRING ';' { - /* this isn't rehashable */ - if (conf_parser_ctx.pass == 2 && !ServerInfo.name) + /* This isn't rehashable */ + if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.name) { if (valid_servname(yylval.string)) - ServerInfo.name = xstrdup(yylval.string); + ConfigServerInfo.name = xstrdup(yylval.string); else { conf_error_report("Ignoring serverinfo::name -- invalid name. Aborting."); - exit(0); + exit(EXIT_FAILURE); } } }; serverinfo_sid: IRCD_SID '=' QSTRING ';' { - /* this isn't rehashable */ - if (conf_parser_ctx.pass == 2 && !ServerInfo.sid) + /* This isn't rehashable */ + if (conf_parser_ctx.pass == 2 && !ConfigServerInfo.sid) { if (valid_sid(yylval.string)) - ServerInfo.sid = xstrdup(yylval.string); + ConfigServerInfo.sid = xstrdup(yylval.string); else { conf_error_report("Ignoring serverinfo::sid -- invalid SID. Aborting."); - exit(0); + exit(EXIT_FAILURE); } } }; @@ -675,8 +626,9 @@ serverinfo_description: DESCRIPTION '=' { if (conf_parser_ctx.pass == 2) { - MyFree(ServerInfo.description); - ServerInfo.description = xstrdup(yylval.string); + xfree(ConfigServerInfo.description); + ConfigServerInfo.description = xstrdup(yylval.string); + strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info)); } }; @@ -689,8 +641,8 @@ serverinfo_network_name: NETWORK_NAME '= if ((p = strchr(yylval.string, ' '))) *p = '\0'; - MyFree(ServerInfo.network_name); - ServerInfo.network_name = xstrdup(yylval.string); + xfree(ConfigServerInfo.network_name); + ConfigServerInfo.network_name = xstrdup(yylval.string); } }; @@ -699,8 +651,8 @@ serverinfo_network_desc: NETWORK_DESC '= if (conf_parser_ctx.pass != 2) break; - MyFree(ServerInfo.network_desc); - ServerInfo.network_desc = xstrdup(yylval.string); + xfree(ConfigServerInfo.network_desc); + ConfigServerInfo.network_desc = xstrdup(yylval.string); }; serverinfo_vhost: VHOST '=' QSTRING ';' @@ -721,19 +673,18 @@ serverinfo_vhost: VHOST '=' QSTRING ';' { assert(res); - memcpy(&ServerInfo.ip, res->ai_addr, res->ai_addrlen); - ServerInfo.ip.ss.ss_family = res->ai_family; - ServerInfo.ip.ss_len = res->ai_addrlen; + memcpy(&ConfigServerInfo.ip, res->ai_addr, res->ai_addrlen); + ConfigServerInfo.ip.ss.ss_family = res->ai_family; + ConfigServerInfo.ip.ss_len = res->ai_addrlen; freeaddrinfo(res); - ServerInfo.specific_ipv4_vhost = 1; + ConfigServerInfo.specific_ipv4_vhost = 1; } } }; serverinfo_vhost6: VHOST6 '=' QSTRING ';' { -#ifdef IPV6 if (conf_parser_ctx.pass == 2 && *yylval.string != '*') { struct addrinfo hints, *res; @@ -750,18 +701,17 @@ serverinfo_vhost6: VHOST6 '=' QSTRING '; { assert(res); - memcpy(&ServerInfo.ip6, res->ai_addr, res->ai_addrlen); - ServerInfo.ip6.ss.ss_family = res->ai_family; - ServerInfo.ip6.ss_len = res->ai_addrlen; + memcpy(&ConfigServerInfo.ip6, res->ai_addr, res->ai_addrlen); + ConfigServerInfo.ip6.ss.ss_family = res->ai_family; + ConfigServerInfo.ip6.ss_len = res->ai_addrlen; freeaddrinfo(res); - ServerInfo.specific_ipv6_vhost = 1; + ConfigServerInfo.specific_ipv6_vhost = 1; } } -#endif }; -serverinfo_max_clients: T_MAX_CLIENTS '=' NUMBER ';' +serverinfo_default_max_clients: DEFAULT_MAX_CLIENTS '=' NUMBER ';' { if (conf_parser_ctx.pass != 2) break; @@ -772,7 +722,7 @@ serverinfo_max_clients: T_MAX_CLIENTS '= snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN); conf_error_report(buf); - ServerInfo.max_clients = MAXCLIENTS_MIN; + ConfigServerInfo.default_max_clients = MAXCLIENTS_MIN; } else if ($3 > MAXCLIENTS_MAX) { @@ -780,10 +730,10 @@ serverinfo_max_clients: T_MAX_CLIENTS '= snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX); conf_error_report(buf); - ServerInfo.max_clients = MAXCLIENTS_MAX; + ConfigServerInfo.default_max_clients = MAXCLIENTS_MAX; } else - ServerInfo.max_clients = $3; + ConfigServerInfo.default_max_clients = $3; }; serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';' @@ -794,7 +744,7 @@ serverinfo_max_nick_length: MAX_NICK_LEN if ($3 < 9) { conf_error_report("max_nick_length too low, setting to 9"); - ServerInfo.max_nick_length = 9; + ConfigServerInfo.max_nick_length = 9; } else if ($3 > NICKLEN) { @@ -802,10 +752,10 @@ serverinfo_max_nick_length: MAX_NICK_LEN snprintf(buf, sizeof(buf), "max_nick_length too high, setting to %d", NICKLEN); conf_error_report(buf); - ServerInfo.max_nick_length = NICKLEN; + ConfigServerInfo.max_nick_length = NICKLEN; } else - ServerInfo.max_nick_length = $3; + ConfigServerInfo.max_nick_length = $3; }; serverinfo_max_topic_length: MAX_TOPIC_LENGTH '=' NUMBER ';' @@ -816,7 +766,7 @@ serverinfo_max_topic_length: MAX_TOPIC_L if ($3 < 80) { conf_error_report("max_topic_length too low, setting to 80"); - ServerInfo.max_topic_length = 80; + ConfigServerInfo.max_topic_length = 80; } else if ($3 > TOPICLEN) { @@ -824,20 +774,21 @@ serverinfo_max_topic_length: MAX_TOPIC_L snprintf(buf, sizeof(buf), "max_topic_length too high, setting to %d", TOPICLEN); conf_error_report(buf); - ServerInfo.max_topic_length = TOPICLEN; + ConfigServerInfo.max_topic_length = TOPICLEN; } else - ServerInfo.max_topic_length = $3; + ConfigServerInfo.max_topic_length = $3; }; serverinfo_hub: HUB '=' TBOOL ';' { if (conf_parser_ctx.pass == 2) - ServerInfo.hub = yylval.number; + ConfigServerInfo.hub = yylval.number; }; + /*************************************************************************** - * admin section + * admin {} section ***************************************************************************/ admin_entry: ADMIN '{' admin_items '}' ';' ; @@ -852,8 +803,8 @@ admin_name: NAME '=' QSTRING ';' if (conf_parser_ctx.pass != 2) break; - MyFree(AdminInfo.name); - AdminInfo.name = xstrdup(yylval.string); + xfree(ConfigAdminInfo.name); + ConfigAdminInfo.name = xstrdup(yylval.string); }; admin_email: EMAIL '=' QSTRING ';' @@ -861,8 +812,8 @@ admin_email: EMAIL '=' QSTRING ';' if (conf_parser_ctx.pass != 2) break; - MyFree(AdminInfo.email); - AdminInfo.email = xstrdup(yylval.string); + xfree(ConfigAdminInfo.email); + ConfigAdminInfo.email = xstrdup(yylval.string); }; admin_description: DESCRIPTION '=' QSTRING ';' @@ -870,12 +821,13 @@ admin_description: DESCRIPTION '=' QSTRI if (conf_parser_ctx.pass != 2) break; - MyFree(AdminInfo.description); - AdminInfo.description = xstrdup(yylval.string); + xfree(ConfigAdminInfo.description); + ConfigAdminInfo.description = xstrdup(yylval.string); }; + /*************************************************************************** - * motd section + * motd {} section ***************************************************************************/ motd_entry: MOTD { @@ -883,7 +835,7 @@ motd_entry: MOTD reset_block_state(); } '{' motd_items '}' ';' { - dlink_node *ptr = NULL; + dlink_node *node = NULL; if (conf_parser_ctx.pass != 2) break; @@ -891,8 +843,8 @@ motd_entry: MOTD if (!block_state.file.buf[0]) break; - DLINK_FOREACH(ptr, block_state.mask.list.head) - motd_add(ptr->data, block_state.file.buf); + DLINK_FOREACH(node, block_state.mask.list.head) + motd_add(node->data, block_state.file.buf); }; motd_items: motd_items motd_item | motd_item; @@ -910,8 +862,71 @@ motd_file: T_FILE '=' QSTRING ';' strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf)); }; + /*************************************************************************** - * section logging + * pseudo {} section + ***************************************************************************/ +pseudo_entry: T_PSEUDO +{ + if (conf_parser_ctx.pass == 2) + reset_block_state(); +} '{' pseudo_items '}' ';' +{ + if (conf_parser_ctx.pass != 2) + break; + + if (!block_state.command.buf[0] || + !block_state.name.buf[0] || + !block_state.nick.buf[0] || + !block_state.host.buf[0]) + break; + + pseudo_register(block_state.name.buf, block_state.nick.buf, block_state.host.buf, + block_state.prepend.buf, block_state.command.buf); +}; + +pseudo_items: pseudo_items pseudo_item | pseudo_item; +pseudo_item: pseudo_command | pseudo_prepend | pseudo_name | pseudo_target | error ';' ; + +pseudo_command: T_COMMAND '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) + strlcpy(block_state.command.buf, yylval.string, sizeof(block_state.command.buf)); +}; + +pseudo_name: NAME '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) + strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf)); +}; + +pseudo_prepend: T_PREPEND '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) + strlcpy(block_state.prepend.buf, yylval.string, sizeof(block_state.prepend.buf)); +}; + +pseudo_target: T_TARGET '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) + { + struct split_nuh_item nuh; + + nuh.nuhmask = yylval.string; + nuh.nickptr = NULL; + nuh.userptr = block_state.nick.buf; + nuh.hostptr = block_state.host.buf; + nuh.nicksize = 0; + nuh.usersize = sizeof(block_state.nick.buf); + nuh.hostsize = sizeof(block_state.host.buf); + + split_nuh(&nuh); + } +}; + + +/*************************************************************************** + * log {} section ***************************************************************************/ logging_entry: T_LOG '{' logging_items '}' ';' ; logging_items: logging_items logging_item | logging_item ; @@ -922,7 +937,7 @@ logging_item: logging_use_logg logging_use_logging: USE_LOGGING '=' TBOOL ';' { if (conf_parser_ctx.pass == 2) - ConfigLoggingEntry.use_logging = yylval.number; + ConfigLog.use_logging = yylval.number; }; logging_file_entry: @@ -976,10 +991,6 @@ logging_file_type_item: USER { if (conf_parser_ctx.pass == 2) block_state.type.value = LOG_TYPE_OPER; -} | GLINE -{ - if (conf_parser_ctx.pass == 2) - block_state.type.value = LOG_TYPE_GLINE; } | XLINE { if (conf_parser_ctx.pass == 2) @@ -1008,7 +1019,7 @@ logging_file_type_item: USER /*************************************************************************** - * section oper + * operator {} section ***************************************************************************/ oper_entry: OPERATOR { @@ -1019,28 +1030,27 @@ oper_entry: OPERATOR block_state.flags.value |= CONF_FLAGS_ENCRYPTED; } '{' oper_items '}' ';' { - dlink_node *ptr = NULL; + dlink_node *node = NULL; if (conf_parser_ctx.pass != 2) break; if (!block_state.name.buf[0]) break; -#ifdef HAVE_LIBCRYPTO - if (!block_state.file.buf[0] && - !block_state.rpass.buf[0]) - break; -#else + if (!block_state.rpass.buf[0]) break; -#endif - DLINK_FOREACH(ptr, block_state.mask.list.head) + DLINK_FOREACH(node, block_state.mask.list.head) { struct MaskItem *conf = NULL; struct split_nuh_item nuh; + char *s = node->data; + + if (EmptyString(s)) + continue; - nuh.nuhmask = ptr->data; + nuh.nuhmask = s; nuh.nickptr = NULL; nuh.userptr = block_state.user.buf; nuh.hostptr = block_state.host.buf; @@ -1060,33 +1070,15 @@ oper_entry: OPERATOR if (block_state.rpass.buf[0]) conf->passwd = xstrdup(block_state.rpass.buf); + if (block_state.whois.buf[0]) + conf->whois = xstrdup(block_state.whois.buf); + conf->flags = block_state.flags.value; conf->modes = block_state.modes.value; conf->port = block_state.port.value; conf->htype = parse_netmask(conf->host, &conf->addr, &conf->bits); conf_add_class_to_conf(conf, block_state.class.buf); - -#ifdef HAVE_LIBCRYPTO - if (block_state.file.buf[0]) - { - BIO *file = NULL; - RSA *pkey = NULL; - - if ((file = BIO_new_file(block_state.file.buf, "r")) == NULL) - { - conf_error_report("Ignoring rsa_public_key_file -- file doesn't exist"); - break; - } - - if ((pkey = PEM_read_bio_RSA_PUBKEY(file, NULL, 0, NULL)) == NULL) - conf_error_report("Ignoring rsa_public_key_file -- Key invalid; check key syntax."); - - conf->rsa_public_key = pkey; - BIO_set_close(file, BIO_CLOSE); - BIO_free(file); - } -#endif /* HAVE_LIBCRYPTO */ } }; @@ -1094,10 +1086,10 @@ oper_items: oper_items oper_item | o oper_item: oper_name | oper_user | oper_password | + oper_whois | oper_umodes | oper_class | oper_encrypted | - oper_rsa_public_key_file | oper_ssl_certificate_fingerprint | oper_ssl_connection_required | oper_flags | @@ -1121,6 +1113,12 @@ oper_password: PASSWORD '=' QSTRING ';' strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); }; +oper_whois: WHOIS '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) + strlcpy(block_state.whois.buf, yylval.string, sizeof(block_state.whois.buf)); +}; + oper_encrypted: ENCRYPTED '=' TBOOL ';' { if (conf_parser_ctx.pass != 2) @@ -1132,12 +1130,6 @@ oper_encrypted: ENCRYPTED '=' TBOOL ';' block_state.flags.value &= ~CONF_FLAGS_ENCRYPTED; }; -oper_rsa_public_key_file: RSA_PUBLIC_KEY_FILE '=' QSTRING ';' -{ - if (conf_parser_ctx.pass == 2) - strlcpy(block_state.file.buf, yylval.string, sizeof(block_state.file.buf)); -}; - oper_ssl_certificate_fingerprint: SSL_CERTIFICATE_FINGERPRINT '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) @@ -1292,7 +1284,7 @@ oper_flags_item: KILL ':' REMOTE } | KLINE { if (conf_parser_ctx.pass == 2) - block_state.port.value |= OPER_FLAG_K; + block_state.port.value |= OPER_FLAG_KLINE; } | UNKLINE { if (conf_parser_ctx.pass == 2) @@ -1313,10 +1305,6 @@ oper_flags_item: KILL ':' REMOTE { if (conf_parser_ctx.pass == 2) block_state.port.value |= OPER_FLAG_UNXLINE; -} | GLINE -{ - if (conf_parser_ctx.pass == 2) - block_state.port.value |= OPER_FLAG_GLINE; } | DIE { if (conf_parser_ctx.pass == 2) @@ -1325,6 +1313,10 @@ oper_flags_item: KILL ':' REMOTE { if (conf_parser_ctx.pass == 2) block_state.port.value |= OPER_FLAG_RESTART; +} | REHASH ':' REMOTE +{ + if (conf_parser_ctx.pass == 2) + block_state.port.value |= OPER_FLAG_REHASH_REMOTE; } | REHASH { if (conf_parser_ctx.pass == 2) @@ -1357,11 +1349,35 @@ oper_flags_item: KILL ':' REMOTE { if (conf_parser_ctx.pass == 2) block_state.port.value |= OPER_FLAG_MODULE; +} | T_OPME +{ + if (conf_parser_ctx.pass == 2) + block_state.port.value |= OPER_FLAG_OPME; +} | NICK ':' RESV +{ + if (conf_parser_ctx.pass == 2) + block_state.port.value |= OPER_FLAG_NICK_RESV; +} | JOIN ':' RESV +{ + if (conf_parser_ctx.pass == 2) + block_state.port.value |= OPER_FLAG_JOIN_RESV; +} | RESV +{ + if (conf_parser_ctx.pass == 2) + block_state.port.value |= OPER_FLAG_RESV; +} | T_UNRESV +{ + if (conf_parser_ctx.pass == 2) + block_state.port.value |= OPER_FLAG_UNRESV; +} | CLOSE +{ + if (conf_parser_ctx.pass == 2) + block_state.port.value |= OPER_FLAG_CLOSE; }; /*************************************************************************** - * section class + * class {} section ***************************************************************************/ class_entry: CLASS { @@ -1389,7 +1405,7 @@ class_entry: CLASS class = class_make(); class->active = 1; - MyFree(class->name); + xfree(class->name); class->name = xstrdup(block_state.class.buf); class->ping_freq = block_state.ping_freq.value; class->max_perip = block_state.max_perip.value; @@ -1397,7 +1413,6 @@ class_entry: CLASS class->max_total = block_state.max_total.value; class->max_global = block_state.max_global.value; class->max_local = block_state.max_local.value; - class->max_ident = block_state.max_ident.value; class->max_sendq = block_state.max_sendq.value; class->max_recvq = block_state.max_recvq.value; class->max_channels = block_state.max_channels.value; @@ -1413,12 +1428,7 @@ class_entry: CLASS class->min_idle = block_state.min_idle.value; class->max_idle = block_state.max_idle.value; - if (class->number_per_cidr && block_state.number_per_cidr.value) - if ((class->cidr_bitlen_ipv4 && block_state.cidr_bitlen_ipv4.value) || - (class->cidr_bitlen_ipv6 && block_state.cidr_bitlen_ipv6.value)) - if ((class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value) || - (class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value)) - rebuild_cidr_list(class); + rebuild_cidr_list(class); class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value; class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value; @@ -1437,8 +1447,8 @@ class_item: class_name | class_max_number | class_max_global | class_max_local | - class_max_ident | - class_sendq | class_recvq | + class_sendq | + class_recvq | class_min_idle | class_max_idle | class_flags | @@ -1492,12 +1502,6 @@ class_max_local: MAX_LOCAL '=' NUMBER '; block_state.max_local.value = $3; }; -class_max_ident: MAX_IDENT '=' NUMBER ';' -{ - if (conf_parser_ctx.pass == 1) - block_state.max_ident.value = $3; -}; - class_sendq: SENDQ '=' sizespec ';' { if (conf_parser_ctx.pass == 1) @@ -1566,7 +1570,7 @@ class_flags_item: RANDOM_IDLE /*************************************************************************** - * section listen + * listen {} section ***************************************************************************/ listen_entry: LISTEN { @@ -1605,31 +1609,29 @@ port_item: NUMBER { if (conf_parser_ctx.pass == 2) { +#ifndef HAVE_TLS if (block_state.flags.value & LISTENER_SSL) -#ifdef HAVE_LIBCRYPTO - if (!ServerInfo.server_ctx) + { + conf_error_report("TLS not available - port closed"); + break; + } #endif - { - conf_error_report("SSL not available - port closed"); - break; - } - add_listener($1, block_state.addr.buf, block_state.flags.value); + listener_add($1, block_state.addr.buf, block_state.flags.value); } } | NUMBER TWODOTS NUMBER { if (conf_parser_ctx.pass == 2) { +#ifndef HAVE_TLS if (block_state.flags.value & LISTENER_SSL) -#ifdef HAVE_LIBCRYPTO - if (!ServerInfo.server_ctx) + { + conf_error_report("TLS not available - port closed"); + break; + } #endif - { - conf_error_report("SSL not available - port closed"); - break; - } for (int i = $1; i <= $3; ++i) - add_listener(i, block_state.addr.buf, block_state.flags.value); + listener_add(i, block_state.addr.buf, block_state.flags.value); } }; @@ -1645,8 +1647,9 @@ listen_host: HOST '=' QSTRING ';' strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf)); }; + /*************************************************************************** - * section auth + * auth {} section ***************************************************************************/ auth_entry: IRCD_AUTH { @@ -1654,17 +1657,21 @@ auth_entry: IRCD_AUTH reset_block_state(); } '{' auth_items '}' ';' { - dlink_node *ptr = NULL; + dlink_node *node = NULL; if (conf_parser_ctx.pass != 2) break; - DLINK_FOREACH(ptr, block_state.mask.list.head) + DLINK_FOREACH(node, block_state.mask.list.head) { struct MaskItem *conf = NULL; struct split_nuh_item nuh; + char *s = node->data; + + if (EmptyString(s)) + continue; - nuh.nuhmask = ptr->data; + nuh.nuhmask = s; nuh.nickptr = NULL; nuh.userptr = block_state.user.buf; nuh.hostptr = block_state.host.buf; @@ -1749,6 +1756,10 @@ auth_flags_item: SPOOF_NOTICE { if (conf_parser_ctx.pass == 2) block_state.flags.value |= CONF_FLAGS_EXEMPTKLINE; +} | XLINE_EXEMPT +{ + if (conf_parser_ctx.pass == 2) + block_state.flags.value |= CONF_FLAGS_EXEMPTXLINE; } | NEED_IDENT { if (conf_parser_ctx.pass == 2) @@ -1761,10 +1772,6 @@ auth_flags_item: SPOOF_NOTICE { if (conf_parser_ctx.pass == 2) block_state.flags.value |= CONF_FLAGS_NO_TILDE; -} | GLINE_EXEMPT -{ - if (conf_parser_ctx.pass == 2) - block_state.flags.value |= CONF_FLAGS_EXEMPTGLINE; } | RESV_EXEMPT { if (conf_parser_ctx.pass == 2) @@ -1813,7 +1820,7 @@ auth_redir_port: REDIRPORT '=' NUMBER '; /*************************************************************************** - * section resv + * resv {} section ***************************************************************************/ resv_entry: RESV { @@ -1827,7 +1834,7 @@ resv_entry: RESV if (conf_parser_ctx.pass != 2) break; - create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list); + resv_make(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list); }; resv_items: resv_items resv_item | resv_item; @@ -1853,7 +1860,7 @@ resv_exempt: EXEMPT '=' QSTRING ';' /*************************************************************************** - * section service + * service {} section ***************************************************************************/ service_entry: T_SERVICE '{' service_items '}' ';'; @@ -1867,13 +1874,14 @@ service_name: NAME '=' QSTRING ';' if (valid_servname(yylval.string)) { - struct MaskItem *conf = conf_make(CONF_SERVICE); - conf->name = xstrdup(yylval.string); + struct ServiceItem *service = service_make(); + service->name = xstrdup(yylval.string); } }; + /*************************************************************************** - * section shared, for sharing remote klines etc. + * shared {} section, for sharing remote klines etc. ***************************************************************************/ shared_entry: T_SHARED { @@ -1888,16 +1896,14 @@ shared_entry: T_SHARED block_state.flags.value = SHARED_ALL; } '{' shared_items '}' ';' { - struct MaskItem *conf = NULL; - if (conf_parser_ctx.pass != 2) break; - conf = conf_make(CONF_ULINE); - conf->flags = block_state.flags.value; - conf->name = xstrdup(block_state.name.buf); - conf->user = xstrdup(block_state.user.buf); - conf->host = xstrdup(block_state.host.buf); + struct SharedItem *shared = shared_make(); + shared->type = block_state.flags.value; + shared->server = xstrdup(block_state.name.buf); + shared->user = xstrdup(block_state.user.buf); + shared->host = xstrdup(block_state.host.buf); }; shared_items: shared_items shared_item | shared_item; @@ -1977,8 +1983,9 @@ shared_type_item: KLINE block_state.flags.value = SHARED_ALL; }; + /*************************************************************************** - * section cluster + * cluster {} section ***************************************************************************/ cluster_entry: T_CLUSTER { @@ -1988,17 +1995,15 @@ cluster_entry: T_CLUSTER reset_block_state(); strlcpy(block_state.name.buf, "*", sizeof(block_state.name.buf)); - block_state.flags.value = SHARED_ALL; + block_state.flags.value = CLUSTER_ALL; } '{' cluster_items '}' ';' { - struct MaskItem *conf = NULL; - if (conf_parser_ctx.pass != 2) break; - conf = conf_make(CONF_CLUSTER); - conf->flags = block_state.flags.value; - conf->name = xstrdup(block_state.name.buf); + struct ClusterItem *cluster = cluster_make(); + cluster->type = block_state.flags.value; + cluster->server = xstrdup(block_state.name.buf); }; cluster_items: cluster_items cluster_item | cluster_item; @@ -2020,47 +2025,48 @@ cluster_types: cluster_types ',' cluste cluster_type_item: KLINE { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_KLINE; + block_state.flags.value |= CLUSTER_KLINE; } | UNKLINE { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_UNKLINE; + block_state.flags.value |= CLUSTER_UNKLINE; } | T_DLINE { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_DLINE; + block_state.flags.value |= CLUSTER_DLINE; } | T_UNDLINE { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_UNDLINE; + block_state.flags.value |= CLUSTER_UNDLINE; } | XLINE { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_XLINE; + block_state.flags.value |= CLUSTER_XLINE; } | T_UNXLINE { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_UNXLINE; + block_state.flags.value |= CLUSTER_UNXLINE; } | RESV { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_RESV; + block_state.flags.value |= CLUSTER_RESV; } | T_UNRESV { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_UNRESV; + block_state.flags.value |= CLUSTER_UNRESV; } | T_LOCOPS { if (conf_parser_ctx.pass == 2) - block_state.flags.value |= SHARED_LOCOPS; + block_state.flags.value |= CLUSTER_LOCOPS; } | T_ALL { if (conf_parser_ctx.pass == 2) - block_state.flags.value = SHARED_ALL; + block_state.flags.value = CLUSTER_ALL; }; + /*************************************************************************** - * section connect + * connect {} section ***************************************************************************/ connect_entry: CONNECT { @@ -2213,10 +2219,8 @@ connect_aftype: AFTYPE '=' T_IPV4 ';' block_state.aftype.value = AF_INET; } | AFTYPE '=' T_IPV6 ';' { -#ifdef IPV6 if (conf_parser_ctx.pass == 2) block_state.aftype.value = AF_INET6; -#endif }; connect_flags: IRCD_FLAGS @@ -2266,18 +2270,18 @@ connect_class: CLASS '=' QSTRING ';' connect_ssl_cipher_list: T_SSL_CIPHER_LIST '=' QSTRING ';' { -#ifdef HAVE_LIBCRYPTO +#ifdef HAVE_TLS if (conf_parser_ctx.pass == 2) strlcpy(block_state.ciph.buf, yylval.string, sizeof(block_state.ciph.buf)); #else if (conf_parser_ctx.pass == 2) - conf_error_report("Ignoring connect::ciphers -- no OpenSSL support"); + conf_error_report("Ignoring connect::ciphers -- no TLS support"); #endif }; /*************************************************************************** - * section kill + * kill {} section ***************************************************************************/ kill_entry: KILL { @@ -2334,8 +2338,9 @@ kill_reason: REASON '=' QSTRING ';' strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); }; + /*************************************************************************** - * section deny + * deny {} section ***************************************************************************/ deny_entry: DENY { @@ -2379,19 +2384,20 @@ deny_reason: REASON '=' QSTRING ';' strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); }; + /*************************************************************************** - * section exempt + * exempt {} section ***************************************************************************/ exempt_entry: EXEMPT '{' exempt_items '}' ';'; -exempt_items: exempt_items exempt_item | exempt_item; -exempt_item: exempt_ip | error; +exempt_items: exempt_items exempt_item | exempt_item; +exempt_item: exempt_ip | error; exempt_ip: IP '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) { - if (yylval.string[0] && parse_netmask(yylval.string, NULL, NULL) != HM_HOST) + if (*yylval.string && parse_netmask(yylval.string, NULL, NULL) != HM_HOST) { struct MaskItem *conf = conf_make(CONF_EXEMPT); conf->host = xstrdup(yylval.string); @@ -2402,7 +2408,7 @@ exempt_ip: IP '=' QSTRING ';' }; /*************************************************************************** - * section gecos + * gecos {} section ***************************************************************************/ gecos_entry: GECOS { @@ -2410,21 +2416,19 @@ gecos_entry: GECOS reset_block_state(); } '{' gecos_items '}' ';' { - struct MaskItem *conf = NULL; - if (conf_parser_ctx.pass != 2) break; if (!block_state.name.buf[0]) break; - conf = conf_make(CONF_XLINE); - conf->name = xstrdup(block_state.name.buf); + struct GecosItem *gecos = gecos_make(); + gecos->mask = xstrdup(block_state.name.buf); if (block_state.rpass.buf[0]) - conf->reason = xstrdup(block_state.rpass.buf); + gecos->reason = xstrdup(block_state.rpass.buf); else - conf->reason = xstrdup(CONF_NOREASON); + gecos->reason = xstrdup(CONF_NOREASON); }; gecos_items: gecos_items gecos_item | gecos_item; @@ -2442,20 +2446,22 @@ gecos_reason: REASON '=' QSTRING ';' strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); }; + /*************************************************************************** - * section general + * general {} section ***************************************************************************/ -general_entry: GENERAL - '{' general_items '}' ';'; +general_entry: GENERAL '{' general_items '}' ';'; general_items: general_items general_item | general_item; -general_item: general_hide_spoof_ips | +general_item: general_away_count | + general_away_time | general_ignore_bogus_ts | general_failed_oper_notice | general_anti_nick_flood | general_max_nick_time | general_max_nick_changes | general_max_accept | + general_whowas_history_length | general_anti_spam_exit_message_time | general_ts_warn_delta | general_ts_max_delta | @@ -2463,21 +2469,18 @@ general_item: general_hide_spoof_i general_invisible_on_connect | general_warn_no_connect_block | general_dots_in_ident | - general_stats_o_oper_only | - general_stats_k_oper_only | - general_pace_wait | general_stats_i_oper_only | - general_pace_wait_simple | + general_stats_k_oper_only | + general_stats_m_oper_only | + general_stats_o_oper_only | general_stats_P_oper_only | general_stats_u_oper_only | + general_pace_wait | + general_pace_wait_simple | general_short_motd | general_no_oper_flood | - general_true_no_oper_flood | - general_oper_pass_resv | general_oper_only_umodes | general_max_targets | - general_use_egd | - general_egdpool_path | general_oper_umodes | general_caller_id_wait | general_opers_bypass_callerid | @@ -2486,450 +2489,406 @@ general_item: general_hide_spoof_i general_min_nonwildcard_simple | general_throttle_count | general_throttle_time | - general_havent_read_conf | general_ping_cookie | general_disable_auth | general_tkline_expire_notices | - general_gline_enable | - general_gline_duration | - general_gline_request_duration | - general_gline_min_cidr | - general_gline_min_cidr6 | + general_dline_min_cidr | + general_dline_min_cidr6 | + general_kline_min_cidr | + general_kline_min_cidr6 | general_stats_e_disabled | general_max_watch | - general_services_name | general_cycle_on_host_change | error; -general_max_watch: MAX_WATCH '=' NUMBER ';' +general_away_count: AWAY_COUNT '=' NUMBER ';' { - ConfigFileEntry.max_watch = $3; + ConfigGeneral.away_count = $3; }; -general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';' +general_away_time: AWAY_TIME '=' timespec ';' { - if (conf_parser_ctx.pass == 2) - ConfigFileEntry.cycle_on_host_change = yylval.number; + ConfigGeneral.away_time = $3; }; -general_gline_enable: GLINE_ENABLE '=' TBOOL ';' +general_max_watch: MAX_WATCH '=' NUMBER ';' { - if (conf_parser_ctx.pass == 2) - ConfigFileEntry.glines = yylval.number; + ConfigGeneral.max_watch = $3; }; -general_gline_duration: GLINE_DURATION '=' timespec ';' +general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';' { - if (conf_parser_ctx.pass == 2) - ConfigFileEntry.gline_time = $3; + ConfigGeneral.whowas_history_length = $3; }; -general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';' +general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';' { if (conf_parser_ctx.pass == 2) - ConfigFileEntry.gline_request_time = $3; + ConfigGeneral.cycle_on_host_change = yylval.number; }; -general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';' +general_dline_min_cidr: DLINE_MIN_CIDR '=' NUMBER ';' { - ConfigFileEntry.gline_min_cidr = $3; + ConfigGeneral.dline_min_cidr = $3; }; -general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';' +general_dline_min_cidr6: DLINE_MIN_CIDR6 '=' NUMBER ';' { - ConfigFileEntry.gline_min_cidr6 = $3; + ConfigGeneral.dline_min_cidr6 = $3; }; -general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';' +general_kline_min_cidr: KLINE_MIN_CIDR '=' NUMBER ';' { - ConfigFileEntry.tkline_expire_notices = yylval.number; + ConfigGeneral.kline_min_cidr = $3; }; -general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';' +general_kline_min_cidr6: KLINE_MIN_CIDR6 '=' NUMBER ';' +{ + ConfigGeneral.kline_min_cidr6 = $3; +}; + +general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';' { - ConfigFileEntry.kill_chase_time_limit = $3; + ConfigGeneral.tkline_expire_notices = yylval.number; }; -general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';' +general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';' { - ConfigFileEntry.hide_spoof_ips = yylval.number; + ConfigGeneral.kill_chase_time_limit = $3; }; general_ignore_bogus_ts: IGNORE_BOGUS_TS '=' TBOOL ';' { - ConfigFileEntry.ignore_bogus_ts = yylval.number; + ConfigGeneral.ignore_bogus_ts = yylval.number; }; general_failed_oper_notice: FAILED_OPER_NOTICE '=' TBOOL ';' { - ConfigFileEntry.failed_oper_notice = yylval.number; + ConfigGeneral.failed_oper_notice = yylval.number; }; general_anti_nick_flood: ANTI_NICK_FLOOD '=' TBOOL ';' { - ConfigFileEntry.anti_nick_flood = yylval.number; + ConfigGeneral.anti_nick_flood = yylval.number; }; general_max_nick_time: MAX_NICK_TIME '=' timespec ';' { - ConfigFileEntry.max_nick_time = $3; + ConfigGeneral.max_nick_time = $3; }; general_max_nick_changes: MAX_NICK_CHANGES '=' NUMBER ';' { - ConfigFileEntry.max_nick_changes = $3; + ConfigGeneral.max_nick_changes = $3; }; general_max_accept: MAX_ACCEPT '=' NUMBER ';' { - ConfigFileEntry.max_accept = $3; + ConfigGeneral.max_accept = $3; }; general_anti_spam_exit_message_time: ANTI_SPAM_EXIT_MESSAGE_TIME '=' timespec ';' { - ConfigFileEntry.anti_spam_exit_message_time = $3; + ConfigGeneral.anti_spam_exit_message_time = $3; }; general_ts_warn_delta: TS_WARN_DELTA '=' timespec ';' { - ConfigFileEntry.ts_warn_delta = $3; + ConfigGeneral.ts_warn_delta = $3; }; general_ts_max_delta: TS_MAX_DELTA '=' timespec ';' { if (conf_parser_ctx.pass == 2) - ConfigFileEntry.ts_max_delta = $3; -}; - -general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';' -{ - if (($3 > 0) && conf_parser_ctx.pass == 1) - { - ilog(LOG_TYPE_IRCD, "You haven't read your config file properly."); - ilog(LOG_TYPE_IRCD, "There is a line in the example conf that will kill your server if not removed."); - ilog(LOG_TYPE_IRCD, "Consider actually reading/editing the conf file, and removing this line."); - exit(0); - } + ConfigGeneral.ts_max_delta = $3; }; general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';' { - ConfigFileEntry.invisible_on_connect = yylval.number; + ConfigGeneral.invisible_on_connect = yylval.number; }; general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';' { - ConfigFileEntry.warn_no_connect_block = yylval.number; + ConfigGeneral.warn_no_connect_block = yylval.number; }; general_stats_e_disabled: STATS_E_DISABLED '=' TBOOL ';' { - ConfigFileEntry.stats_e_disabled = yylval.number; + ConfigGeneral.stats_e_disabled = yylval.number; +}; + +general_stats_m_oper_only: STATS_M_OPER_ONLY '=' TBOOL ';' +{ + ConfigGeneral.stats_m_oper_only = yylval.number; }; general_stats_o_oper_only: STATS_O_OPER_ONLY '=' TBOOL ';' { - ConfigFileEntry.stats_o_oper_only = yylval.number; + ConfigGeneral.stats_o_oper_only = yylval.number; }; general_stats_P_oper_only: STATS_P_OPER_ONLY '=' TBOOL ';' { - ConfigFileEntry.stats_P_oper_only = yylval.number; + ConfigGeneral.stats_P_oper_only = yylval.number; }; general_stats_u_oper_only: STATS_U_OPER_ONLY '=' TBOOL ';' { - ConfigFileEntry.stats_u_oper_only = yylval.number; + ConfigGeneral.stats_u_oper_only = yylval.number; }; general_stats_k_oper_only: STATS_K_OPER_ONLY '=' TBOOL ';' { - ConfigFileEntry.stats_k_oper_only = 2 * yylval.number; + ConfigGeneral.stats_k_oper_only = 2 * yylval.number; } | STATS_K_OPER_ONLY '=' TMASKED ';' { - ConfigFileEntry.stats_k_oper_only = 1; + ConfigGeneral.stats_k_oper_only = 1; }; general_stats_i_oper_only: STATS_I_OPER_ONLY '=' TBOOL ';' { - ConfigFileEntry.stats_i_oper_only = 2 * yylval.number; + ConfigGeneral.stats_i_oper_only = 2 * yylval.number; } | STATS_I_OPER_ONLY '=' TMASKED ';' { - ConfigFileEntry.stats_i_oper_only = 1; + ConfigGeneral.stats_i_oper_only = 1; }; general_pace_wait: PACE_WAIT '=' timespec ';' { - ConfigFileEntry.pace_wait = $3; + ConfigGeneral.pace_wait = $3; }; general_caller_id_wait: CALLER_ID_WAIT '=' timespec ';' { - ConfigFileEntry.caller_id_wait = $3; + ConfigGeneral.caller_id_wait = $3; }; general_opers_bypass_callerid: OPERS_BYPASS_CALLERID '=' TBOOL ';' { - ConfigFileEntry.opers_bypass_callerid = yylval.number; + ConfigGeneral.opers_bypass_callerid = yylval.number; }; general_pace_wait_simple: PACE_WAIT_SIMPLE '=' timespec ';' { - ConfigFileEntry.pace_wait_simple = $3; + ConfigGeneral.pace_wait_simple = $3; }; general_short_motd: SHORT_MOTD '=' TBOOL ';' { - ConfigFileEntry.short_motd = yylval.number; + ConfigGeneral.short_motd = yylval.number; }; general_no_oper_flood: NO_OPER_FLOOD '=' TBOOL ';' { - ConfigFileEntry.no_oper_flood = yylval.number; -}; - -general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';' -{ - ConfigFileEntry.true_no_oper_flood = yylval.number; -}; - -general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';' -{ - ConfigFileEntry.oper_pass_resv = yylval.number; + ConfigGeneral.no_oper_flood = yylval.number; }; general_dots_in_ident: DOTS_IN_IDENT '=' NUMBER ';' { - ConfigFileEntry.dots_in_ident = $3; + ConfigGeneral.dots_in_ident = $3; }; general_max_targets: MAX_TARGETS '=' NUMBER ';' { - ConfigFileEntry.max_targets = $3; -}; - -general_use_egd: USE_EGD '=' TBOOL ';' -{ - ConfigFileEntry.use_egd = yylval.number; -}; - -general_egdpool_path: EGDPOOL_PATH '=' QSTRING ';' -{ - if (conf_parser_ctx.pass == 2) - { - MyFree(ConfigFileEntry.egdpool_path); - ConfigFileEntry.egdpool_path = xstrdup(yylval.string); - } -}; - -general_services_name: T_SERVICES_NAME '=' QSTRING ';' -{ - if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string)) - { - MyFree(ConfigFileEntry.service_name); - ConfigFileEntry.service_name = xstrdup(yylval.string); - } + ConfigGeneral.max_targets = $3; }; general_ping_cookie: PING_COOKIE '=' TBOOL ';' { - ConfigFileEntry.ping_cookie = yylval.number; + ConfigGeneral.ping_cookie = yylval.number; }; general_disable_auth: DISABLE_AUTH '=' TBOOL ';' { - ConfigFileEntry.disable_auth = yylval.number; + ConfigGeneral.disable_auth = yylval.number; }; general_throttle_count: THROTTLE_COUNT '=' NUMBER ';' { - ConfigFileEntry.throttle_count = $3; + ConfigGeneral.throttle_count = $3; }; general_throttle_time: THROTTLE_TIME '=' timespec ';' { - ConfigFileEntry.throttle_time = $3; + ConfigGeneral.throttle_time = $3; }; general_oper_umodes: OPER_UMODES { - ConfigFileEntry.oper_umodes = 0; + ConfigGeneral.oper_umodes = 0; } '=' umode_oitems ';' ; umode_oitems: umode_oitems ',' umode_oitem | umode_oitem; umode_oitem: T_BOTS { - ConfigFileEntry.oper_umodes |= UMODE_BOTS; + ConfigGeneral.oper_umodes |= UMODE_BOTS; } | T_CCONN { - ConfigFileEntry.oper_umodes |= UMODE_CCONN; + ConfigGeneral.oper_umodes |= UMODE_CCONN; } | T_DEAF { - ConfigFileEntry.oper_umodes |= UMODE_DEAF; + ConfigGeneral.oper_umodes |= UMODE_DEAF; } | T_DEBUG { - ConfigFileEntry.oper_umodes |= UMODE_DEBUG; + ConfigGeneral.oper_umodes |= UMODE_DEBUG; } | T_FULL { - ConfigFileEntry.oper_umodes |= UMODE_FULL; + ConfigGeneral.oper_umodes |= UMODE_FULL; } | HIDDEN { - ConfigFileEntry.oper_umodes |= UMODE_HIDDEN; + ConfigGeneral.oper_umodes |= UMODE_HIDDEN; } | HIDE_CHANS { - ConfigFileEntry.oper_umodes |= UMODE_HIDECHANS; + ConfigGeneral.oper_umodes |= UMODE_HIDECHANS; } | HIDE_IDLE { - ConfigFileEntry.oper_umodes |= UMODE_HIDEIDLE; + ConfigGeneral.oper_umodes |= UMODE_HIDEIDLE; } | T_SKILL { - ConfigFileEntry.oper_umodes |= UMODE_SKILL; + ConfigGeneral.oper_umodes |= UMODE_SKILL; } | T_NCHANGE { - ConfigFileEntry.oper_umodes |= UMODE_NCHANGE; + ConfigGeneral.oper_umodes |= UMODE_NCHANGE; } | T_REJ { - ConfigFileEntry.oper_umodes |= UMODE_REJ; + ConfigGeneral.oper_umodes |= UMODE_REJ; } | T_UNAUTH { - ConfigFileEntry.oper_umodes |= UMODE_UNAUTH; + ConfigGeneral.oper_umodes |= UMODE_UNAUTH; } | T_SPY { - ConfigFileEntry.oper_umodes |= UMODE_SPY; + ConfigGeneral.oper_umodes |= UMODE_SPY; } | T_EXTERNAL { - ConfigFileEntry.oper_umodes |= UMODE_EXTERNAL; + ConfigGeneral.oper_umodes |= UMODE_EXTERNAL; } | T_SERVNOTICE { - ConfigFileEntry.oper_umodes |= UMODE_SERVNOTICE; + ConfigGeneral.oper_umodes |= UMODE_SERVNOTICE; } | T_INVISIBLE { - ConfigFileEntry.oper_umodes |= UMODE_INVISIBLE; + ConfigGeneral.oper_umodes |= UMODE_INVISIBLE; } | T_WALLOP { - ConfigFileEntry.oper_umodes |= UMODE_WALLOP; + ConfigGeneral.oper_umodes |= UMODE_WALLOP; } | T_SOFTCALLERID { - ConfigFileEntry.oper_umodes |= UMODE_SOFTCALLERID; + ConfigGeneral.oper_umodes |= UMODE_SOFTCALLERID; } | T_CALLERID { - ConfigFileEntry.oper_umodes |= UMODE_CALLERID; + ConfigGeneral.oper_umodes |= UMODE_CALLERID; } | T_LOCOPS { - ConfigFileEntry.oper_umodes |= UMODE_LOCOPS; + ConfigGeneral.oper_umodes |= UMODE_LOCOPS; } | T_NONONREG { - ConfigFileEntry.oper_umodes |= UMODE_REGONLY; + ConfigGeneral.oper_umodes |= UMODE_REGONLY; } | T_FARCONNECT { - ConfigFileEntry.oper_umodes |= UMODE_FARCONNECT; + ConfigGeneral.oper_umodes |= UMODE_FARCONNECT; }; general_oper_only_umodes: OPER_ONLY_UMODES { - ConfigFileEntry.oper_only_umodes = 0; + ConfigGeneral.oper_only_umodes = 0; } '=' umode_items ';' ; umode_items: umode_items ',' umode_item | umode_item; umode_item: T_BOTS { - ConfigFileEntry.oper_only_umodes |= UMODE_BOTS; + ConfigGeneral.oper_only_umodes |= UMODE_BOTS; } | T_CCONN { - ConfigFileEntry.oper_only_umodes |= UMODE_CCONN; + ConfigGeneral.oper_only_umodes |= UMODE_CCONN; } | T_DEAF { - ConfigFileEntry.oper_only_umodes |= UMODE_DEAF; + ConfigGeneral.oper_only_umodes |= UMODE_DEAF; } | T_DEBUG { - ConfigFileEntry.oper_only_umodes |= UMODE_DEBUG; + ConfigGeneral.oper_only_umodes |= UMODE_DEBUG; } | T_FULL { - ConfigFileEntry.oper_only_umodes |= UMODE_FULL; + ConfigGeneral.oper_only_umodes |= UMODE_FULL; } | T_SKILL { - ConfigFileEntry.oper_only_umodes |= UMODE_SKILL; + ConfigGeneral.oper_only_umodes |= UMODE_SKILL; } | HIDDEN { - ConfigFileEntry.oper_only_umodes |= UMODE_HIDDEN; + ConfigGeneral.oper_only_umodes |= UMODE_HIDDEN; } | T_NCHANGE { - ConfigFileEntry.oper_only_umodes |= UMODE_NCHANGE; + ConfigGeneral.oper_only_umodes |= UMODE_NCHANGE; } | T_REJ { - ConfigFileEntry.oper_only_umodes |= UMODE_REJ; + ConfigGeneral.oper_only_umodes |= UMODE_REJ; } | T_UNAUTH { - ConfigFileEntry.oper_only_umodes |= UMODE_UNAUTH; + ConfigGeneral.oper_only_umodes |= UMODE_UNAUTH; } | T_SPY { - ConfigFileEntry.oper_only_umodes |= UMODE_SPY; + ConfigGeneral.oper_only_umodes |= UMODE_SPY; } | T_EXTERNAL { - ConfigFileEntry.oper_only_umodes |= UMODE_EXTERNAL; + ConfigGeneral.oper_only_umodes |= UMODE_EXTERNAL; } | T_SERVNOTICE { - ConfigFileEntry.oper_only_umodes |= UMODE_SERVNOTICE; + ConfigGeneral.oper_only_umodes |= UMODE_SERVNOTICE; } | T_INVISIBLE { - ConfigFileEntry.oper_only_umodes |= UMODE_INVISIBLE; + ConfigGeneral.oper_only_umodes |= UMODE_INVISIBLE; } | T_WALLOP { - ConfigFileEntry.oper_only_umodes |= UMODE_WALLOP; + ConfigGeneral.oper_only_umodes |= UMODE_WALLOP; } | T_SOFTCALLERID { - ConfigFileEntry.oper_only_umodes |= UMODE_SOFTCALLERID; + ConfigGeneral.oper_only_umodes |= UMODE_SOFTCALLERID; } | T_CALLERID { - ConfigFileEntry.oper_only_umodes |= UMODE_CALLERID; + ConfigGeneral.oper_only_umodes |= UMODE_CALLERID; } | T_LOCOPS { - ConfigFileEntry.oper_only_umodes |= UMODE_LOCOPS; + ConfigGeneral.oper_only_umodes |= UMODE_LOCOPS; } | T_NONONREG { - ConfigFileEntry.oper_only_umodes |= UMODE_REGONLY; + ConfigGeneral.oper_only_umodes |= UMODE_REGONLY; } | T_FARCONNECT { - ConfigFileEntry.oper_only_umodes |= UMODE_FARCONNECT; + ConfigGeneral.oper_only_umodes |= UMODE_FARCONNECT; }; general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';' { - ConfigFileEntry.min_nonwildcard = $3; + ConfigGeneral.min_nonwildcard = $3; }; general_min_nonwildcard_simple: MIN_NONWILDCARD_SIMPLE '=' NUMBER ';' { - ConfigFileEntry.min_nonwildcard_simple = $3; + ConfigGeneral.min_nonwildcard_simple = $3; }; general_default_floodcount: DEFAULT_FLOODCOUNT '=' NUMBER ';' { - ConfigFileEntry.default_floodcount = $3; + ConfigGeneral.default_floodcount = $3; }; /*************************************************************************** - * section channel + * channel {} section ***************************************************************************/ -channel_entry: CHANNEL - '{' channel_items '}' ';'; +channel_entry: CHANNEL '{' channel_items '}' ';'; channel_items: channel_items channel_item | channel_item; channel_item: channel_max_bans | channel_invite_client_count | channel_invite_client_time | + channel_invite_delay_channel | channel_knock_client_count | channel_knock_client_time | channel_knock_delay_channel | channel_max_channels | - channel_default_split_user_count | - channel_default_split_server_count | - channel_no_create_on_split | - channel_no_join_on_split | - channel_jflood_count | - channel_jflood_time | + channel_default_join_flood_count | + channel_default_join_flood_time | channel_disable_fake_channels | error; @@ -2948,6 +2907,11 @@ channel_invite_client_time: INVITE_CLIEN ConfigChannel.invite_client_time = $3; }; +channel_invite_delay_channel: INVITE_DELAY_CHANNEL '=' timespec ';' +{ + ConfigChannel.invite_delay_channel = $3; +}; + channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';' { ConfigChannel.knock_client_count = $3; @@ -2973,48 +2937,29 @@ channel_max_bans: MAX_BANS '=' NUMBER '; ConfigChannel.max_bans = $3; }; -channel_default_split_user_count: DEFAULT_SPLIT_USER_COUNT '=' NUMBER ';' -{ - ConfigChannel.default_split_user_count = $3; -}; - -channel_default_split_server_count: DEFAULT_SPLIT_SERVER_COUNT '=' NUMBER ';' -{ - ConfigChannel.default_split_server_count = $3; -}; - -channel_no_create_on_split: NO_CREATE_ON_SPLIT '=' TBOOL ';' -{ - ConfigChannel.no_create_on_split = yylval.number; -}; - -channel_no_join_on_split: NO_JOIN_ON_SPLIT '=' TBOOL ';' +channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';' { - ConfigChannel.no_join_on_split = yylval.number; + ConfigChannel.default_join_flood_count = yylval.number; }; -channel_jflood_count: JOIN_FLOOD_COUNT '=' NUMBER ';' +channel_default_join_flood_time: DEFAULT_JOIN_FLOOD_TIME '=' timespec ';' { - GlobalSetOptions.joinfloodcount = yylval.number; + ConfigChannel.default_join_flood_time = $3; }; -channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';' -{ - GlobalSetOptions.joinfloodtime = $3; -}; /*************************************************************************** - * section serverhide + * serverhide {} section ***************************************************************************/ -serverhide_entry: SERVERHIDE - '{' serverhide_items '}' ';'; +serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';'; serverhide_items: serverhide_items serverhide_item | serverhide_item; serverhide_item: serverhide_flatten_links | + serverhide_flatten_links_delay | + serverhide_flatten_links_file | serverhide_disable_remote_commands | serverhide_hide_servers | serverhide_hide_services | - serverhide_links_delay | serverhide_hidden | serverhide_hidden_name | serverhide_hide_server_ips | @@ -3026,6 +2971,31 @@ serverhide_flatten_links: FLATTEN_LINKS ConfigServerHide.flatten_links = yylval.number; }; +serverhide_flatten_links_delay: FLATTEN_LINKS_DELAY '=' timespec ';' +{ + if (conf_parser_ctx.pass == 2) + { + if ($3 > 0) + { + event_write_links_file.when = $3; + event_add(&event_write_links_file, NULL); + } + else + event_delete(&event_write_links_file); + + ConfigServerHide.flatten_links_delay = $3; + } +}; + +serverhide_flatten_links_file: FLATTEN_LINKS_FILE '=' QSTRING ';' +{ + if (conf_parser_ctx.pass == 2) + { + xfree(ConfigServerHide.flatten_links_file); + ConfigServerHide.flatten_links_file = xstrdup(yylval.string); + } +}; + serverhide_disable_remote_commands: DISABLE_REMOTE_COMMANDS '=' TBOOL ';' { if (conf_parser_ctx.pass == 2) @@ -3048,25 +3018,11 @@ serverhide_hidden_name: HIDDEN_NAME '=' { if (conf_parser_ctx.pass == 2) { - MyFree(ConfigServerHide.hidden_name); + xfree(ConfigServerHide.hidden_name); ConfigServerHide.hidden_name = xstrdup(yylval.string); } }; -serverhide_links_delay: LINKS_DELAY '=' timespec ';' -{ - if (conf_parser_ctx.pass == 2) - { - if (($3 > 0) && ConfigServerHide.links_disabled == 1) - { - eventAddIsh("write_links_file", write_links_file, NULL, $3); - ConfigServerHide.links_disabled = 0; - } - - ConfigServerHide.links_delay = $3; - } -}; - serverhide_hidden: HIDDEN '=' TBOOL ';' { if (conf_parser_ctx.pass == 2)