@@ -29,19 +29,22 @@ RCSID("$Id$")
2929#include <freeradius-devel/util/net.h>
3030#include <freeradius-devel/util/proto.h>
3131#include <freeradius-devel/util/table.h>
32+ #include <freeradius-devel/util/dict_ext_priv.h>
3233
3334#include "der.h"
3435
3536static uint32_t instance_count = 0 ;
3637
3738fr_dict_t const * dict_der ;
39+ //fr_dict_attr_t const *attr_oid_tree;
3840
3941extern fr_dict_autoload_t libfreeradius_der_dict [];
4042fr_dict_autoload_t libfreeradius_der_dict [] = { { .out = & dict_der , .proto = "der" }, { NULL } };
4143
4244extern fr_dict_attr_autoload_t libfreeradius_der_dict_attr [];
4345fr_dict_attr_autoload_t libfreeradius_der_dict_attr [] = {
44- { NULL }
46+ // { .out = &attr_oid_tree, .name = "OID-Tree", .type = FR_TYPE_TLV, .dict = &dict_der },
47+ { NULL }
4548};
4649
4750static fr_table_num_sorted_t const tag_name_to_number [] = {
@@ -274,9 +277,8 @@ static int dict_flag_sequence_of(fr_dict_attr_t **da_p, char const *value, UNUSE
274277 }
275278
276279 if (strcmp (value , "oid_and_value" ) == 0 ) {
277- (* da_p )-> type = FR_TYPE_GROUP ;
278280 flags -> is_pair = true;
279- return 0 ;
281+ return fr_dict_attr_set_group ( da_p ) ;
280282 }
281283
282284 type = fr_table_value_by_str (tag_name_to_number , value , FR_DER_TAG_INVALID );
@@ -307,9 +309,8 @@ static int dict_flag_set_of(fr_dict_attr_t **da_p, char const *value, UNUSED fr_
307309 }
308310
309311 if (strcmp (value , "oid_and_value" ) == 0 ) {
310- (* da_p )-> type = FR_TYPE_GROUP ;
311312 flags -> is_pair = true;
312- return 0 ;
313+ return fr_dict_attr_set_group ( da_p ) ;
313314 }
314315
315316 type = fr_table_value_by_str (tag_name_to_number , value , FR_DER_TAG_INVALID );
@@ -692,14 +693,6 @@ static bool attr_valid(fr_dict_attr_t *da)
692693{
693694 fr_der_attr_flags_t * flags = fr_dict_attr_ext (da -> parent , FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC );
694695
695- /*
696- * sequence_of=oid_and_value has to have a reference to the OID tree.
697- */
698- if (flags -> is_pair && !fr_dict_attr_ref (da )) {
699- fr_strerror_const ("Flag has 'oid_and_value' set, but is missing 'ref=OID-Tree'" );
700- return false;
701- }
702-
703696 if (flags -> is_sequence_of || flags -> is_set_of ) {
704697 fr_der_tag_t of_type = (flags -> is_sequence_of ?
705698 flags -> sequence_of :
@@ -716,6 +709,26 @@ static bool attr_valid(fr_dict_attr_t *da)
716709
717710 flags = fr_dict_attr_ext (da , FR_DICT_ATTR_EXT_PROTOCOL_SPECIFIC );
718711
712+ /*
713+ * sequence_of=oid_and_value has to have a reference to the OID tree.
714+ *
715+ * Group refs are added as unresolved refs, see dict_flag_ref(), and are resolved later
716+ * in dict_fixup_group_apply().
717+ *
718+ * @todo - have a function called from dict_attr_finalize() ?
719+ */
720+ #if 0
721+ if (flags -> is_pair ) {
722+ fr_dict_attr_t const * ref ;
723+
724+ fr_assert (da -> type == FR_TYPE_GROUP );
725+
726+ if (!fr_dict_attr_ref (da )) {
727+ (void ) dict_attr_ref_set (da , attr_oid_tree , FR_DICT_ATTR_REF_ALIAS );
728+ }
729+ }
730+ #endif
731+
719732 if (flags -> is_choice && unlikely (!fr_type_is_tlv (da -> type ))) {
720733 fr_strerror_printf ("Attribute %s of type %s is not allowed represent a collection of choices." ,
721734 da -> name , fr_type_to_str (da -> type ));
0 commit comments