]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
special-case (date - date) --> time_delta
authorAlan T. DeKok <aland@freeradius.org>
Thu, 19 Jan 2023 17:28:26 +0000 (12:28 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 19 Jan 2023 17:28:26 +0000 (12:28 -0500)
src/lib/util/calc.c

index 4ad7d9659fa5a7e188f89f75e0fcd94a602c332c..421342a27aed4658c4dd22b6fa8327807796ddfe 100644 (file)
@@ -1811,6 +1811,14 @@ int fr_value_calc_binary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t hint
         *      guess based on a variety of factors.
         */
        if (hint == FR_TYPE_NULL) do {
+               /*
+                *      All kinds of special cases :(
+                */
+               if ((op == T_SUB) && (a->type == b->type) && (a->type == FR_TYPE_DATE)) {
+                       hint = FR_TYPE_TIME_DELTA;
+                       break;
+               }
+
                switch (op) {
                case T_OP_CMP_EQ:
                case T_OP_NE: