]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fr_pair_afrom_num() no longer produces unknown da's
authorAlan T. DeKok <aland@freeradius.org>
Thu, 10 Jun 2021 14:02:46 +0000 (10:02 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 10 Jun 2021 14:05:32 +0000 (10:05 -0400)
It is now only called from internal code, using hard-coded numbers.
if the da does not exist, then the admin has edited the
dictionaries and broken them.  Instead of failing with an
opaque error, just don't create the VP

src/lib/pair.c

index 377ab22d41b728287abd0d5ab415b40f8f40b076..146c82f95b551ed0f704ed5ba0814014fbc778b7 100644 (file)
@@ -121,24 +121,7 @@ VALUE_PAIR *fr_pair_afrom_num(TALLOC_CTX *ctx, unsigned int attr, unsigned int v
        DICT_ATTR const *da;
 
        da = dict_attrbyvalue(attr, vendor);
-       if (!da) {
-               VALUE_PAIR *vp;
-
-               vp = fr_pair_alloc(ctx);
-               if (!vp) return NULL;
-
-               /*
-                *      Ensure that the DA is parented by the VP.
-                */
-               da = dict_unknown_afrom_fields(vp, attr, vendor);
-               if (!da) {
-                       talloc_free(vp);
-                       return NULL;
-               }
-
-               vp->da = da;
-               return vp;
-       }
+       if (!da) return NULL;
 
        return fr_pair_afrom_da(ctx, da);
 }