From: Alan T. DeKok Date: Wed, 20 Jan 2021 14:30:08 +0000 (-0500) Subject: don't manually skip internal attributes. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6335b451464ec508633cfbef71b9872d83f3ad5f;p=thirdparty%2Ffreeradius-server.git don't manually skip internal attributes. rely on the iterator for that. And as a side effect, remove support for Raw-Attribute --- diff --git a/share/dictionary/freeradius/dictionary.freeradius.internal b/share/dictionary/freeradius/dictionary.freeradius.internal index f9e8b2d12dc..0ad34c9c407 100644 --- a/share/dictionary/freeradius/dictionary.freeradius.internal +++ b/share/dictionary/freeradius/dictionary.freeradius.internal @@ -136,7 +136,7 @@ ATTRIBUTE Expiration 1010 date ATTRIBUTE Client-Shortname 1011 string virtual -ATTRIBUTE Raw-Attribute 1012 octets +# Was Raw-Attribute. No longer supported ATTRIBUTE User-Category 1013 string ATTRIBUTE Pam-Auth 1014 string diff --git a/src/protocols/radius/base.c b/src/protocols/radius/base.c index 7f452d77e76..7e0b4b661b0 100644 --- a/src/protocols/radius/base.c +++ b/src/protocols/radius/base.c @@ -65,7 +65,6 @@ extern fr_dict_attr_autoload_t libfreeradius_radius_dict_attr[]; fr_dict_attr_autoload_t libfreeradius_radius_dict_attr[] = { { .out = &attr_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_radius }, { .out = &attr_packet_authentication_vector, .name = "Packet-Authentication-Vector", .type = FR_TYPE_OCTETS, .dict = &dict_radius }, - { .out = &attr_raw_attribute, .name = "Raw-Attribute", .type = FR_TYPE_OCTETS, .dict = &dict_freeradius }, { .out = &attr_chap_challenge, .name = "CHAP-Challenge", .type = FR_TYPE_OCTETS, .dict = &dict_radius }, { .out = &attr_chargeable_user_identity, .name = "Chargeable-User-Identity", .type = FR_TYPE_OCTETS, .dict = &dict_radius }, @@ -982,39 +981,6 @@ ssize_t fr_radius_encode_dbuff(fr_dbuff_t *dbuff, uint8_t const *original, while ((vp = fr_cursor_current(&cursor))) { VP_VERIFY(vp); - /* - * Ignore non-wire attributes, but allow extended - * attributes. - */ - if (vp->da->flags.internal) { -#ifndef NDEBUG - /* - * Permit the admin to send BADLY formatted - * attributes with a debug build. - */ - if (vp->da == attr_raw_attribute) { - CHECK_FREESPACE(vp->vp_length, vp->vp_length); - - /* - * Skip really badly formatted attributes - */ - if (vp->vp_length > (RADIUS_MAX_STRING_LENGTH + 2)) { - fr_cursor_next(&cursor); - continue; - } - - FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff, vp->vp_octets, vp->vp_length); - fr_cursor_next(&cursor); - continue; - } -#endif - /* - * Skip internal attributes... - */ - fr_cursor_next(&cursor); - continue; - } - /* * Encode an individual VP */ diff --git a/src/tests/unit/protocols/radius/rfc2868.txt b/src/tests/unit/protocols/radius/rfc2868.txt index 62e4a1b11bb..b694ece5f02 100644 --- a/src/tests/unit/protocols/radius/rfc2868.txt +++ b/src/tests/unit/protocols/radius/rfc2868.txt @@ -79,10 +79,10 @@ decode-proto 01 01 00 26 00000000000000000000000000000000 40 06 01 00 00 01 40 0 match Packet-Type = Access-Request, Packet-Authentication-Vector = 0x00000000000000000000000000000000, Tag-1 = { Tunnel-Type = PPTP, Tunnel-Medium-Type = IPv4 }, Tag-2 = { Tunnel-Type = PPTP } # -# This currently fails. :( +# and we encode the tags in order in the packet. # -#encode-proto - -#match 01 00 00 14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +encode-proto - +match 01 00 00 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 06 01 00 00 01 41 06 01 00 00 01 40 06 02 00 00 01 # Invalid tag on decoding decode-pair 40 06 20 00 00 01 @@ -108,4 +108,4 @@ decode-pair - match Tunnel-Client-Endpoint = "\001\002\003" count -match 42 +match 44