From: Alan T. DeKok Date: Fri, 10 Dec 2021 21:13:59 +0000 (-0500) Subject: these don't use (and shouldn't use) VT_XLAT X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df1dd81a0e412a92e029b20c13cfea7826cde385;p=thirdparty%2Ffreeradius-server.git these don't use (and shouldn't use) VT_XLAT in preparation for simply removing it entirely. --- diff --git a/src/bin/dhcpclient.c b/src/bin/dhcpclient.c index 1086ba33f8..1e6e8cf52d 100644 --- a/src/bin/dhcpclient.c +++ b/src/bin/dhcpclient.c @@ -181,22 +181,7 @@ static int request_init(fr_radius_packet_t **out, fr_pair_list_t *packet_vps, ch for (vp = fr_pair_list_head(packet_vps); vp; vp = fr_pair_list_next(packet_vps, vp)) { - - /* - * Xlat expansions are not supported. Convert xlat to value box (if possible). - */ - if (vp->type == VT_XLAT) { - if (fr_value_box_from_str(vp, &vp->data, - vp->da->type, NULL, - vp->xlat, strlen(vp->xlat), - NULL, false) < 0) { - fr_perror("dhcpclient"); - fr_radius_packet_free(&packet); - if (fp && (fp != stdin)) fclose(fp); - return -1; - } - vp->type = VT_DATA; - } + fr_assert(vp->type != VT_XLAT); /* * Allow to set packet type using Message-Type diff --git a/src/bin/radclient.c b/src/bin/radclient.c index 24f3313595..dade6025de 100644 --- a/src/bin/radclient.c +++ b/src/bin/radclient.c @@ -453,19 +453,7 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files) vp; vp = fr_pair_list_next(&request->filter, vp)) { again: - /* - * Xlat expansions are not supported. Convert xlat to value box (if possible). - */ - if (vp->type == VT_XLAT) { - if (fr_value_box_from_str(vp, &vp->data, - vp->da->type, NULL, - vp->xlat, strlen(vp->xlat), - NULL, false) < 0) { - fr_perror("radclient"); - goto error; - } - vp->type = VT_DATA; - } + fr_assert(vp->type != VT_XLAT); if (vp->da == attr_packet_type) { fr_pair_t *next; @@ -490,18 +478,7 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files) for (vp = fr_pair_list_head(&request->request_pairs); vp; vp = fr_pair_list_next(&request->request_pairs, vp)) { - /* - * Xlat expansions are not supported. Convert xlat to value box (if possible). - */ - if (vp->type == VT_XLAT) { - if (fr_value_box_from_str(vp, &vp->data, vp->da->type, NULL, - vp->xlat, strlen(vp->xlat), - NULL, false) < 0) { - fr_perror("radclient"); - goto error; - } - vp->type = VT_DATA; - } + fr_assert(vp->type != VT_XLAT); /* * Allow it to set the packet type in diff --git a/src/bin/radsniff.c b/src/bin/radsniff.c index bb5bac37e0..4c2b07848e 100644 --- a/src/bin/radsniff.c +++ b/src/bin/radsniff.c @@ -2030,7 +2030,6 @@ static int rs_build_dict_list(fr_dict_attr_t const **out, size_t len, char *list static int rs_build_filter(fr_pair_list_t *out, char const *filter) { - fr_pair_t *vp; fr_token_t code; code = fr_pair_list_afrom_str(conf, dict_radius, filter, strlen(filter), out); @@ -2044,23 +2043,6 @@ static int rs_build_filter(fr_pair_list_t *out, char const *filter) return -1; } - for (vp = fr_pair_list_head(out); - vp; - vp = fr_pair_list_next(out, vp)) { - /* - * Xlat expansions are not supported. Convert xlat to value box (if possible). - */ - if (vp->type == VT_XLAT) { - if (fr_value_box_from_str(vp, &vp->data, vp->da->type, NULL, - vp->xlat, strlen(vp->xlat), - NULL, false) < 0) { - fr_perror("radsniff"); - return -1; - } - vp->type = VT_DATA; - } - } - /* * This allows efficient list comparisons later */ diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index cb6566eec6..a63318a5e4 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -226,15 +226,7 @@ static request_t *request_from_file(TALLOC_CTX *ctx, FILE *fp, RADCLIENT *client for (vp = fr_pair_dcursor_init(&cursor, &request->request_pairs); vp; vp = fr_dcursor_next(&cursor)) { - /* - * Double quoted strings get marked up as xlat expansions, - * but we don't support that here. - */ - if (vp->type == VT_XLAT) { - fr_pair_value_bstrdup_buffer_shallow(vp, vp->xlat, false); - vp->xlat = NULL; - vp->type = VT_DATA; - } + fr_assert(vp->type != VT_XLAT); if (vp->da == attr_packet_type) { request->packet->code = vp->vp_uint32;