]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow RHS cast
authorAlan T. DeKok <aland@freeradius.org>
Sun, 10 Jan 2021 14:38:19 +0000 (09:38 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 10 Jan 2021 14:38:19 +0000 (09:38 -0500)
because most of the time we can just promote things as necessary

src/lib/server/cond_tokenize.c
src/tests/unit/condition/base.txt

index 0773b5941a773f70d6f82abfce58ab89e139d115..a487c737fdc6da3eb6ee64e267810bef462350e0 100644 (file)
@@ -1320,12 +1320,6 @@ static ssize_t cond_tokenize(TALLOC_CTX *ctx, fr_cond_t **out,
                        .rhs = rhs
                };
 
-               if (rhs->cast != FR_TYPE_INVALID) {
-                       fr_strerror_const("Unexpected cast in right side of comparison");
-                       fr_sbuff_set(&our_in, &m_rhs_cast);
-                       goto error;
-               }
-
 #ifdef HAVE_REGEX
                /*
                 *      LHS can't have regex.  We can't use regex as a unary
index 99db3b55b06582300f04ce84f197774bd29ea35c..91df460f913cf270d457067a4070b9558cde12ed 100644 (file)
@@ -138,8 +138,12 @@ match <ipaddr>&Filter-Id == &Framed-IP-Address
 condition <ipaddr>&Filter-Id == &Framed-IP-Address
 match <ipaddr>&Filter-Id == &Framed-IP-Address
 
+#
+#  We can automatically promote things as needed.  But if the
+#  user forces incompatible types, then that's an error.
+#
 condition <ipaddr>&Filter-Id == <integer>&Framed-IP-Address
-match ERROR offset 22: Unexpected cast in right side of comparison
+match ERROR offset 0: Incompatible casts
 
 condition <ipaddr>&Filter-Id == <blerg>&Framed-IP-Address
 match ERROR offset 23: Unknown data type