]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
return "known" unknown attribute if it exists
authorAlan T. DeKok <aland@freeradius.org>
Mon, 30 Jan 2017 17:03:53 +0000 (12:03 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 30 Jan 2017 17:03:53 +0000 (12:03 -0500)
after creating unknown attribute, look it up by name.  If it
exists, return that one.  This lets us use unknown attributes
in the config files, and then have the decoder automatically
reference then when they're seen in the packets.

src/lib/dict.c

index 5b6b76eca410f6af3c2e12cdfdac4040b55d8da9..6b6f3715d808bf04e12f496e21e2b6888536da0d 100644 (file)
@@ -3127,6 +3127,21 @@ fr_dict_attr_t const *fr_dict_unknown_afrom_fields(TALLOC_CTX *ctx, fr_dict_attr
                return NULL;
        }
 
+       /*
+        *      The config files may reference the unknown by name.
+        *      If so, use the pre-defined name instead of an unknown
+        *      one.
+        *
+        *      @fixme: pass the root into this function!
+        */
+       da = fr_dict_attr_by_name(NULL, n->name);
+       if (da) {
+               fr_dict_unknown_free(&parent);
+               parent = n;
+               fr_dict_unknown_free(&parent);
+               return da;
+       }
+
        /*
         *      Ensure the parent is freed at the same time as the
         *      unknown DA.  This should be OK as we never parent