]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
if max_rtx_foo is defined, it has to be >0 time duration
authorAlan T. DeKok <aland@freeradius.org>
Mon, 14 Nov 2022 12:06:53 +0000 (07:06 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 14 Nov 2022 14:53:09 +0000 (09:53 -0500)
src/lib/unlang/compile.c

index 05f9faf5f0a111303eb03b2b5d14cfa2554c6741..b7f34b59691387e9fad14bfd7cb21ac55a40fbc4 100644 (file)
@@ -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;