]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
catch bad times.
authorAlan T. DeKok <aland@freeradius.org>
Fri, 15 Sep 2023 11:36:02 +0000 (07:36 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 15 Sep 2023 11:36:02 +0000 (07:36 -0400)
if packet timestamp > now, don't update Acct-Delay-Time

src/main/detail.c

index a5e8437e1c5c091fb84b7915c7687ba46f4133ef..3b7e38204251c95685ed1ee561507f686bf47098 100644 (file)
@@ -910,8 +910,16 @@ open_file:
                        rad_assert(vp != NULL);
                        fr_pair_add(&packet->vps, vp);
                }
+
+               /*
+                *      Update Acct-Delay-Time, but make sure that it doesn't go backwards.
+                */
                if (data->timestamp != 0) {
-                       vp->vp_integer += time(NULL) - data->timestamp;
+                       time_t now = time(NULL);
+
+                       if (((time_t) data->timestamp) < now) {
+                               vp->vp_integer += time(NULL) - data->timestamp;
+                       }
                }
        }