From: Alan T. DeKok Date: Sun, 19 Dec 2021 13:18:45 +0000 (-0500) Subject: encode / decode STRUCT too X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75515b1ef65bc3ce228bcd6ba5775bfc2e8b49b1;p=thirdparty%2Ffreeradius-server.git encode / decode STRUCT too the same as TLV, because we don't have packed-structures in the internal protocol. And the internal protocol doesn't use protocol-specific encodings. It uses the internal encodings --- diff --git a/src/protocols/internal/decode.c b/src/protocols/internal/decode.c index 26f6d92f12..2e9153fc29 100644 --- a/src/protocols/internal/decode.c +++ b/src/protocols/internal/decode.c @@ -316,8 +316,13 @@ static ssize_t internal_decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dic /* * Structural types + * + * STRUCTs are encoded as TLVs, because the struct + * packing only applies to the original protocol, and not + * to our internal encoding. */ case FR_TYPE_TLV: + case FR_TYPE_STRUCT: if (unlikely(tainted)) goto bad_tainted; slen = internal_decode_tlv(ctx, out, da, &work_dbuff, decode_ctx); diff --git a/src/protocols/internal/encode.c b/src/protocols/internal/encode.c index 04ecfca51a..138ce1be24 100644 --- a/src/protocols/internal/encode.c +++ b/src/protocols/internal/encode.c @@ -154,8 +154,13 @@ static ssize_t internal_encode(fr_dbuff_t *dbuff, /* * Children of TLVs are encoded in the context * of the TLV. + * + * STRUCTs are encoded as TLVs, because the struct + * packing only applies to the original protocol, and not + * to our internal encoding. */ case FR_TYPE_TLV: + case FR_TYPE_STRUCT: /* * We've done the complete stack. * Hopefully this TLV has some