From 7f3382fe9850560163130fab3a09b45c2165b090 Mon Sep 17 00:00:00 2001 From: Keith Buck Date: Tue, 29 Oct 2013 09:07:19 +0000 Subject: [PATCH] Remove duplicate default-value code. Default values for default_floodcount and default_ident_timeout are set in s_conf.c. Remove code that checks for missing values in ircd.c. Additionally, reset default_ident_timeout to 5 if an invalid value (i.e. 0) is provided. --- include/defaults.h | 2 +- src/ircd.c | 10 ++-------- src/s_conf.c | 5 ++++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/defaults.h b/include/defaults.h index 5edd8b83..0ec6912e 100644 --- a/include/defaults.h +++ b/include/defaults.h @@ -55,7 +55,7 @@ #define CLIENT_FLOOD_MIN 10 #define LINKS_DELAY_DEFAULT 300 #define MAX_TARGETS_DEFAULT 4 /* default for max_targets */ -#define IDENT_TIMEOUT 10 +#define IDENT_TIMEOUT_DEFAULT 5 #define MIN_JOIN_LEAVE_TIME 60 #define MAX_JOIN_LEAVE_COUNT 25 #define OPER_SPAM_COUNTDOWN 5 diff --git a/src/ircd.c b/src/ircd.c index c739ebe9..d168ea8c 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -309,10 +309,7 @@ initialize_global_set_options(void) GlobalSetOptions.spam_time = MIN_JOIN_LEAVE_TIME; GlobalSetOptions.spam_num = MAX_JOIN_LEAVE_COUNT; - if(ConfigFileEntry.default_floodcount) - GlobalSetOptions.floodcount = ConfigFileEntry.default_floodcount; - else - GlobalSetOptions.floodcount = 10; + GlobalSetOptions.floodcount = ConfigFileEntry.default_floodcount; split_servers = ConfigChannel.default_split_server_count; split_users = ConfigChannel.default_split_user_count; @@ -324,10 +321,7 @@ initialize_global_set_options(void) splitchecking = 1; } - if(ConfigFileEntry.default_ident_timeout) - GlobalSetOptions.ident_timeout = ConfigFileEntry.default_ident_timeout; - else - GlobalSetOptions.ident_timeout = IDENT_TIMEOUT; + GlobalSetOptions.ident_timeout = ConfigFileEntry.default_ident_timeout; rb_strlcpy(GlobalSetOptions.operstring, ConfigFileEntry.default_operstring, diff --git a/src/s_conf.c b/src/s_conf.c index 57c32fc4..203e59f5 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -789,7 +789,7 @@ set_default_conf(void) ConfigFileEntry.min_nonwildcard = 4; ConfigFileEntry.min_nonwildcard_simple = 3; ConfigFileEntry.default_floodcount = 8; - ConfigFileEntry.default_ident_timeout = 5; + ConfigFileEntry.default_ident_timeout = IDENT_TIMEOUT_DEFAULT; ConfigFileEntry.tkline_expire_notices = 0; ConfigFileEntry.reject_after_count = 5; @@ -840,6 +840,9 @@ read_conf(FILE * file) static void validate_conf(void) { + if(ConfigFileEntry.default_ident_timeout < 1) + ConfigFileEntry.default_ident_timeout = IDENT_TIMEOUT_DEFAULT; + if(ConfigFileEntry.ts_warn_delta < TS_WARN_DELTA_MIN) ConfigFileEntry.ts_warn_delta = TS_WARN_DELTA_DEFAULT;