if ((rpp_filter->lines[i]) &&
(rpp_filter->lines[i]->specs[j]) &&
- (tr_prefix_wildcard_match(rp_realm->buf, rpp_filter->lines[i]->specs[j]->match->buf))) {
+ (tr_fspec_matches(rpp_filter->lines[i]->specs[j], rp_realm))) {
*out_action = rpp_filter->lines[i]->action;
*out_constraints = in_constraints;
if (rpp_filter->lines[i]->realm_cons)
talloc_free(fspec);
}
-int tr_fspec_destructor(void *obj)
+static int tr_fspec_destructor(void *obj)
{
TR_FSPEC *fspec=talloc_get_type_abort(obj, TR_FSPEC);
+
if (fspec->field!=NULL)
tr_free_name(fspec->field);
if (fspec->match!=NULL)
return fspec;
}
+void tr_fspec_set_match(TR_FSPEC *fspec, TR_NAME *match)
+{
+ if (fspec->match!=NULL)
+ tr_free_name(fspec->match);
+ fspec->match=match;
+}
+
+/* returns 1 if the spec matches */
+int tr_fspec_matches(TR_FSPEC *fspec, TR_NAME *name)
+{
+ return ((fspec->match!=NULL) &&
+ (0!=tr_prefix_wildcard_match(name->buf, fspec->match->buf)));
+}
+
void tr_fline_free(TR_FLINE *fline)
{
talloc_free(fline);