From: Alan T. DeKok Date: Tue, 19 Apr 2022 15:31:15 +0000 (-0400) Subject: remove "concat" flag from Digest-Attributes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9cbf7bcf312acfa3e3617a02e4fb8db1ad02815;p=thirdparty%2Ffreeradius-server.git remove "concat" flag from Digest-Attributes it's not really "concat" in the same way that EAP-Message is, as we can't split it in the middle of sub TLVs. --- diff --git a/share/dictionary/radius/dictionary.iana b/share/dictionary/radius/dictionary.iana index 3b22bfb9322..07de35baa59 100644 --- a/share/dictionary/radius/dictionary.iana +++ b/share/dictionary/radius/dictionary.iana @@ -14,7 +14,7 @@ # This is bad... at some point the IETF will allocate these. # ATTRIBUTE Digest-Response 206 string -ATTRIBUTE Digest-Attributes 207 tlv concat +ATTRIBUTE Digest-Attributes 207 tlv ATTRIBUTE Realm .1 string ATTRIBUTE Nonce .2 string ATTRIBUTE Method .3 string diff --git a/src/protocols/radius/base.c b/src/protocols/radius/base.c index 65b3e782ba3..d4e5a3bd7a6 100644 --- a/src/protocols/radius/base.c +++ b/src/protocols/radius/base.c @@ -1118,8 +1118,8 @@ static bool attr_valid(UNUSED fr_dict_t *dict, fr_dict_attr_t const *parent, return false; } - if ((type != FR_TYPE_OCTETS) && (type != FR_TYPE_TLV)) { - fr_strerror_const("Attributes with the 'concat' flag MUST be of data type 'octets' or 'tlv'"); + if (type != FR_TYPE_OCTETS) { + fr_strerror_const("Attributes with the 'concat' flag MUST be of data type 'octets'"); return false; } diff --git a/src/protocols/radius/decode.c b/src/protocols/radius/decode.c index 73ca5fb2e11..5bc45413869 100644 --- a/src/protocols/radius/decode.c +++ b/src/protocols/radius/decode.c @@ -654,7 +654,6 @@ ssize_t fr_radius_decode_tlv(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_pair_list_t head; fr_pair_list_t tlv_tmp; fr_pair_t *vp; - bool concat; fr_pair_list_init(&head); if (data_len < 3) return -1; /* type, length, value */ @@ -670,20 +669,6 @@ ssize_t fr_radius_decode_tlv(TALLOC_CTX *ctx, fr_pair_list_t *out, vp = fr_pair_afrom_da(ctx, parent); if (!vp) return PAIR_DECODE_OOM; - /* - * We don't have a "pair find in out" - */ - if (flag_concat(&parent->flags)) { - vp = fr_pair_find_by_da_idx(out, parent, 0); - concat = (vp != NULL); - } else { - vp = NULL; - concat = false; - } - - if (!vp) vp = fr_pair_afrom_da(ctx, parent); - if (!vp) return PAIR_DECODE_OOM; - /* * Record where we were in the list when this function was called * Create a temporary sub-list, so decode errors don't @@ -703,7 +688,7 @@ ssize_t fr_radius_decode_tlv(TALLOC_CTX *ctx, fr_pair_list_t *out, child = fr_dict_unknown_attr_afrom_num(packet_ctx->tmp_ctx, parent, p[0]); if (!child) { error: - if (!concat) talloc_free(vp); + talloc_free(vp); return -1; } } @@ -717,7 +702,7 @@ ssize_t fr_radius_decode_tlv(TALLOC_CTX *ctx, fr_pair_list_t *out, } fr_pair_list_append(&vp->vp_group, &tlv_tmp); - if (!concat) fr_pair_append(out, vp); + fr_pair_append(out, vp); return data_len; } @@ -2007,7 +1992,7 @@ ssize_t fr_radius_decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, /* * Concatenate consecutive top-level attributes together. */ - if (flag_concat(&da->flags) && (da->type == FR_TYPE_OCTETS)) { + if (flag_concat(&da->flags)) { FR_PROTO_TRACE("Concat attribute"); return decode_concat(ctx, out, da, data, packet_ctx->end); }