I've recently submitted a re-write of the long-broken mask() function which deviates from the behavior of the old mask() function in a few ways.

1) Domain masks for IPv4 and IPv6 addresses match IP blocks, regardless
   of what ban method you're using.

2) I don't enforce length limitations on usernames. This makes no sense to me at all. If someone is giving mask() a username over 7 characters, then that's a pretty good indication that the server they're on supports usernames over 7 characters, therefore, a ban should work. Either way, it isn't mask()'s job
   to try to enforce this.  If methods 1, 3, 6 or 8 are specified, and the
   provided username is over 7 characters, the username pointer is
   incremented by one (no, not strlen(username) - 7), in order to make room
for the prepended '*' if it's needed. Otherwise, no length changes are made.

3) I don't strip "non-printable" characters from the provided address to generate a ban mask. Once again, if the server is giving you an address in this format then there's no reason why it shouldn't support banning in this format. If it
    doesn't, then it's the server that's broken, not mask().
4) Methods 10-13 are eliminated altogether. They shouldn't be needed, and
    they never worked properly anyway.

5) I don't increment the username pointer if the username begins with '~'.
There wasn't much of a practical benefit of this, and in fact, it only broke things. If you supplied a username which began with '~' or one of the other
   characters also checked for, and supplied a method number like 0, mask()
   generated a ban mask which didn't even match your target.

6) Domains which are under 5 characters in length (such as 'co.uk') are treated as tlds. With the old mask(), if you provided method 4 for such a hostname,
   you would end up banning all of .co.uk, which probably isn't the desired
   result.

7) You must supply the address in the form [EMAIL PROTECTED]".
Something like mask(foo.bar.com 4) no longer works. I don't see much of a need in supporting this, since most of the method numbers deal with fields
    other than the hostname.


Aside from this, I also return an empty string if a ban method outside of the support range was provided. The mask() in epic doesn't have a 'default' case
in its switch() construct, so the buffer referenced by the returned pointer
contained garbage under these circumstances.

If any of you have objections to any of the behavior changes, or have any suggestions for further improvements, feel free to write me back.

-- John M. Burks (aka nsx)

_______________________________________________
List mailing list
List@epicsol.org
http://epicsol.org/mailman/listinfo/list

Reply via email to