--- ircd-hybrid/trunk/src/conf_parser.y 2013/06/16 13:29:13 2252 +++ ircd-hybrid/trunk/src/conf_parser.y 2014/08/24 10:27:40 4565 @@ -1,8 +1,7 @@ /* - * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). - * conf_parser.y: Parses the ircd configuration file. + * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) * - * Copyright (C) 2005 by the past and present ircd coders, and others. + * Copyright (c) 2000-2014 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 @@ -16,12 +15,16 @@ * * 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 - * - * $Id$ */ +/*! \file conf_parser.y + * \brief Parses the ircd configuration file. + * \version $Id$ + */ + + %{ #define YY_NO_UNPUT @@ -34,19 +37,20 @@ #include "list.h" #include "conf.h" #include "conf_class.h" +#include "conf_pseudo.h" #include "event.h" #include "log.h" #include "client.h" /* for UMODE_ALL only */ #include "irc_string.h" #include "memory.h" #include "modules.h" -#include "s_serv.h" +#include "server.h" #include "hostmask.h" #include "send.h" #include "listener.h" #include "resv.h" #include "numeric.h" -#include "s_user.h" +#include "user.h" #include "motd.h" #ifdef HAVE_LIBCRYPTO @@ -62,15 +66,18 @@ int yylex(void); static struct { - struct { + struct + { dlink_list list; } mask, leaf, hub; - struct { + struct + { char buf[IRCD_BUFSIZE]; } name, + nick, user, host, addr, @@ -80,9 +87,13 @@ static struct cert, rpass, spass, - class; + class, + target, + prepend, + command; - struct { + struct + { unsigned int value; } flags, modes, @@ -101,6 +112,7 @@ static struct max_ident, max_sendq, max_recvq, + max_channels, cidr_bitlen_ipv4, cidr_bitlen_ipv6, number_per_cidr; @@ -148,6 +160,8 @@ 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 @@ -157,6 +171,7 @@ reset_block_state(void) %token CLASS %token CONNECT %token CONNECTFREQ +%token CYCLE_ON_HOST_CHANGE %token DEFAULT_FLOODCOUNT %token DEFAULT_SPLIT_SERVER_COUNT %token DEFAULT_SPLIT_USER_COUNT @@ -187,6 +202,8 @@ reset_block_state(void) %token HAVENT_READ_CONF %token HIDDEN %token HIDDEN_NAME +%token HIDE_CHANS +%token HIDE_IDLE %token HIDE_IDLE_FROM_OPERS %token HIDE_SERVER_IPS %token HIDE_SERVERS @@ -197,6 +214,8 @@ reset_block_state(void) %token HUB_MASK %token IGNORE_BOGUS_TS %token INVISIBLE_ON_CONNECT +%token INVITE_CLIENT_COUNT +%token INVITE_CLIENT_TIME %token IP %token IRCD_AUTH %token IRCD_FLAGS @@ -207,7 +226,8 @@ reset_block_state(void) %token KILL_CHASE_TIME_LIMIT %token KLINE %token KLINE_EXEMPT -%token KNOCK_DELAY +%token KNOCK_CLIENT_COUNT +%token KNOCK_CLIENT_TIME %token KNOCK_DELAY_CHANNEL %token LEAF_MASK %token LINKS_DELAY @@ -215,8 +235,7 @@ reset_block_state(void) %token MASK %token MAX_ACCEPT %token MAX_BANS -%token MAX_CHANS_PER_OPER -%token MAX_CHANS_PER_USER +%token MAX_CHANNELS %token MAX_GLOBAL %token MAX_IDENT %token MAX_IDLE @@ -283,16 +302,20 @@ 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 STATS_E_DISABLED %token STATS_I_OPER_ONLY %token STATS_K_OPER_ONLY %token STATS_O_OPER_ONLY %token STATS_P_OPER_ONLY +%token STATS_U_OPER_ONLY %token T_ALL %token T_BOTS %token T_CALLERID %token T_CCONN +%token T_COMMAND %token T_CLUSTER %token T_DEAF %token T_DEBUG @@ -310,13 +333,13 @@ reset_block_state(void) %token T_MAX_CLIENTS %token T_NCHANGE %token T_NONONREG -%token T_OPERWALL +%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 @@ -326,10 +349,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 @@ -340,6 +360,7 @@ reset_block_state(void) %token T_WALLOPS %token T_WEBIRC %token TBOOL +%token THROTTLE_COUNT %token THROTTLE_TIME %token TKLINE_EXPIRE_NOTICES %token TMASKED @@ -354,7 +375,7 @@ reset_block_state(void) %token USER %token VHOST %token VHOST6 -%token WARN_NO_NLINE +%token WARN_NO_CONNECT_BLOCK %token XLINE %type QSTRING @@ -365,77 +386,54 @@ reset_block_state(void) %type sizespec_ %% -conf: +conf: | conf conf_item ; conf_item: admin_entry | logging_entry | oper_entry - | channel_entry - | class_entry + | channel_entry + | class_entry | listen_entry | auth_entry | serverinfo_entry - | serverhide_entry + | serverhide_entry | resv_entry | service_entry | shared_entry - | cluster_entry + | cluster_entry | connect_entry | kill_entry | deny_entry - | exempt_entry - | general_entry + | exempt_entry + | general_entry | gecos_entry | modules_entry | motd_entry + | pseudo_entry | error ';' | error '}' ; timespec_: { $$ = 0; } | timespec; -timespec: NUMBER timespec_ - { - $$ = $1 + $2; - } - | NUMBER SECONDS timespec_ - { - $$ = $1 + $3; - } - | NUMBER MINUTES timespec_ - { - $$ = $1 * 60 + $3; - } - | NUMBER HOURS timespec_ - { - $$ = $1 * 60 * 60 + $3; - } - | NUMBER DAYS timespec_ - { - $$ = $1 * 60 * 60 * 24 + $3; - } - | NUMBER WEEKS timespec_ - { - $$ = $1 * 60 * 60 * 24 * 7 + $3; - } - | NUMBER MONTHS timespec_ - { - $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3; - } - | NUMBER YEARS timespec_ - { - $$ = $1 * 60 * 60 * 24 * 365 + $3; - } - ; - -sizespec_: { $$ = 0; } | sizespec; -sizespec: NUMBER sizespec_ { $$ = $1 + $2; } - | NUMBER BYTES sizespec_ { $$ = $1 + $3; } - | NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } - | NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; } - ; +timespec: NUMBER timespec_ { $$ = $1 + $2; } | + NUMBER SECONDS timespec_ { $$ = $1 + $3; } | + NUMBER MINUTES timespec_ { $$ = $1 * 60 + $3; } | + NUMBER HOURS timespec_ { $$ = $1 * 60 * 60 + $3; } | + NUMBER DAYS timespec_ { $$ = $1 * 60 * 60 * 24 + $3; } | + NUMBER WEEKS timespec_ { $$ = $1 * 60 * 60 * 24 * 7 + $3; } | + NUMBER MONTHS timespec_ { $$ = $1 * 60 * 60 * 24 * 7 * 4 + $3; } | + NUMBER YEARS timespec_ { $$ = $1 * 60 * 60 * 24 * 365 + $3; } + ; + +sizespec_: { $$ = 0; } | sizespec; +sizespec: NUMBER sizespec_ { $$ = $1 + $2; } | + NUMBER BYTES sizespec_ { $$ = $1 + $3; } | + NUMBER KBYTES sizespec_ { $$ = $1 * 1024 + $3; } | + NUMBER MBYTES sizespec_ { $$ = $1 * 1024 * 1024 + $3; } + ; /*************************************************************************** @@ -463,65 +461,40 @@ modules_path: PATH '=' QSTRING ';' serverinfo_entry: SERVERINFO '{' serverinfo_items '}' ';'; serverinfo_items: serverinfo_items serverinfo_item | serverinfo_item ; -serverinfo_item: serverinfo_name | serverinfo_vhost | - serverinfo_hub | serverinfo_description | - serverinfo_network_name | serverinfo_network_desc | - serverinfo_max_clients | serverinfo_max_nick_length | - serverinfo_max_topic_length | serverinfo_ssl_dh_param_file | - serverinfo_rsa_private_key_file | serverinfo_vhost6 | - serverinfo_sid | serverinfo_ssl_certificate_file | - serverinfo_ssl_client_method | serverinfo_ssl_server_method | +serverinfo_item: serverinfo_name | + serverinfo_vhost | + serverinfo_hub | + serverinfo_description | + serverinfo_network_name | + serverinfo_network_desc | + serverinfo_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_cipher_list | - error ';' ; + serverinfo_ssl_message_digest_algorithm | + 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) + if (!ConfigServerInfo.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, + if (SSL_CTX_use_certificate_file(ConfigServerInfo.server_ctx, yylval.string, SSL_FILETYPE_PEM) <= 0 || - SSL_CTX_use_certificate_file(ServerInfo.client_ctx, yylval.string, + SSL_CTX_use_certificate_file(ConfigServerInfo.client_ctx, yylval.string, SSL_FILETYPE_PEM) <= 0) { report_crypto_errors(); @@ -529,9 +502,9 @@ serverinfo_ssl_certificate_file: SSL_CER break; } - if (SSL_CTX_use_PrivateKey_file(ServerInfo.server_ctx, ServerInfo.rsa_private_key_file, + if (SSL_CTX_use_PrivateKey_file(ConfigServerInfo.server_ctx, ConfigServerInfo.rsa_private_key_file, SSL_FILETYPE_PEM) <= 0 || - SSL_CTX_use_PrivateKey_file(ServerInfo.client_ctx, ServerInfo.rsa_private_key_file, + SSL_CTX_use_PrivateKey_file(ConfigServerInfo.client_ctx, ConfigServerInfo.rsa_private_key_file, SSL_FILETYPE_PEM) <= 0) { report_crypto_errors(); @@ -539,8 +512,8 @@ serverinfo_ssl_certificate_file: SSL_CER break; } - if (!SSL_CTX_check_private_key(ServerInfo.server_ctx) || - !SSL_CTX_check_private_key(ServerInfo.client_ctx)) + if (!SSL_CTX_check_private_key(ConfigServerInfo.server_ctx) || + !SSL_CTX_check_private_key(ConfigServerInfo.client_ctx)) { report_crypto_errors(); conf_error_report("Could not read RSA private key"); @@ -558,19 +531,19 @@ serverinfo_rsa_private_key_file: RSA_PRI if (conf_parser_ctx.pass != 1) break; - if (ServerInfo.rsa_private_key) + if (ConfigServerInfo.rsa_private_key) { - RSA_free(ServerInfo.rsa_private_key); - ServerInfo.rsa_private_key = NULL; + RSA_free(ConfigServerInfo.rsa_private_key); + ConfigServerInfo.rsa_private_key = NULL; } - if (ServerInfo.rsa_private_key_file) + if (ConfigServerInfo.rsa_private_key_file) { - MyFree(ServerInfo.rsa_private_key_file); - ServerInfo.rsa_private_key_file = NULL; + MyFree(ConfigServerInfo.rsa_private_key_file); + ConfigServerInfo.rsa_private_key_file = NULL; } - ServerInfo.rsa_private_key_file = xstrdup(yylval.string); + ConfigServerInfo.rsa_private_key_file = xstrdup(yylval.string); if ((file = BIO_new_file(yylval.string, "r")) == NULL) { @@ -578,42 +551,40 @@ serverinfo_rsa_private_key_file: RSA_PRI break; } - ServerInfo.rsa_private_key = PEM_read_bio_RSAPrivateKey(file, NULL, 0, NULL); + ConfigServerInfo.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) + if (ConfigServerInfo.rsa_private_key == NULL) { conf_error_report("Couldn't extract key, ignoring"); break; } - if (!RSA_check_key(ServerInfo.rsa_private_key)) + if (!RSA_check_key(ConfigServerInfo.rsa_private_key)) { - RSA_free(ServerInfo.rsa_private_key); - ServerInfo.rsa_private_key = NULL; + RSA_free(ConfigServerInfo.rsa_private_key); + ConfigServerInfo.rsa_private_key = NULL; conf_error_report("Invalid key, ignoring"); break; } - /* require 2048 bit (256 byte) key */ - if (RSA_size(ServerInfo.rsa_private_key) != 256) + if (RSA_size(ConfigServerInfo.rsa_private_key) < 128) { - RSA_free(ServerInfo.rsa_private_key); - ServerInfo.rsa_private_key = NULL; + RSA_free(ConfigServerInfo.rsa_private_key); + ConfigServerInfo.rsa_private_key = NULL; - conf_error_report("Not a 2048 bit key, ignoring"); + conf_error_report("Ignoring serverinfo::rsa_private_key_file -- need at least a 1024 bit key size"); } #endif }; serverinfo_ssl_dh_param_file: SSL_DH_PARAM_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"); @@ -628,11 +599,13 @@ serverinfo_ssl_dh_param_file: SSL_DH_PAR 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); + SSL_CTX_set_tmp_dh(ConfigServerInfo.server_ctx, dh); DH_free(dh); } } + else + conf_error_report("Ignoring serverinfo::ssl_dh_param_file -- could not open/read Diffie-Hellman parameter file"); } #endif }; @@ -640,18 +613,60 @@ serverinfo_ssl_dh_param_file: SSL_DH_PAR serverinfo_ssl_cipher_list: T_SSL_CIPHER_LIST '=' 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) + SSL_CTX_set_cipher_list(ConfigServerInfo.server_ctx, yylval.string); +#endif +}; + +serverinfo_ssl_message_digest_algorithm: SSL_MESSAGE_DIGEST_ALGORITHM '=' QSTRING ';' +{ +#ifdef HAVE_LIBCRYPTO + if (conf_parser_ctx.pass == 2) + { + if ((ConfigServerInfo.message_digest_algorithm = EVP_get_digestbyname(yylval.string)) == NULL) + { + ConfigServerInfo.message_digest_algorithm = EVP_sha256(); + conf_error_report("Ignoring serverinfo::ssl_message_digest_algorithm -- unknown message digest algorithm"); + } + } +#endif +} + +serverinfo_ssl_dh_elliptic_curve: SSL_DH_ELLIPTIC_CURVE '=' QSTRING ';' +{ +#ifdef HAVE_LIBCRYPTO +#if OPENSSL_VERSION_NUMBER >= 0x1000005FL && !defined(OPENSSL_NO_ECDH) + int nid = 0; + EC_KEY *key = NULL; + + if (conf_parser_ctx.pass == 2) + { + if ((nid = OBJ_sn2nid(yylval.string)) == 0) + { + conf_error_report("Ignoring serverinfo::serverinfo_ssl_dh_elliptic_curve -- unknown curve name"); + break; + } + + if ((key = EC_KEY_new_by_curve_name(nid)) == NULL) + { + conf_error_report("Ignoring serverinfo::serverinfo_ssl_dh_elliptic_curve -- could not create curve"); + break; + } + + SSL_CTX_set_tmp_ecdh(ConfigServerInfo.server_ctx, key); + EC_KEY_free(key); +} +#endif #endif }; -serverinfo_name: NAME '=' QSTRING ';' +serverinfo_name: NAME '=' QSTRING ';' { /* this isn't rehashable */ - if (conf_parser_ctx.pass == 2 && !ServerInfo.name) + 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."); @@ -660,13 +675,13 @@ serverinfo_name: NAME '=' QSTRING ';' } }; -serverinfo_sid: IRCD_SID '=' QSTRING ';' +serverinfo_sid: IRCD_SID '=' QSTRING ';' { /* this isn't rehashable */ - if (conf_parser_ctx.pass == 2 && !ServerInfo.sid) + 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."); @@ -679,8 +694,9 @@ serverinfo_description: DESCRIPTION '=' { if (conf_parser_ctx.pass == 2) { - MyFree(ServerInfo.description); - ServerInfo.description = xstrdup(yylval.string); + MyFree(ConfigServerInfo.description); + ConfigServerInfo.description = xstrdup(yylval.string); + strlcpy(me.info, ConfigServerInfo.description, sizeof(me.info)); } }; @@ -690,11 +706,11 @@ serverinfo_network_name: NETWORK_NAME '= { char *p; - if ((p = strchr(yylval.string, ' ')) != NULL) - p = '\0'; + if ((p = strchr(yylval.string, ' '))) + *p = '\0'; - MyFree(ServerInfo.network_name); - ServerInfo.network_name = xstrdup(yylval.string); + MyFree(ConfigServerInfo.network_name); + ConfigServerInfo.network_name = xstrdup(yylval.string); } }; @@ -703,8 +719,8 @@ serverinfo_network_desc: NETWORK_DESC '= if (conf_parser_ctx.pass != 2) break; - MyFree(ServerInfo.network_desc); - ServerInfo.network_desc = xstrdup(yylval.string); + MyFree(ConfigServerInfo.network_desc); + ConfigServerInfo.network_desc = xstrdup(yylval.string); }; serverinfo_vhost: VHOST '=' QSTRING ';' @@ -723,21 +739,20 @@ serverinfo_vhost: VHOST '=' QSTRING ';' ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", yylval.string); else { - assert(res != NULL); + 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; @@ -752,17 +767,16 @@ serverinfo_vhost6: VHOST6 '=' QSTRING '; ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost6(%s)", yylval.string); else { - assert(res != NULL); + 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 ';' @@ -772,22 +786,22 @@ serverinfo_max_clients: T_MAX_CLIENTS '= if ($3 < MAXCLIENTS_MIN) { - char buf[IRCD_BUFSIZE]; + char buf[IRCD_BUFSIZE] = ""; snprintf(buf, sizeof(buf), "MAXCLIENTS too low, setting to %d", MAXCLIENTS_MIN); conf_error_report(buf); - ServerInfo.max_clients = MAXCLIENTS_MIN; + ConfigServerInfo.max_clients = MAXCLIENTS_MIN; } else if ($3 > MAXCLIENTS_MAX) { - char buf[IRCD_BUFSIZE]; + char buf[IRCD_BUFSIZE] = ""; snprintf(buf, sizeof(buf), "MAXCLIENTS too high, setting to %d", MAXCLIENTS_MAX); conf_error_report(buf); - ServerInfo.max_clients = MAXCLIENTS_MAX; + ConfigServerInfo.max_clients = MAXCLIENTS_MAX; } else - ServerInfo.max_clients = $3; + ConfigServerInfo.max_clients = $3; }; serverinfo_max_nick_length: MAX_NICK_LENGTH '=' NUMBER ';' @@ -798,18 +812,18 @@ 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) { - char buf[IRCD_BUFSIZE]; + char buf[IRCD_BUFSIZE] = ""; 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 ';' @@ -820,24 +834,24 @@ 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) { - char buf[IRCD_BUFSIZE]; + char buf[IRCD_BUFSIZE] = ""; 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 ';' +serverinfo_hub: HUB '=' TBOOL ';' { if (conf_parser_ctx.pass == 2) - ServerInfo.hub = yylval.number; + ConfigServerInfo.hub = yylval.number; }; /*************************************************************************** @@ -846,16 +860,18 @@ serverinfo_hub: HUB '=' TBOOL ';' admin_entry: ADMIN '{' admin_items '}' ';' ; admin_items: admin_items admin_item | admin_item; -admin_item: admin_name | admin_description | - admin_email | error ';' ; +admin_item: admin_name | + admin_description | + admin_email | + error ';' ; -admin_name: NAME '=' QSTRING ';' +admin_name: NAME '=' QSTRING ';' { if (conf_parser_ctx.pass != 2) break; - MyFree(AdminInfo.name); - AdminInfo.name = xstrdup(yylval.string); + MyFree(ConfigAdminInfo.name); + ConfigAdminInfo.name = xstrdup(yylval.string); }; admin_email: EMAIL '=' QSTRING ';' @@ -863,8 +879,8 @@ admin_email: EMAIL '=' QSTRING ';' if (conf_parser_ctx.pass != 2) break; - MyFree(AdminInfo.email); - AdminInfo.email = xstrdup(yylval.string); + MyFree(ConfigAdminInfo.email); + ConfigAdminInfo.email = xstrdup(yylval.string); }; admin_description: DESCRIPTION '=' QSTRING ';' @@ -872,14 +888,14 @@ admin_description: DESCRIPTION '=' QSTRI if (conf_parser_ctx.pass != 2) break; - MyFree(AdminInfo.description); - AdminInfo.description = xstrdup(yylval.string); + MyFree(ConfigAdminInfo.description); + ConfigAdminInfo.description = xstrdup(yylval.string); }; /*************************************************************************** * motd section ***************************************************************************/ -motd_entry: MOTD +motd_entry: MOTD { if (conf_parser_ctx.pass == 2) reset_block_state(); @@ -900,7 +916,7 @@ motd_entry: MOTD motd_items: motd_items motd_item | motd_item; motd_item: motd_mask | motd_file | error ';' ; -motd_mask: MASK '=' QSTRING ';' +motd_mask: MASK '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.mask.list); @@ -913,18 +929,81 @@ motd_file: T_FILE '=' QSTRING ';' }; /*************************************************************************** + * 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.user.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); + + strlcpy(block_state.nick.buf, nuh.userptr, sizeof(block_state.nick.buf)); + strlcpy(block_state.host.buf, nuh.hostptr, sizeof(block_state.host.buf)); + } +}; + +/*************************************************************************** * section logging ***************************************************************************/ logging_entry: T_LOG '{' logging_items '}' ';' ; logging_items: logging_items logging_item | logging_item ; -logging_item: logging_use_logging | logging_file_entry | - error ';' ; +logging_item: logging_use_logging | logging_file_entry | + error ';' ; 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: @@ -982,6 +1061,14 @@ logging_file_type_item: USER { if (conf_parser_ctx.pass == 2) block_state.type.value = LOG_TYPE_GLINE; +} | XLINE +{ + if (conf_parser_ctx.pass == 2) + block_state.type.value = LOG_TYPE_XLINE; +} | RESV +{ + if (conf_parser_ctx.pass == 2) + block_state.type.value = LOG_TYPE_RESV; } | T_DLINE { if (conf_parser_ctx.pass == 2) @@ -1004,7 +1091,7 @@ logging_file_type_item: USER /*************************************************************************** * section oper ***************************************************************************/ -oper_entry: OPERATOR +oper_entry: OPERATOR { if (conf_parser_ctx.pass != 2) break; @@ -1069,14 +1156,20 @@ oper_entry: OPERATOR if ((file = BIO_new_file(block_state.file.buf, "r")) == NULL) { - conf_error_report("Ignoring rsa_public_key_file -- file doesn't exist"); + ilog(LOG_TYPE_IRCD, "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."); + ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- key invalid; check key syntax"); + else + { + if (RSA_size(pkey) > 128) + ilog(LOG_TYPE_IRCD, "Ignoring rsa_public_key_file -- key size must be 1024 or below"); + else + conf->rsa_public_key = pkey; + } - conf->rsa_public_key = pkey; BIO_set_close(file, BIO_CLOSE); BIO_free(file); } @@ -1085,11 +1178,17 @@ oper_entry: OPERATOR }; oper_items: oper_items oper_item | oper_item; -oper_item: oper_name | oper_user | oper_password | - oper_umodes | oper_class | oper_encrypted | - oper_rsa_public_key_file | oper_ssl_certificate_fingerprint | - oper_ssl_connection_required | - oper_flags | error ';' ; +oper_item: oper_name | + oper_user | + oper_password | + oper_umodes | + oper_class | + oper_encrypted | + oper_rsa_public_key_file | + oper_ssl_certificate_fingerprint | + oper_ssl_connection_required | + oper_flags | + error ';' ; oper_name: NAME '=' QSTRING ';' { @@ -1180,6 +1279,14 @@ oper_umodes_item: T_BOTS { if (conf_parser_ctx.pass == 2) block_state.modes.value |= UMODE_HIDDEN; +} | HIDE_CHANS +{ + if (conf_parser_ctx.pass == 2) + block_state.modes.value |= UMODE_HIDECHANS; +} | HIDE_IDLE +{ + if (conf_parser_ctx.pass == 2) + block_state.modes.value |= UMODE_HIDEIDLE; } | T_SKILL { if (conf_parser_ctx.pass == 2) @@ -1204,10 +1311,6 @@ oper_umodes_item: T_BOTS { if (conf_parser_ctx.pass == 2) block_state.modes.value |= UMODE_EXTERNAL; -} | T_OPERWALL -{ - if (conf_parser_ctx.pass == 2) - block_state.modes.value |= UMODE_OPERWALL; } | T_SERVNOTICE { if (conf_parser_ctx.pass == 2) @@ -1276,7 +1379,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) @@ -1292,7 +1395,11 @@ oper_flags_item: KILL ':' REMOTE } | XLINE { if (conf_parser_ctx.pass == 2) - block_state.port.value |= OPER_FLAG_X; + block_state.port.value |= OPER_FLAG_XLINE; +} | T_UNXLINE +{ + if (conf_parser_ctx.pass == 2) + block_state.port.value |= OPER_FLAG_UNXLINE; } | GLINE { if (conf_parser_ctx.pass == 2) @@ -1313,10 +1420,6 @@ oper_flags_item: KILL ':' REMOTE { if (conf_parser_ctx.pass == 2) block_state.port.value |= OPER_FLAG_ADMIN; -} | T_OPERWALL -{ - if (conf_parser_ctx.pass == 2) - block_state.port.value |= OPER_FLAG_OPERWALL; } | T_GLOBOPS { if (conf_parser_ctx.pass == 2) @@ -1384,6 +1487,7 @@ class_entry: CLASS 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; if (block_state.min_idle.value > block_state.max_idle.value) { @@ -1410,22 +1514,24 @@ class_entry: CLASS class_items: class_items class_item | class_item; class_item: class_name | - class_cidr_bitlen_ipv4 | class_cidr_bitlen_ipv6 | + class_cidr_bitlen_ipv4 | + class_cidr_bitlen_ipv6 | class_ping_time | - class_number_per_cidr | + class_number_per_cidr | class_number_per_ip | class_connectfreq | + class_max_channels | class_max_number | - class_max_global | - class_max_local | - class_max_ident | + class_max_global | + class_max_local | + class_max_ident | class_sendq | class_recvq | class_min_idle | class_max_idle | class_flags | - error ';' ; + error ';' ; -class_name: NAME '=' QSTRING ';' +class_name: NAME '=' QSTRING ';' { if (conf_parser_ctx.pass == 1) strlcpy(block_state.class.buf, yylval.string, sizeof(block_state.class.buf)); @@ -1449,6 +1555,12 @@ class_connectfreq: CONNECTFREQ '=' times block_state.con_freq.value = $3; }; +class_max_channels: MAX_CHANNELS '=' NUMBER ';' +{ + if (conf_parser_ctx.pass == 1) + block_state.max_channels.value = $3; +}; + class_max_number: MAX_NUMBER '=' NUMBER ';' { if (conf_parser_ctx.pass == 1) @@ -1580,32 +1692,28 @@ port_item: NUMBER { if (conf_parser_ctx.pass == 2) { +#ifndef HAVE_LIBCRYPTO if (block_state.flags.value & LISTENER_SSL) -#ifdef HAVE_LIBCRYPTO - if (!ServerInfo.server_ctx) + { + conf_error_report("SSL 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); } } | NUMBER TWODOTS NUMBER { if (conf_parser_ctx.pass == 2) { - int i; - +#ifndef HAVE_LIBCRYPTO if (block_state.flags.value & LISTENER_SSL) -#ifdef HAVE_LIBCRYPTO - if (!ServerInfo.server_ctx) + { + conf_error_report("SSL not available - port closed"); + break; + } #endif - { - conf_error_report("SSL not available - port closed"); - break; - } - for (i = $1; i <= $3; ++i) + for (int i = $1; i <= $3; ++i) add_listener(i, block_state.addr.buf, block_state.flags.value); } }; @@ -1665,12 +1773,18 @@ auth_entry: IRCD_AUTH conf_add_class_to_conf(conf, block_state.class.buf); add_conf_by_address(CONF_CLIENT, conf); } -}; +}; auth_items: auth_items auth_item | auth_item; -auth_item: auth_user | auth_passwd | auth_class | auth_flags | - auth_spoof | auth_redir_serv | auth_redir_port | - auth_encrypted | error ';' ; +auth_item: auth_user | + auth_passwd | + auth_class | + auth_flags | + auth_spoof | + auth_redir_serv | + auth_redir_port | + auth_encrypted | + error ';' ; auth_user: USER '=' QSTRING ';' { @@ -1750,12 +1864,12 @@ auth_flags_item: SPOOF_NOTICE block_state.flags.value |= CONF_FLAGS_NEED_PASSWORD; }; -auth_spoof: SPOOF '=' QSTRING ';' +auth_spoof: SPOOF '=' QSTRING ';' { if (conf_parser_ctx.pass != 2) break; - if (strlen(yylval.string) <= HOSTLEN && valid_hostname(yylval.string)) + if (valid_hostname(yylval.string)) { strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf)); block_state.flags.value |= CONF_FLAGS_SPOOF_IP; @@ -1801,8 +1915,8 @@ resv_entry: RESV create_resv(block_state.name.buf, block_state.rpass.buf, &block_state.mask.list); }; -resv_items: resv_items resv_item | resv_item; -resv_item: resv_mask | resv_reason | resv_exempt | error ';' ; +resv_items: resv_items resv_item | resv_item; +resv_item: resv_mask | resv_reason | resv_exempt | error ';' ; resv_mask: MASK '=' QSTRING ';' { @@ -1972,8 +2086,8 @@ cluster_entry: T_CLUSTER conf->name = xstrdup(block_state.name.buf); }; -cluster_items: cluster_items cluster_item | cluster_item; -cluster_item: cluster_name | cluster_type | error ';' ; +cluster_items: cluster_items cluster_item | cluster_item; +cluster_item: cluster_name | cluster_type | error ';' ; cluster_name: NAME '=' QSTRING ';' { @@ -1987,7 +2101,7 @@ cluster_type: TYPE block_state.flags.value = 0; } '=' cluster_types ';' ; -cluster_types: cluster_types ',' cluster_type_item | cluster_type_item; +cluster_types: cluster_types ',' cluster_type_item | cluster_type_item; cluster_type_item: KLINE { if (conf_parser_ctx.pass == 2) @@ -2033,13 +2147,14 @@ cluster_type_item: KLINE /*************************************************************************** * section connect ***************************************************************************/ -connect_entry: CONNECT +connect_entry: CONNECT { if (conf_parser_ctx.pass != 2) break; reset_block_state(); + block_state.aftype.value = AF_INET; block_state.port.value = PORTNUM; } '{' connect_items '}' ';' { @@ -2091,7 +2206,7 @@ connect_entry: CONNECT ilog(LOG_TYPE_IRCD, "Invalid netmask for server vhost(%s)", block_state.bind.buf); else { - assert(res != NULL); + assert(res); memcpy(&conf->bind, res->ai_addr, res->ai_addrlen); conf->bind.ss.ss_family = res->ai_family; @@ -2105,12 +2220,20 @@ connect_entry: CONNECT }; connect_items: connect_items connect_item | connect_item; -connect_item: connect_name | connect_host | connect_vhost | - connect_send_password | connect_accept_password | - connect_ssl_certificate_fingerprint | - connect_aftype | connect_port | connect_ssl_cipher_list | - connect_flags | connect_hub_mask | connect_leaf_mask | - connect_class | connect_encrypted | +connect_item: connect_name | + connect_host | + connect_vhost | + connect_send_password | + connect_accept_password | + connect_ssl_certificate_fingerprint | + connect_aftype | + connect_port | + connect_ssl_cipher_list | + connect_flags | + connect_hub_mask | + connect_leaf_mask | + connect_class | + connect_encrypted | error ';' ; connect_name: NAME '=' QSTRING ';' @@ -2119,18 +2242,18 @@ connect_name: NAME '=' QSTRING ';' strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf)); }; -connect_host: HOST '=' QSTRING ';' +connect_host: HOST '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) strlcpy(block_state.host.buf, yylval.string, sizeof(block_state.host.buf)); }; -connect_vhost: VHOST '=' QSTRING ';' +connect_vhost: VHOST '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) strlcpy(block_state.bind.buf, yylval.string, sizeof(block_state.bind.buf)); }; - + connect_send_password: SEND_PASSWORD '=' QSTRING ';' { if (conf_parser_ctx.pass != 2) @@ -2138,7 +2261,7 @@ connect_send_password: SEND_PASSWORD '=' if ($3[0] == ':') conf_error_report("Server passwords cannot begin with a colon"); - else if (strchr($3, ' ') != NULL) + else if (strchr($3, ' ')) conf_error_report("Server passwords cannot contain spaces"); else strlcpy(block_state.spass.buf, yylval.string, sizeof(block_state.spass.buf)); @@ -2151,7 +2274,7 @@ connect_accept_password: ACCEPT_PASSWORD if ($3[0] == ':') conf_error_report("Server passwords cannot begin with a colon"); - else if (strchr($3, ' ') != NULL) + else if (strchr($3, ' ')) conf_error_report("Server passwords cannot contain spaces"); else strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); @@ -2175,10 +2298,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 @@ -2208,13 +2329,13 @@ connect_encrypted: ENCRYPTED '=' TBOOL ' } }; -connect_hub_mask: HUB_MASK '=' QSTRING ';' +connect_hub_mask: HUB_MASK '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.hub.list); }; -connect_leaf_mask: LEAF_MASK '=' QSTRING ';' +connect_leaf_mask: LEAF_MASK '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) dlinkAdd(xstrdup(yylval.string), make_dlink_node(), &block_state.leaf.list); @@ -2265,7 +2386,7 @@ kill_entry: KILL else conf->reason = xstrdup(CONF_NOREASON); add_conf_by_address(CONF_KLINE, conf); -}; +}; kill_items: kill_items kill_item | kill_item; kill_item: kill_user | kill_reason | error; @@ -2290,7 +2411,7 @@ kill_user: USER '=' QSTRING ';' } }; -kill_reason: REASON '=' QSTRING ';' +kill_reason: REASON '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); @@ -2299,7 +2420,7 @@ kill_reason: REASON '=' QSTRING ';' /*************************************************************************** * section deny ***************************************************************************/ -deny_entry: DENY +deny_entry: DENY { if (conf_parser_ctx.pass == 2) reset_block_state(); @@ -2324,7 +2445,7 @@ deny_entry: DENY conf->reason = xstrdup(CONF_NOREASON); add_conf_by_address(CONF_DLINE, conf); } -}; +}; deny_items: deny_items deny_item | deny_item; deny_item: deny_ip | deny_reason | error; @@ -2335,7 +2456,7 @@ deny_ip: IP '=' QSTRING ';' strlcpy(block_state.addr.buf, yylval.string, sizeof(block_state.addr.buf)); }; -deny_reason: REASON '=' QSTRING ';' +deny_reason: REASON '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); @@ -2392,13 +2513,13 @@ gecos_entry: GECOS gecos_items: gecos_items gecos_item | gecos_item; gecos_item: gecos_name | gecos_reason | error; -gecos_name: NAME '=' QSTRING ';' +gecos_name: NAME '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) strlcpy(block_state.name.buf, yylval.string, sizeof(block_state.name.buf)); }; -gecos_reason: REASON '=' QSTRING ';' +gecos_reason: REASON '=' QSTRING ';' { if (conf_parser_ctx.pass == 2) strlcpy(block_state.rpass.buf, yylval.string, sizeof(block_state.rpass.buf)); @@ -2411,128 +2532,166 @@ general_entry: GENERAL '{' general_items '}' ';'; general_items: general_items general_item | general_item; -general_item: general_hide_spoof_ips | general_ignore_bogus_ts | - general_failed_oper_notice | general_anti_nick_flood | - general_max_nick_time | general_max_nick_changes | - general_max_accept | general_anti_spam_exit_message_time | - general_ts_warn_delta | general_ts_max_delta | +general_item: general_away_count | + general_away_time | + general_hide_spoof_ips | + general_ignore_bogus_ts | + general_failed_oper_notice | + general_anti_nick_flood | + general_max_nick_time | + general_max_nick_changes | + general_max_accept | + general_anti_spam_exit_message_time | + general_ts_warn_delta | + general_ts_max_delta | general_kill_chase_time_limit | general_invisible_on_connect | - general_warn_no_nline | 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_P_oper_only | - 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 | general_default_floodcount | - general_min_nonwildcard | general_min_nonwildcard_simple | - general_throttle_time | general_havent_read_conf | + 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_P_oper_only | + general_stats_u_oper_only | + general_short_motd | + general_no_oper_flood | + general_true_no_oper_flood | + general_oper_pass_resv | + general_oper_only_umodes | + general_max_targets | + general_oper_umodes | + general_caller_id_wait | + general_opers_bypass_callerid | + general_default_floodcount | + general_min_nonwildcard | + 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_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_stats_e_disabled | - general_max_watch | general_services_name | - error; + general_stats_e_disabled | + general_max_watch | + general_cycle_on_host_change | + error; +general_away_count: AWAY_COUNT '=' NUMBER ';' +{ + ConfigGeneral.away_count = $3; +}; + +general_away_time: AWAY_TIME '=' timespec ';' +{ + ConfigGeneral.away_time = $3; +}; + general_max_watch: MAX_WATCH '=' NUMBER ';' { - ConfigFileEntry.max_watch = $3; + ConfigGeneral.max_watch = $3; +}; + +general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';' +{ + if (conf_parser_ctx.pass == 2) + ConfigGeneral.cycle_on_host_change = yylval.number; }; general_gline_enable: GLINE_ENABLE '=' TBOOL ';' { if (conf_parser_ctx.pass == 2) - ConfigFileEntry.glines = yylval.number; + ConfigGeneral.glines = yylval.number; }; general_gline_duration: GLINE_DURATION '=' timespec ';' { if (conf_parser_ctx.pass == 2) - ConfigFileEntry.gline_time = $3; + ConfigGeneral.gline_time = $3; }; general_gline_request_duration: GLINE_REQUEST_DURATION '=' timespec ';' { if (conf_parser_ctx.pass == 2) - ConfigFileEntry.gline_request_time = $3; + ConfigGeneral.gline_request_time = $3; }; general_gline_min_cidr: GLINE_MIN_CIDR '=' NUMBER ';' { - ConfigFileEntry.gline_min_cidr = $3; + ConfigGeneral.gline_min_cidr = $3; }; general_gline_min_cidr6: GLINE_MIN_CIDR6 '=' NUMBER ';' { - ConfigFileEntry.gline_min_cidr6 = $3; + ConfigGeneral.gline_min_cidr6 = $3; }; general_tkline_expire_notices: TKLINE_EXPIRE_NOTICES '=' TBOOL ';' { - ConfigFileEntry.tkline_expire_notices = yylval.number; + ConfigGeneral.tkline_expire_notices = yylval.number; }; general_kill_chase_time_limit: KILL_CHASE_TIME_LIMIT '=' timespec ';' { - ConfigFileEntry.kill_chase_time_limit = $3; + ConfigGeneral.kill_chase_time_limit = $3; }; general_hide_spoof_ips: HIDE_SPOOF_IPS '=' TBOOL ';' { - ConfigFileEntry.hide_spoof_ips = yylval.number; + ConfigGeneral.hide_spoof_ips = yylval.number; }; 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; + ConfigGeneral.ts_max_delta = $3; }; general_havent_read_conf: HAVENT_READ_CONF '=' NUMBER ';' @@ -2548,288 +2707,275 @@ general_havent_read_conf: HAVENT_READ_CO general_invisible_on_connect: INVISIBLE_ON_CONNECT '=' TBOOL ';' { - ConfigFileEntry.invisible_on_connect = yylval.number; + ConfigGeneral.invisible_on_connect = yylval.number; }; -general_warn_no_nline: WARN_NO_NLINE '=' TBOOL ';' +general_warn_no_connect_block: WARN_NO_CONNECT_BLOCK '=' TBOOL ';' { - ConfigFileEntry.warn_no_nline = 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_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 ';' +{ + 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; + ConfigGeneral.no_oper_flood = yylval.number; }; general_true_no_oper_flood: TRUE_NO_OPER_FLOOD '=' TBOOL ';' { - ConfigFileEntry.true_no_oper_flood = yylval.number; + ConfigGeneral.true_no_oper_flood = yylval.number; }; general_oper_pass_resv: OPER_PASS_RESV '=' TBOOL ';' { - ConfigFileEntry.oper_pass_resv = yylval.number; + ConfigGeneral.oper_pass_resv = 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; + ConfigGeneral.max_targets = $3; }; -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 ';' +general_ping_cookie: PING_COOKIE '=' TBOOL ';' { - if (conf_parser_ctx.pass == 2 && valid_servname(yylval.string)) - { - MyFree(ConfigFileEntry.service_name); - ConfigFileEntry.service_name = xstrdup(yylval.string); - } + ConfigGeneral.ping_cookie = yylval.number; }; -general_ping_cookie: PING_COOKIE '=' TBOOL ';' +general_disable_auth: DISABLE_AUTH '=' TBOOL ';' { - ConfigFileEntry.ping_cookie = yylval.number; + ConfigGeneral.disable_auth = yylval.number; }; -general_disable_auth: DISABLE_AUTH '=' TBOOL ';' +general_throttle_count: THROTTLE_COUNT '=' NUMBER ';' { - ConfigFileEntry.disable_auth = yylval.number; + ConfigGeneral.throttle_count = $3; }; general_throttle_time: THROTTLE_TIME '=' timespec ';' { - ConfigFileEntry.throttle_time = yylval.number; + 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 +{ + ConfigGeneral.oper_umodes |= UMODE_HIDECHANS; +} | HIDE_IDLE +{ + 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; -} | T_OPERWALL -{ - ConfigFileEntry.oper_umodes |= UMODE_OPERWALL; + 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 +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 +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; -} | T_OPERWALL -{ - ConfigFileEntry.oper_only_umodes |= UMODE_OPERWALL; + 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; }; @@ -2841,38 +2987,54 @@ channel_entry: CHANNEL channel_items: channel_items channel_item | channel_item; channel_item: channel_max_bans | - channel_knock_delay | channel_knock_delay_channel | - channel_max_chans_per_user | channel_max_chans_per_oper | + channel_invite_client_count | + channel_invite_client_time | + 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_disable_fake_channels | error; + channel_jflood_count | + channel_jflood_time | + channel_disable_fake_channels | + error; channel_disable_fake_channels: DISABLE_FAKE_CHANNELS '=' TBOOL ';' { ConfigChannel.disable_fake_channels = yylval.number; }; -channel_knock_delay: KNOCK_DELAY '=' timespec ';' +channel_invite_client_count: INVITE_CLIENT_COUNT '=' NUMBER ';' { - ConfigChannel.knock_delay = $3; + ConfigChannel.invite_client_count = $3; }; -channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';' +channel_invite_client_time: INVITE_CLIENT_TIME '=' timespec ';' { - ConfigChannel.knock_delay_channel = $3; + ConfigChannel.invite_client_time = $3; +}; + +channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';' +{ + ConfigChannel.knock_client_count = $3; +}; + +channel_knock_client_time: KNOCK_CLIENT_TIME '=' timespec ';' +{ + ConfigChannel.knock_client_time = $3; }; -channel_max_chans_per_user: MAX_CHANS_PER_USER '=' NUMBER ';' +channel_knock_delay_channel: KNOCK_DELAY_CHANNEL '=' timespec ';' { - ConfigChannel.max_chans_per_user = $3; + ConfigChannel.knock_delay_channel = $3; }; -channel_max_chans_per_oper: MAX_CHANS_PER_OPER '=' NUMBER ';' +channel_max_channels: MAX_CHANNELS '=' NUMBER ';' { - ConfigChannel.max_chans_per_oper = $3; + ConfigChannel.max_channels = $3; }; channel_max_bans: MAX_BANS '=' NUMBER ';' @@ -2907,7 +3069,7 @@ channel_jflood_count: JOIN_FLOOD_COUNT ' channel_jflood_time: JOIN_FLOOD_TIME '=' timespec ';' { - GlobalSetOptions.joinfloodtime = yylval.number; + GlobalSetOptions.joinfloodtime = $3; }; /*************************************************************************** @@ -2917,12 +3079,14 @@ serverhide_entry: SERVERHIDE '{' serverhide_items '}' ';'; serverhide_items: serverhide_items serverhide_item | serverhide_item; -serverhide_item: serverhide_flatten_links | serverhide_disable_remote_commands | +serverhide_item: serverhide_flatten_links | + serverhide_disable_remote_commands | serverhide_hide_servers | - serverhide_hide_services | - serverhide_links_delay | - serverhide_hidden | serverhide_hidden_name | - serverhide_hide_server_ips | + serverhide_hide_services | + serverhide_links_delay | + serverhide_hidden | + serverhide_hidden_name | + serverhide_hide_server_ips | error; serverhide_flatten_links: FLATTEN_LINKS '=' TBOOL ';' @@ -2964,7 +3128,8 @@ serverhide_links_delay: LINKS_DELAY '=' { if (($3 > 0) && ConfigServerHide.links_disabled == 1) { - eventAddIsh("write_links_file", write_links_file, NULL, $3); + event_write_links_file.when = $3; + event_addish(&event_write_links_file, NULL); ConfigServerHide.links_disabled = 0; }