--- ircd-hybrid/trunk/src/conf_parser.y 2016/02/07 18:04:26 7282 +++ ircd-hybrid/trunk/src/conf_parser.y 2019/01/01 11:07:01 8752 @@ -1,7 +1,7 @@ /* * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) * - * Copyright (c) 2000-2016 ircd-hybrid development team + * Copyright (c) 2000-2019 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 @@ -31,9 +31,11 @@ #include "stdinc.h" #include "ircd.h" #include "list.h" +#include "parse.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" @@ -91,14 +93,12 @@ static struct port, aftype, ping_freq, - max_perip, + max_perip_local, + max_perip_global, con_freq, min_idle, max_idle, max_total, - max_global, - max_local, - max_ident, max_sendq, max_recvq, max_channels, @@ -155,7 +155,6 @@ reset_block_state(void) %token CALLER_ID_WAIT %token CAN_FLOOD %token CHANNEL -%token CHECK_CACHE %token CIDR_BITLEN_IPV4 %token CIDR_BITLEN_IPV6 %token CLASS @@ -164,6 +163,7 @@ reset_block_state(void) %token CONNECTFREQ %token CYCLE_ON_HOST_CHANGE %token DEFAULT_FLOODCOUNT +%token DEFAULT_FLOODTIME %token DEFAULT_JOIN_FLOOD_COUNT %token DEFAULT_JOIN_FLOOD_TIME %token DEFAULT_MAX_CLIENTS @@ -202,6 +202,7 @@ reset_block_state(void) %token INVITE_CLIENT_COUNT %token INVITE_CLIENT_TIME %token INVITE_DELAY_CHANNEL +%token INVITE_EXPIRE_TIME %token IP %token IRCD_AUTH %token IRCD_FLAGS @@ -217,18 +218,14 @@ reset_block_state(void) %token KNOCK_CLIENT_TIME %token KNOCK_DELAY_CHANNEL %token LEAF_MASK -%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_BANS_LARGE %token MAX_CHANNELS -%token MAX_GLOBAL -%token MAX_IDENT %token MAX_IDLE -%token MAX_LOCAL +%token MAX_INVITES %token MAX_NICK_CHANGES %token MAX_NICK_LENGTH %token MAX_NICK_TIME @@ -236,11 +233,9 @@ 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 @@ -254,7 +249,8 @@ reset_block_state(void) %token NO_TILDE %token NUMBER %token NUMBER_PER_CIDR -%token NUMBER_PER_IP +%token NUMBER_PER_IP_GLOBAL +%token NUMBER_PER_IP_LOCAL %token OPER_ONLY_UMODES %token OPER_UMODES %token OPERATOR @@ -292,7 +288,6 @@ reset_block_state(void) %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 @@ -364,6 +359,7 @@ reset_block_state(void) %token VHOST6 %token WARN_NO_CONNECT_BLOCK %token WHOIS +%token WHOWAS_HISTORY_LENGTH %token XLINE %token XLINE_EXEMPT @@ -469,9 +465,6 @@ serverinfo_item: serverinfo_name serverinfo_ssl_certificate_file | serverinfo_ssl_cipher_list | serverinfo_ssl_message_digest_algorithm | - serverinfo_libgeoip_database_options | - serverinfo_libgeoip_ipv4_database_file | - serverinfo_libgeoip_ipv6_database_file | error ';' ; @@ -529,75 +522,12 @@ serverinfo_ssl_dh_elliptic_curve: SSL_DH } }; -serverinfo_libgeoip_database_options: LIBGEOIP_DATABASE_OPTIONS -{ - if (conf_parser_ctx.pass == 1) - ConfigServerInfo.libgeoip_database_options = 0; -} '=' options_items ';'; - -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_libgeoip_ipv4_database_file: LIBGEOIP_IPV4_DATABASE_FILE '=' QSTRING ';' -{ - if (conf_parser_ctx.pass == 2) - { - xfree(ConfigServerInfo.libgeoip_ipv4_database_file); - ConfigServerInfo.libgeoip_ipv4_database_file = xstrdup(yylval.string); - -#ifdef HAVE_LIBGEOIP - if (GeoIPv4_ctx) - GeoIP_delete(GeoIPv4_ctx); - GeoIPv4_ctx = GeoIP_open(yylval.string, ConfigServerInfo.libgeoip_database_options); -#endif - } -}; - -serverinfo_libgeoip_ipv6_database_file: LIBGEOIP_IPV6_DATABASE_FILE '=' QSTRING ';' -{ - 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 && !ConfigServerInfo.name) { - if (valid_servname(yylval.string)) + if (server_valid_name(yylval.string) == true) ConfigServerInfo.name = xstrdup(yylval.string); else { @@ -1045,8 +975,12 @@ oper_entry: OPERATOR { struct MaskItem *conf = NULL; struct split_nuh_item nuh; + char *s = node->data; - nuh.nuhmask = node->data; + if (EmptyString(s)) + continue; + + nuh.nuhmask = s; nuh.nickptr = NULL; nuh.userptr = block_state.user.buf; nuh.hostptr = block_state.host.buf; @@ -1397,19 +1331,17 @@ class_entry: CLASS if (!block_state.class.buf[0]) break; - if (!(class = class_find(block_state.class.buf, 0))) + if (!(class = class_find(block_state.class.buf, false))) class = class_make(); class->active = 1; 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; + class->max_perip_local = block_state.max_perip_local.value; + class->max_perip_global = block_state.max_perip_global.value; class->con_freq = block_state.con_freq.value; 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; @@ -1425,11 +1357,14 @@ class_entry: CLASS class->min_idle = block_state.min_idle.value; class->max_idle = block_state.max_idle.value; - rebuild_cidr_list(class); - + int diff = (class->cidr_bitlen_ipv4 != block_state.cidr_bitlen_ipv4.value || + class->cidr_bitlen_ipv6 != block_state.cidr_bitlen_ipv6.value); class->cidr_bitlen_ipv4 = block_state.cidr_bitlen_ipv4.value; class->cidr_bitlen_ipv6 = block_state.cidr_bitlen_ipv6.value; class->number_per_cidr = block_state.number_per_cidr.value; + + if (diff) + class_ip_limit_rebuild(class); }; class_items: class_items class_item | class_item; @@ -1438,14 +1373,13 @@ class_item: class_name | class_cidr_bitlen_ipv6 | class_ping_time | class_number_per_cidr | - class_number_per_ip | + class_number_per_ip_local | + class_number_per_ip_global | class_connectfreq | class_max_channels | 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 | @@ -1463,10 +1397,16 @@ class_ping_time: PING_TIME '=' timespec block_state.ping_freq.value = $3; }; -class_number_per_ip: NUMBER_PER_IP '=' NUMBER ';' +class_number_per_ip_local: NUMBER_PER_IP_LOCAL '=' NUMBER ';' { if (conf_parser_ctx.pass == 1) - block_state.max_perip.value = $3; + block_state.max_perip_local.value = $3; +}; + +class_number_per_ip_global: NUMBER_PER_IP_GLOBAL '=' NUMBER ';' +{ + if (conf_parser_ctx.pass == 1) + block_state.max_perip_global.value = $3; }; class_connectfreq: CONNECTFREQ '=' timespec ';' @@ -1487,24 +1427,6 @@ class_max_number: MAX_NUMBER '=' NUMBER block_state.max_total.value = $3; }; -class_max_global: MAX_GLOBAL '=' NUMBER ';' -{ - if (conf_parser_ctx.pass == 1) - block_state.max_global.value = $3; -}; - -class_max_local: MAX_LOCAL '=' NUMBER ';' -{ - if (conf_parser_ctx.pass == 1) - 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) @@ -1669,8 +1591,12 @@ auth_entry: IRCD_AUTH { struct MaskItem *conf = NULL; struct split_nuh_item nuh; + char *s = node->data; + + if (EmptyString(s)) + continue; - nuh.nuhmask = node->data; + nuh.nuhmask = s; nuh.nickptr = NULL; nuh.userptr = block_state.user.buf; nuh.hostptr = block_state.host.buf; @@ -1871,7 +1797,7 @@ service_name: NAME '=' QSTRING ';' if (conf_parser_ctx.pass != 2) break; - if (valid_servname(yylval.string)) + if (server_valid_name(yylval.string) == true) { struct ServiceItem *service = service_make(); service->name = xstrdup(yylval.string); @@ -2415,21 +2341,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; @@ -2462,6 +2386,7 @@ general_item: general_away_count | 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 | @@ -2485,6 +2410,7 @@ general_item: general_away_count | general_caller_id_wait | general_opers_bypass_callerid | general_default_floodcount | + general_default_floodtime | general_min_nonwildcard | general_min_nonwildcard_simple | general_throttle_count | @@ -2517,6 +2443,11 @@ general_max_watch: MAX_WATCH '=' NUMBER ConfigGeneral.max_watch = $3; }; +general_whowas_history_length: WHOWAS_HISTORY_LENGTH '=' NUMBER ';' +{ + ConfigGeneral.whowas_history_length = $3; +}; + general_cycle_on_host_change: CYCLE_ON_HOST_CHANGE '=' TBOOL ';' { if (conf_parser_ctx.pass == 2) @@ -2867,6 +2798,11 @@ general_default_floodcount: DEFAULT_FLOO ConfigGeneral.default_floodcount = $3; }; +general_default_floodtime: DEFAULT_FLOODTIME '=' timespec ';' +{ + ConfigGeneral.default_floodtime = $3; +}; + /*************************************************************************** * channel {} section @@ -2875,13 +2811,16 @@ channel_entry: CHANNEL '{' channel_items channel_items: channel_items channel_item | channel_item; channel_item: channel_max_bans | + channel_max_bans_large | channel_invite_client_count | channel_invite_client_time | channel_invite_delay_channel | + channel_invite_expire_time | channel_knock_client_count | channel_knock_client_time | channel_knock_delay_channel | channel_max_channels | + channel_max_invites | channel_default_join_flood_count | channel_default_join_flood_time | channel_disable_fake_channels | @@ -2907,6 +2846,11 @@ channel_invite_delay_channel: INVITE_DEL ConfigChannel.invite_delay_channel = $3; }; +channel_invite_expire_time: INVITE_EXPIRE_TIME '=' timespec ';' +{ + ConfigChannel.invite_expire_time = $3; +}; + channel_knock_client_count: KNOCK_CLIENT_COUNT '=' NUMBER ';' { ConfigChannel.knock_client_count = $3; @@ -2927,11 +2871,21 @@ channel_max_channels: MAX_CHANNELS '=' N ConfigChannel.max_channels = $3; }; +channel_max_invites: MAX_INVITES '=' NUMBER ';' +{ + ConfigChannel.max_invites = $3; +}; + channel_max_bans: MAX_BANS '=' NUMBER ';' { ConfigChannel.max_bans = $3; }; +channel_max_bans_large: MAX_BANS_LARGE '=' NUMBER ';' +{ + ConfigChannel.max_bans_large = $3; +}; + channel_default_join_flood_count: DEFAULT_JOIN_FLOOD_COUNT '=' NUMBER ';' { ConfigChannel.default_join_flood_count = yylval.number;