From: Alan T. DeKok Date: Mon, 14 Nov 2022 12:06:53 +0000 (-0500) Subject: if max_rtx_foo is defined, it has to be >0 time duration X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1c6c905cfb3ad324a1c8da10d8aa6b1e06e5cbf;p=thirdparty%2Ffreeradius-server.git if max_rtx_foo is defined, it has to be >0 time duration --- diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index 05f9faf5f0a..b7f34b59691 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -1773,6 +1773,12 @@ static bool compile_retry_section(unlang_actions_t *actions, CONF_ITEM *ci) } else if (strcmp(name, "max_rtx_time") == 0) { if (fr_time_delta_from_str(&actions->retry.mrt, value, strlen(value), FR_TIME_RES_SEC) < 0) goto error; + if (!fr_time_delta_ispos(actions->retry.mrt)) { + cf_log_err(csi, "Invalid value for 'max_rtx_time = %s' - value must be positive", + value); + return false; + } + } else if (strcmp(name, "max_rtx_count") == 0) { unsigned long v = strtoul(value, 0, 0); @@ -1786,6 +1792,13 @@ static bool compile_retry_section(unlang_actions_t *actions, CONF_ITEM *ci) } else if (strcmp(name, "max_rtx_duration") == 0) { if (fr_time_delta_from_str(&actions->retry.mrd, value, strlen(value), FR_TIME_RES_SEC) < 0) goto error; + + if (!fr_time_delta_ispos(actions->retry.mrd)) { + cf_log_err(csi, "Invalid value for 'max_rtx_duration = %s' - value must be positive", + value); + return false; + } + } else { cf_log_err(csi, "Invalid item '%s' in 'retry' configuration.", name); return false;