]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
FreeRADIUS type 'struct' is always a bit string
authorAlan T. DeKok <aland@freeradius.org>
Wed, 26 Feb 2025 15:23:49 +0000 (10:23 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 26 Feb 2025 19:40:41 +0000 (14:40 -0500)
Because (for now) all of the dictionary entries are packed bits

A struct CANNOT be a sequence or a set, as our structs are always
packed fields, without any headers.

Perhaps in the future a struct could be an octetstring, which would
then be an opaque data type which is carried within DER.

share/dictionary/der/dictionary.crl
share/dictionary/der/dictionary.extensions
src/protocols/der/base.c

index 98c1c7597ec3d185e4b5b53446350c3af5cbf782..d401562fa1e1499cfc4376861c93491727bd6857 100644 (file)
@@ -14,7 +14,7 @@ DEFINE        RelativeDistinguishedName                       set clone=@.RelativeDistinguishedName
 END         nameRelativeToCRLIssuer
 END       distributionPointName
 
-ATTRIBUTE reasons                                      1       struct  der_type=bitstring,option,optional
+ATTRIBUTE reasons                                      1       struct  option,optional
 BEGIN   reasons
 MEMBER         unused                                  bit[1]
 MEMBER         keyCompromise                           bit[1]
index bbde61842a2c4accd6e44469c6377109cb5d6c35..6ba21b1a0940db10ca3ba0dfb155e71aac1177b1 100644 (file)
@@ -24,7 +24,7 @@ END 1.3.6.1.5.5.7.1.11
 
 ATTRIBUTE      subjectKeyIdentifier                    2.5.29.14       octetstring     is_oid_leaf
 
-ATTRIBUTE      keyUsage                                2.5.29.15       struct  der_type=bitstring,is_oid_leaf
+ATTRIBUTE      keyUsage                                2.5.29.15       struct  is_oid_leaf
 BEGIN 2.5.29.15
 MEMBER         digitalSignature                        bit[1]
 MEMBER         nonRepudation                           bit[1]
index dc27383329fd273c8fccb3c7af3ba8098d8d70c1..85e7d86fcf72967d096136f5bd67bbb8d1852d00 100644 (file)
@@ -153,8 +153,6 @@ static const bool *fr_type_to_der_tags[FR_DER_TAG_MAX] = {
        },
        [FR_TYPE_STRUCT] = (bool [FR_DER_TAG_MAX]) {
                [FR_DER_TAG_BITSTRING] = true,
-               [FR_DER_TAG_SEQUENCE] = true,
-               [FR_DER_TAG_SET] = true,
        },
        [FR_TYPE_GROUP] = (bool [FR_DER_TAG_MAX]) {
                [FR_DER_TAG_SEQUENCE] = true,
@@ -709,7 +707,7 @@ static const fr_der_tag_t fr_type_to_der_tag_defaults[FR_TYPE_MAX + 1] = {
        [FR_TYPE_INT64]         = FR_DER_TAG_INTEGER,
        [FR_TYPE_DATE]          = FR_DER_TAG_GENERALIZED_TIME,
        [FR_TYPE_TLV]           = FR_DER_TAG_SEQUENCE,
-       [FR_TYPE_STRUCT]        = FR_DER_TAG_SEQUENCE,
+       [FR_TYPE_STRUCT]        = FR_DER_TAG_BITSTRING,
        [FR_TYPE_GROUP]         = FR_DER_TAG_SEQUENCE,
 };
 
@@ -825,15 +823,6 @@ static bool attr_valid(fr_dict_attr_t *da)
                }
        }
 
-       /*
-        *      Packed structures can only be bit strings, they can't be sequences or sets.
-        */
-       if ((da->type == FR_TYPE_STRUCT) && (flags->der_type != FR_DER_TAG_BITSTRING)) {
-               fr_strerror_printf("A 'struct' must be encoded as 'bitstring', and not as '%s'",
-                                  fr_der_tag_to_str(flags->der_type));
-               return false;
-       }
-
        return true;
 }