]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
encode / decode STRUCT too
authorAlan T. DeKok <aland@freeradius.org>
Sun, 19 Dec 2021 13:18:45 +0000 (08:18 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 21 Dec 2021 17:22:12 +0000 (12:22 -0500)
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

src/protocols/internal/decode.c
src/protocols/internal/encode.c

index 26f6d92f12680c5cb8e9e1dbbb5ca227f6b62da6..2e9153fc29bc709a6b01a8eb9c6b0614eb0cf8fc 100644 (file)
@@ -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);
index 04ecfca51ac3f8ea062ff5089b0cb6a2c3d775db..138ce1be24698b06cf3e70ba4af280847130317d 100644 (file)
@@ -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