*/
if (conf->filter_response_vps) {
fr_pair_list_sort(&packet->vps, fr_pair_cmp_by_da);
- if (!fr_pair_validate_relaxed(NULL, conf->filter_response_vps, packet->vps)) {
+ if (!fr_pair_validate_relaxed(NULL, &conf->filter_response_vps, &packet->vps)) {
goto drop_response;
}
}
* Now verify the packet passes the attribute filter
*/
if (conf->filter_request_vps) {
- if (!fr_pair_validate_relaxed(NULL, conf->filter_request_vps, packet->vps)) {
+ if (!fr_pair_validate_relaxed(NULL, &conf->filter_request_vps, &packet->vps)) {
goto drop_request;
}
}
* @param filter attributes to check list against.
* @param list attributes, probably a request or reply
*/
-bool fr_pair_validate(VALUE_PAIR const *failed[2], VALUE_PAIR *filter, VALUE_PAIR *list)
+bool fr_pair_validate(VALUE_PAIR const *failed[2], VALUE_PAIR **filter, VALUE_PAIR **list)
{
fr_cursor_t filter_cursor;
fr_cursor_t list_cursor;
*
* @todo this should be removed one we have sets and lists
*/
- fr_pair_list_sort(&filter, fr_pair_cmp_by_da);
- fr_pair_list_sort(&list, fr_pair_cmp_by_da);
+ fr_pair_list_sort(filter, fr_pair_cmp_by_da);
+ fr_pair_list_sort(list, fr_pair_cmp_by_da);
- check = fr_cursor_init(&filter_cursor, &filter);
- match = fr_cursor_init(&list_cursor, &list);
+ check = fr_cursor_init(&filter_cursor, filter);
+ match = fr_cursor_init(&list_cursor, list);
while (match || check) {
/*
* Lists are of different lengths
* Note that the RFCs say that for attributes of
* the same type, order is important.
*/
- if (fr_pair_cmp(check, match) != 1) goto mismatch;
+ switch (check->da->type) {
+ case FR_TYPE_STRUCTURAL:
+ if (!fr_pair_validate(failed, &check->vp_group, &match->vp_group)) goto mismatch;
+ break;
+
+ default:
+ /*
+ * This attribute passed the filter
+ */
+ if (!fr_pair_cmp(check, match)) goto mismatch;
+ break;
+ }
check = fr_cursor_next(&filter_cursor);
match = fr_cursor_next(&list_cursor);
* @param filter attributes to check list against.
* @param list attributes, probably a request or reply
*/
-bool fr_pair_validate_relaxed(VALUE_PAIR const *failed[2], VALUE_PAIR *filter, VALUE_PAIR *list)
+bool fr_pair_validate_relaxed(VALUE_PAIR const *failed[2], VALUE_PAIR **filter, VALUE_PAIR **list)
{
vp_cursor_t filter_cursor;
vp_cursor_t list_cursor;
*
* @todo this should be removed one we have sets and lists
*/
- fr_pair_list_sort(&filter, fr_pair_cmp_by_da);
- fr_pair_list_sort(&list, fr_pair_cmp_by_da);
+ fr_pair_list_sort(filter, fr_pair_cmp_by_da);
+ fr_pair_list_sort(list, fr_pair_cmp_by_da);
- fr_pair_cursor_init(&list_cursor, &list);
- for (check = fr_pair_cursor_init(&filter_cursor, &filter);
+ fr_pair_cursor_init(&list_cursor, list);
+ for (check = fr_pair_cursor_init(&filter_cursor, filter);
check;
check = fr_pair_cursor_next(&filter_cursor)) {
/*
for (match = fr_pair_cursor_head(&list_cursor);
ATTRIBUTE_EQ(match, check);
match = fr_pair_cursor_next(&list_cursor)) {
- /*
- * This attribute passed the filter
- */
- if (!fr_pair_cmp(check, match)) goto mismatch;
+ switch (check->da->type) {
+ case FR_TYPE_STRUCTURAL:
+ if (!fr_pair_validate_relaxed(failed, &check->vp_group, &match->vp_group)) goto mismatch;
+ break;
+
+ default:
+ /*
+ * This attribute passed the filter
+ */
+ if (!fr_pair_cmp(check, match)) goto mismatch;
+ break;
+ }
}
}