Changes between Initial Version and Version 4 of Ticket #933

Oct 13, 2010, 7:57:40 PM (9 years ago)

Looks neat! Will we ever want to match anything in a form other than "Replace a suffix starting with a dot with this other suffix starting with a dot?" I don't think so.

The doxygen comment on addressmap_match_superdomains() doesn't actually say what it does with the match if it finds one. It should take a const char *, not a char *. Also, it should probably return 0 rather than 1.

The check for ".exit" in addressmap_rewrite seems off. There is no real reason to disallow "MapAddress .com", even if "" doesn't end in exit. Also, Why not allow "MapAddress . .everythinggoesoverthis.exit" ?

IOW, I am proposing that the option syntaxes should be more like:

MapAddress a.b.c d.e.f # This is what we have now MapAddress .a.b.c d.e.f # Replaces any address ending with .a.b.c with d.e.f MapAddress .a.b.c .d.e.f # Replaces the .a.b.c at the end of any addr with .d.e.f

So in the first case, "x.a.b.c" is unaffected, in the second case "x.a.b.c" turns into "d.e.f", and in the third case "x.a.b.c" turns into "x.d.e.f". No special handling for .exit is needed.

Parenthetically, do you think this "prefix dot" business is too subtle? Maybe the syntax should be "*.a.b.c" instead of ".a.b.c". Do you think that would confuse people less?

Throughout the code, it seems fragile to have the strings in addressmap_entry_t have a special meaning when the key/value starts with ".". Maybe it would be better to strip the "." when generating them and instead have a flag field added to addressmap_entry_t to indicate whether it should be a suffix match or an exact match?


  • Ticket #933

    • Property Status changed from new to needs_review
    • Property Owner set to mwenge
    • Property Cc mwenge added