]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
allow "concat" for TLV types in RADIUS.
authorAlan T. DeKok <aland@freeradius.org>
Fri, 9 Apr 2021 12:21:16 +0000 (08:21 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 9 Apr 2021 12:21:16 +0000 (08:21 -0400)
and ensure that setting the flag doesn't change the behavior
for attributes of type "octets"

share/dictionary/radius/dictionary.iana
src/protocols/radius/base.c
src/protocols/radius/decode.c

index 4b20fdf3956b22d082dafa416dcceca9cac8f0bd..4d485607d73d292086cf62249700b1e1713c81ee 100644 (file)
@@ -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
+ATTRIBUTE      Digest-Attributes                       207     tlv concat
 ATTRIBUTE      Realm                                   .1      string
 ATTRIBUTE      Nonce                                   .2      string
 ATTRIBUTE      Method                                  .3      string
index 41e8079f05b224a8807d700f7bad931b182c3ce8..41185c6244122de8c4f9978d0277b9e40e1bd3ff 100644 (file)
@@ -1178,8 +1178,8 @@ static bool attr_valid(UNUSED fr_dict_t *dict, fr_dict_attr_t const *parent,
                        return false;
                }
 
-               if (type != FR_TYPE_OCTETS) {
-                       fr_strerror_const("Attributes with the 'concat' flag MUST be of data type 'octets'");
+               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'");
                        return false;
                }
 
index 3635ed3b67e5855cae715aee68f02e3fb55735d4..1c18dfc9b1d40a170df166ad8adf9159ef015404 100644 (file)
@@ -356,6 +356,8 @@ static ssize_t decode_concat(TALLOC_CTX *ctx, fr_dcursor_t *cursor,
        uint8_t         *p;
        fr_pair_t       *vp;
 
+       fr_assert(parent->type == FR_TYPE_OCTETS);
+
        total = 0;
        attr = ptr[0];
 
@@ -1631,7 +1633,7 @@ ssize_t fr_radius_decode_pair(TALLOC_CTX *ctx, fr_dcursor_t *cursor, fr_dict_t c
        /*
         *      Pass the entire thing to the decoding function
         */
-       if (flag_concat(&da->flags)) {
+       if ((da->type == FR_TYPE_OCTETS && flag_concat(&da->flags))) {
                FR_PROTO_TRACE("Concat attribute");
                return decode_concat(ctx, cursor, da, data, data_len);
        }