#
DEFINE RelativeDistinguishedName set set_of=sequence,size=1..
BEGIN RelativeDistinguishedName
-DEFINE AttributeTypeAndValue sequence sequence_of=oid_and_value,ref=@.OID-Tree
+DEFINE AttributeTypeAndValue sequence sequence_of=oid_and_value
END RelativeDistinguishedName
DEFINE GeneralName choice
# Copyright (C) 2025 Network RADIUS SAS (legal@networkradius.com)
# This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0
# Version $Id$
-DEFINE Critical sequence sequence_of=oid_and_value,ref=@.OID-Tree
+DEFINE Critical sequence sequence_of=oid_and_value
ATTRIBUTE authorityInfoAccess 1.3.6.1.5.5.7.1.1 sequence sequence_of=sequence,leaf
BEGIN 1.3.6.1.5.5.7.1.1
DEFINE policyQualifiers sequence sequence_of=sequence,size=1..,optional
BEGIN policyQualifiers
-DEFINE policyQualifierInfo sequence sequence_of=oid_and_value,ref=@.OID-Tree
+DEFINE policyQualifierInfo sequence sequence_of=oid_and_value
END policyQualifiers
END policyInformation
DEFINE Attribute sequence
BEGIN Attribute
DEFINE OID oid
-DEFINE Extensions set set_of=oid_and_value,ref=@.OID-Tree,is_extensions
+DEFINE Extensions set set_of=oid_and_value,is_extensions
END Attribute
END Attributes
DEFINE number integer
END version
DEFINE serialNumber octets der_type=integer
-DEFINE signature sequence sequence_of=oid_and_value,ref=@.OID-Tree
+DEFINE signature sequence sequence_of=oid_and_value
DEFINE issuer sequence sequence_of=set
BEGIN issuer
DEFINE subjectPublicKeyInfo sequence
BEGIN subjectPublicKeyInfo
-DEFINE algorithm sequence sequence_of=oid_and_value,ref=@.OID-Tree
+DEFINE algorithm sequence sequence_of=oid_and_value
DEFINE subjectPublicKey bitstring
END subjectPublicKeyInfo
DEFINE issuerUniqueID octetstring option=1,optional
DEFINE subjectUniqueID octetstring option=2,optional
-DEFINE extensions x509_extensions ref=@.OID-Tree,size=1..,option=3,optional
+DEFINE extensions x509_extensions size=1..,option=3,optional
END tbsCertificate
-DEFINE signatureAlgorithm sequence sequence_of=oid_and_value,ref=@.OID-Tree
+DEFINE signatureAlgorithm sequence sequence_of=oid_and_value
DEFINE signature bitstring
END Certificate
int fr_dict_attr_acopy_local(fr_dict_attr_t const *dst, fr_dict_attr_t const *src) CC_HINT(nonnull);
-int fr_dict_attr_set_group(fr_dict_attr_t **da_p) CC_HINT(nonnull);
+int fr_dict_attr_set_group(fr_dict_attr_t **da_p, fr_dict_attr_t const *ref) CC_HINT(nonnull);
/** @} */
/** @name Dict accessors
return dict;
}
-int fr_dict_attr_set_group(fr_dict_attr_t **da_p)
+int fr_dict_attr_set_group(fr_dict_attr_t **da_p, fr_dict_attr_t const *ref)
{
if ((*da_p)->type == FR_TYPE_GROUP) {
fr_assert(fr_dict_attr_ext(*da_p, FR_DICT_ATTR_EXT_REF) != NULL);
fr_assert(fr_dict_attr_ext(*da_p, FR_DICT_ATTR_EXT_REF) == NULL);
- if (!dict_attr_ext_alloc(da_p, FR_DICT_ATTR_EXT_REF)) {
- return -1;
- }
-
- return 0;
+ return dict_attr_ref_aset(da_p, ref, FR_DICT_ATTR_REF_ALIAS);
}
return 0;
}
+static int dict_flag_set_oid_and_value(fr_dict_attr_t **da_p, fr_der_attr_flags_t *flags)
+{
+ flags->is_oid_and_value = true;
+ flags->is_sequence_of = true;
+ flags->sequence_of = FR_DER_TAG_SEQUENCE;
+
+ /*
+ * The dict autoload things aren't set until after we load all of the dictionary entries. So we
+ * just manually set it here for laziness.
+ */
+ if (!attr_oid_tree) {
+ attr_oid_tree = fr_dict_attr_by_name(NULL, fr_dict_root((*da_p)->dict), "OID-Tree");
+ if (!attr_oid_tree) return -1;
+ }
+
+ if (fr_dict_attr_set_group(da_p, attr_oid_tree) < 0) return -1;
+
+ (*da_p)->flags.allow_flat = !flags->is_extensions;
+ return 0;
+}
+
static int dict_flag_sequence_of(fr_dict_attr_t **da_p, char const *value, UNUSED fr_dict_flag_parser_rule_t const *rules)
{
fr_der_attr_flags_t *flags = fr_dict_attr_ext(*da_p, FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC);
}
if (strcmp(value, "oid_and_value") == 0) {
- flags->is_oid_and_value = true;
- flags->is_sequence_of = true;
- flags->sequence_of = FR_DER_TAG_SEQUENCE;
- if (fr_dict_attr_set_group(da_p) < 0) return -1;
-
- (*da_p)->flags.allow_flat = 1;
- return 0;
+ return dict_flag_set_oid_and_value(da_p, flags);
}
type = fr_table_value_by_str(tag_name_to_number, value, FR_DER_TAG_INVALID);
}
if (strcmp(value, "oid_and_value") == 0) {
- flags->is_oid_and_value = true;
- flags->is_sequence_of = true;
- flags->sequence_of = FR_DER_TAG_SEQUENCE;
- if (fr_dict_attr_set_group(da_p) < 0) return -1;
-
- (*da_p)->flags.allow_flat = 1;
- return 0;
+ return dict_flag_set_oid_and_value(da_p, flags);
}
type = fr_table_value_by_str(tag_name_to_number, value, FR_DER_TAG_INVALID);
flags->option = 3;
flags->is_option = true;
- flags->is_sequence_of = true;
- flags->sequence_of = FR_DER_TAG_SEQUENCE;
+ if (dict_flag_set_oid_and_value(da_p, flags) < 0) return false;
}
/*
da->flags.length = 0;
}
- /*
- * sequence_of=oid_and_value has to have a reference to the OID tree.
- *
- * Group refs are added as unresolved refs, see dict_flag_ref(), and are resolved later
- * in dict_fixup_group_apply().
- *
- * @todo - have a function called from dict_attr_finalize() ?
- */
-#if 0
- if (flags->is_oid_and_value) {
- fr_dict_attr_t const *ref;
-
- fr_assert(da->type == FR_TYPE_GROUP);
-
- if (!fr_dict_attr_ref(da)) {
- (void) dict_attr_ref_set(da, attr_oid_tree, FR_DICT_ATTR_REF_ALIAS);
- }
- }
-#endif
-
if (flags->is_choice && unlikely(!fr_type_is_tlv(da->type))) {
fr_strerror_printf("Attribute %s of type %s is not allowed represent a collection of choices.",
da->name, fr_type_to_str(da->type));
# Copyright (C) 2025 The FreeRADIUS Server project and contributors
# This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0
# Version $Id$
-DEFINE Certificate-Extensions x509_extensions ref=@.OID-Tree
+DEFINE Certificate-Extensions x509_extensions
DEFINE Test-GeneralNames group sequence_of=choice,ref=@.GeneralName