From: Matthew Newton Date: Tue, 12 Oct 2021 19:39:23 +0000 (+0100) Subject: json: skip raw attributes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e48b4edf22e19a16c5ffd9f21ee4f585494802d;p=thirdparty%2Ffreeradius-server.git json: skip raw attributes They tend to have binary stuff that gets incorrectly encoded and breaks the json output --- diff --git a/src/lib/json/json.c b/src/lib/json/json.c index 5fc42190080..d7f00e88895 100644 --- a/src/lib/json/json.c +++ b/src/lib/json/json.c @@ -553,6 +553,8 @@ static json_object *json_object_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_list_t fr_sbuff_t attr_name; struct json_object *vp_object, *values, *value, *type_name; + if (vp->da->flags.is_raw) continue; + /* * Get attribute name and value. */ @@ -679,6 +681,8 @@ static json_object *json_smplobj_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_list_t struct json_object *values = NULL; bool add_single = false; + if (vp->da->flags.is_raw) continue; + /* * Get attribute name and value. */ @@ -799,6 +803,8 @@ static struct json_object *json_array_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_l struct json_object *attrobj = NULL; bool already_seen = false; + if (vp->da->flags.is_raw) continue; + /* * Get attribute name and value. */ @@ -922,6 +928,8 @@ static struct json_object *json_value_array_afrom_pair_list(TALLOC_CTX *ctx, fr_ vp = fr_pair_list_next(vps, vp)) { struct json_object *value; + if (vp->da->flags.is_raw) continue; + if (json_afrom_value_box(ctx, &value, vp, format) < 0) { fr_strerror_const("Failed to convert attribute value to JSON object"); json_object_put_assert(obj); @@ -972,6 +980,8 @@ static struct json_object *json_attr_array_afrom_pair_list(UNUSED TALLOC_CTX *ct fr_sbuff_t attr_name; struct json_object *value; + if (vp->da->flags.is_raw) continue; + fr_sbuff_init(&attr_name, buf, sizeof(buf)); if (attr_name_with_prefix(&attr_name, vp->da, format) < 0) { return NULL;