]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
PENs are explicitly 32bit
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 19 Mar 2018 11:53:26 +0000 (11:53 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 19 Mar 2018 11:53:26 +0000 (11:53 +0000)
src/include/dict.h
src/lib/util/dict.c

index a5c05a146293c5f0782d6edac3e8c8a3955e1b71..4a1feeff3cc4996d76df217dec0c966dedc933e7 100644 (file)
@@ -127,7 +127,7 @@ typedef struct {
  * so we can represent a vendor with a single struct.
  */
 typedef struct {
-       unsigned int            pen;                    //!< Private enterprise number.
+       uint32_t                pen;                            //!< Private enterprise number.
        size_t                  type;                           //!< Length of type data
        size_t                  length;                         //!< Length of length data
        size_t                  flags;                          //!< Vendor flags.
@@ -282,12 +282,12 @@ fr_dict_vendor_t const    *fr_dict_vendor_by_da(fr_dict_attr_t const *da);
 
 fr_dict_vendor_t const *fr_dict_vendor_by_name(fr_dict_t const *dict, char const *name);
 
-fr_dict_vendor_t const *fr_dict_vendor_by_num(fr_dict_t const *dict, int vendor);
+fr_dict_vendor_t const *fr_dict_vendor_by_num(fr_dict_t const *dict, uint32_t vendor_pen);
 
 fr_dict_attr_t const   *fr_dict_vendor_attr_by_da(fr_dict_attr_t const *da);
 
 fr_dict_attr_t const   *fr_dict_vendor_attr_by_num(fr_dict_t const *dict,
-                                                   unsigned int vendor_root, unsigned int vendor);
+                                                   unsigned int vendor_root, uint32_t vendor_pen);
 
 fr_dict_attr_t const   *fr_dict_attr_by_name_substr(fr_dict_t const *dict, char const **name);
 
index dab3884525c2233b7dd0e0c4376b546251bbe8ac..d9e797be15070969e8361081506c20a6b27e57ea 100644 (file)
@@ -2970,15 +2970,15 @@ fr_dict_vendor_t const *fr_dict_vendor_by_name(fr_dict_t const *dict, char const
  *     - The vendor.
  *     - NULL if no vendor with that number was regitered for this protocol.
  */
-fr_dict_vendor_t const *fr_dict_vendor_by_num(fr_dict_t const *dict, int pen)
+fr_dict_vendor_t const *fr_dict_vendor_by_num(fr_dict_t const *dict, uint32_t vendor_pen)
 {
-       fr_dict_vendor_t dv;
+       fr_dict_vendor_t        find = {
+                                       .pen = vendor_pen
+                               };
 
        INTERNAL_IF_NULL(dict);
 
-       dv.pen = pen;
-
-       return fr_hash_table_finddata(dict->vendors_by_num, &dv);
+       return fr_hash_table_finddata(dict->vendors_by_num, &find);
 }
 
 /** Return the vendor that parents this attribute
@@ -3009,12 +3009,12 @@ fr_dict_attr_t const *fr_dict_vendor_attr_by_da(fr_dict_attr_t const *da)
  *
  * @param[in] dict             to search for the vendor in.
  * @param[in] vendor_root      of the vendor root attribute.  Could be 26 (for example) in RADIUS.
- * @param[in] vendor           to find.
+ * @param[in] vendor_pen       to find.
  * @return
  *     - NULL if vendor does not exist.
  *     - A fr_dict_attr_t representing the vendor in the dictionary hierarchy.
  */
-fr_dict_attr_t const *fr_dict_vendor_attr_by_num(fr_dict_t const *dict, unsigned int vendor_root, unsigned int vendor)
+fr_dict_attr_t const *fr_dict_vendor_attr_by_num(fr_dict_t const *dict, unsigned int vendor_root, uint32_t vendor_pen)
 {
        fr_dict_attr_t const *da;
 
@@ -3039,9 +3039,9 @@ fr_dict_attr_t const *fr_dict_vendor_attr_by_num(fr_dict_t const *dict, unsigned
                return NULL;
        }
 
-       da = fr_dict_attr_child_by_num(da, vendor);
+       da = fr_dict_attr_child_by_num(da, vendor_pen);
        if (!da) {
-               fr_strerror_printf("Vendor %i not defined", vendor);
+               fr_strerror_printf("Vendor %i not defined", vendor_pen);
                return NULL;
        }