Otherattr should return false by default, so that the check attribute is searched for
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 2 Aug 2013 10:30:59 +0000 (11:30 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 2 Aug 2013 11:04:45 +0000 (12:04 +0100)
src/main/valuepair.c

index 06edf2f..ac83668 100644 (file)
@@ -65,11 +65,7 @@ static struct cmp *cmp;
  * @return 0 if check and vp are equal, -1 if vp value is less than check value, 1 is vp value is more than check
  *     value.
  */
-#ifdef HAVE_REGEX_H
-int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
-#else
 int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
-#endif
 {
        int ret = -2;
 
@@ -140,8 +136,13 @@ int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
 
        /*
         *      Attributes must be of the same type.
+        *
+        *      FIXME: deal with type mismatch properly if one side contain
+        *      ABINARY, OCTETS or STRING by converting the other side to
+        *      a string
+        *
         */
-       rad_assert(vp->da->type == check->da->type);
+       if (vp->da->type != check->da->type) return -1;
 
        /*
         *      Tagged attributes are equal if and only if both the
@@ -316,9 +317,9 @@ static bool otherattr(DICT_ATTR const *attribute, DICT_ATTR const **from)
                        return c->first_only;
                }
        }
-       
+
        *from = attribute;
-       return true;
+       return false;
 }
 
 /** Register a function as compare function.