From: Alan T. DeKok Date: Thu, 18 Nov 2021 01:26:59 +0000 (-0500) Subject: now that the base errors are better, rely on them X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a48adeb71a5c2b09c73137b12fbebd6f7eda2454;p=thirdparty%2Ffreeradius-server.git now that the base errors are better, rely on them instead of doubling up on errors --- diff --git a/src/lib/server/cond_tokenize.c b/src/lib/server/cond_tokenize.c index f6a1719c81d..6eb506a220b 100644 --- a/src/lib/server/cond_tokenize.c +++ b/src/lib/server/cond_tokenize.c @@ -196,8 +196,6 @@ static int cond_cast_tmpl(tmpl_t *vpt, fr_type_t type, tmpl_t *other) fr_strerror_clear(); if (tmpl_cast_in_place(vpt, type, da) < 0) { - fr_strerror_printf_push("Failed parsing value as type '%s'", - fr_table_str_by_value(fr_value_box_type_table, type, "??")); return -1; } diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 322986a81ae..f74142d101b 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -4355,7 +4355,7 @@ fr_slen_t fr_value_box_from_numeric_substr(fr_value_box_t *dst, fr_type_t dst_ty } if (err == FR_SBUFF_PARSE_ERROR_NOT_FOUND) { - fr_strerror_printf("Cannot parse type '%s' from input string", + fr_strerror_printf("Failed parsing string as type '%s'", fr_table_str_by_value(fr_value_box_type_table, dst_type, "")); } else { fr_sbuff_parse_error_to_strerror(err); diff --git a/src/tests/unit/condition/base.txt b/src/tests/unit/condition/base.txt index cbcc3aa39bb..067e9e4b55f 100644 --- a/src/tests/unit/condition/base.txt +++ b/src/tests/unit/condition/base.txt @@ -219,10 +219,10 @@ condition &Event-Timestamp == 'January 1, 2012' # literals are parsed when the conditions are parsed condition X == 1 -match ERROR offset 9: token not found: Failed parsing value as type 'uint32' +match ERROR offset 9: Failed parsing string as type 'uint32' condition &NAS-Port == X -match ERROR offset 13: token not found: Failed parsing value as type 'uint32' +match ERROR offset 13: Failed parsing string as type 'uint32' # # The RHS is a static string, so this gets mashed to a literal, @@ -250,7 +250,7 @@ condition 00:11:22:33:44:55 == "%{md4:00:11:22:33:44:55}" match 00:11:22:33:44:55 == "%{md4:00:11:22:33:44:55}" condition 00:XX:22:33:44:55 == 00:11:22:33:44:55 -match ERROR offset 8: Missing separator, expected ':': Failed parsing value as type 'ether' +match ERROR offset 8: Missing separator, expected ':' # # Tests for boolean data types. @@ -331,7 +331,7 @@ condition 127.0.0.1/32 == 127.0.0.1 match true condition 127.0.0.1/327 == 127.0.0.1 -match ERROR offset 8: Invalid IPv4 mask length "/327". Should be between 0-32: Failed parsing value as type 'ipaddr' +match ERROR offset 8: Invalid IPv4 mask length "/327". Should be between 0-32 condition 127.0.0.1/32 == 127.0.0.1 match true