]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make fr_internal_decode_list_dbuff simply decode as is
authorNick Porter <nick@portercomputing.co.uk>
Thu, 25 Aug 2022 15:01:49 +0000 (16:01 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 25 Aug 2022 16:10:14 +0000 (17:10 +0100)
Any manipulation of the retrieved attributes should be done by the
caller

src/protocols/internal/decode.c

index dca5766de886b85b88ade29b864f8cb6b3f13237..d5fde8448fc3fe5bc2554f77d1fcd64d885d9adf 100644 (file)
@@ -362,8 +362,6 @@ ssize_t fr_internal_decode_pair_dbuff(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_d
        return fr_dbuff_set(dbuff, &work_dbuff);
 }
 
-static fr_dict_attr_t const *attr_protocol_encapsulation;
-
 /** Retrieve all pairs from the dbuff
  *
  * @param ctx          to create new pairs in
@@ -379,8 +377,6 @@ ssize_t fr_internal_decode_list_dbuff(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_d
                                          fr_dbuff_t *dbuff, void *decode_ctx)
 {
        ssize_t         ret, len = 0;
-       fr_pair_t       *vp = NULL;
-       fr_pair_t       *child, *grandchild;
 
        while (fr_dbuff_remaining(dbuff)) {
                ret = fr_internal_decode_pair_dbuff(ctx, out, parent, dbuff, decode_ctx);
@@ -388,27 +384,6 @@ ssize_t fr_internal_decode_list_dbuff(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_d
                len += ret;
        }
 
-       if (!attr_protocol_encapsulation) {
-               attr_protocol_encapsulation = fr_dict_attr_by_name(NULL, fr_dict_root(fr_dict_internal()), "Protocol-Encapsulation");
-       }
-
-       /*
-        *  Move any attributes inside Protocol-Encapsulation and it's child protocol
-        *  attributes to the parent list
-        */
-       while ((vp = fr_pair_find_by_da(out, NULL, attr_protocol_encapsulation))) {
-               while ((child = fr_pair_list_head(&vp->children))) {
-                       fr_pair_remove(&vp->children, child);
-                       while ((grandchild = fr_pair_list_head(&child->children))) {
-                               fr_pair_remove(&child->children, grandchild);
-                               fr_pair_steal_append(ctx, out, grandchild);
-                       }
-                       talloc_free(child);
-               }
-               fr_pair_remove(out, vp);
-               talloc_free(vp);
-       }
-
        return len;
 }