-const char filters_rcs[] = "$Id: filters.c,v 1.12 2001/05/31 17:35:20 oes Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.13 2001/05/31 21:21:30 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.c,v $
*
* Revisions :
* $Log: filters.c,v $
+ * Revision 1.13 2001/05/31 21:21:30 jongfoster
+ * Permissionsfile / actions file changes:
+ * - Changed "permission" to "action" throughout
+ * - changes to file format to allow string parameters
+ * - Moved helper functions to actions.c
+ *
* Revision 1.12 2001/05/31 17:35:20 oes
*
* - Enhanced domain part globbing with infix and prefix asterisk
memset(ret, '\0', sizeof(*ret));
- ret->unanchored = (domain[strlen(domain) - 1] == '.');
+ if (domain[strlen(domain) - 1] == '.')
+ {
+ ret->unanchored |= ANCHOR_RIGHT;
+ }
+ if (domain[0] == '.')
+ {
+ ret->unanchored |= ANCHOR_LEFT;
+ }
ret->dbuf = strdup(domain);
*
* Function : domaincmp
*
- * Description : Compare domain names.
- * domaincmp("a.b.c", "a.b.c") => 0 (MATCH)
- * domaincmp("a*.b.c", "a.b.c") => 0 (MATCH)
- * domaincmp("a*.b.c", "abc.b.c") => 0 (MATCH)
- * domaincmp("a*c.b.c","abbc.b.c") => 0 (MATCH)
- * domaincmp("*a.b.c", "dabc.b.c") => 0 (MATCH)
- * domaincmp("b.c" , "a.b.c") => 0 (MATCH)
- * domaincmp("a.b" , "a.b.c") => 1 (DIFF)
- * domaincmp("a.b." , "a.b.c") => 0 (MATCH)
- * domaincmp("" , "a.b.c") => 0 (MATCH)
- *
- * FIXME: I need a definition!
+ * Description : Domain-wise Compare fqdn's. Governed by the bimap in
+ * pattern->unachored, the comparison is un-, left-,
+ * right-anchored, or both.
+ * The individual domain names are compared with
+ * trivialmatch().
*
* Parameters :
* 1 : pattern = a domain that may contain a '*' as a wildcard.
p = pv[pn];
f = fv[fn];
- if (trivimatch(p, f))
+ if (simplematch(p, f))
{
- if(pn)
+ if(pn || !(pattern->unanchored & ANCHOR_LEFT))
{
return 1;
}
fn++;
}
- return ((pn < pattern->dcnt) || ((fn < fqdn->dcnt) && !pattern->unanchored));
-
- return(0);
+ return ((pn < pattern->dcnt) || ((fn < fqdn->dcnt) && !(pattern->unanchored & ANCHOR_RIGHT)));
}