Hi,
David Harris [mailto:[EMAIL PROTECTED]] wrote:
> It seems that fastforward's order for matching appears screwey. It appears
> that records in the form "user@" match after the wildcard "@domain"
records,
> while fully specified "user@domain" records match before the wildcard
> "@domain" records. Seems to me that the wild-card records should match
last,
> after bot the "user@domain" and "user@" records have had a chance to
match.
>From some subtle stuff in fastforward.c, findtarget() I get the idea that
the "user@" records are considered to be wildcards in addition to the
"@domain". On a bit more thought, this makes sense to me. So, considering
that they are both forms of wildcards, I can't really make much of a claim
that "user@" records _should_ match before "@domain" records.
Well, because I want _my_ "user@" records to match before "@domain" records,
I went ahead and patched fastforward.c to do this. However, I'm still very
open to hearing why this might be a bad idea.
I've appended the patch after my sig file.
- David Harris
Principal Engineer, DRH Internet Services
--- fastforward.c.orig Sat Jan 2 00:31:38 1999
+++ fastforward.c Sat Jan 2 00:37:45 1999
@@ -129,32 +129,39 @@
char *addr;
{
int r;
int at;
+ /* check for user@domain records */
+
if (!stralloc_copys(&key,prepend)) nomem();
if (!stralloc_cats(&key,addr)) nomem();
case_lowerb(key.s,key.len);
r = cdb_seek(fdcdb,key.s,key.len,&dlen);
if (r == -1) cdbreaderror();
if (r) return 1;
- if (!flagwild) return 0;
+ if (!flagwild) return 0;
+
+ /* check for user@ records */
+
at = str_rchr(addr,'@');
if (!addr[at]) return 0;
if (!stralloc_copys(&key,prepend)) nomem();
- if (!stralloc_cats(&key,addr + at)) nomem();
+ if (!stralloc_catb(&key,addr,at + 1)) nomem();
case_lowerb(key.s,key.len);
r = cdb_seek(fdcdb,key.s,key.len,&dlen);
if (r == -1) cdbreaderror();
if (r) return 1;
+ /* check for @domain records */
+
if (!stralloc_copys(&key,prepend)) nomem();
- if (!stralloc_catb(&key,addr,at + 1)) nomem();
+ if (!stralloc_cats(&key,addr + at)) nomem();
case_lowerb(key.s,key.len);
r = cdb_seek(fdcdb,key.s,key.len,&dlen);
if (r == -1) cdbreaderror();
if (r) return 1;