Marc Perkel wrote:
> OK - I think I'm making some progress on this. I created a DNS server
> that you can pass a $sender_host_name to and get a code indicating if
> it's a one level or 2 level domain.
>
> I still have more work to do to make it practical. But - try this out
> and tell me if I'm on the right track.
>
> from your command line run:
>
> dig <host>.rb.junkemailfilter.com
>
> Example:
> dig ftp.perkel.com.rb.junkemailfilter.com
>
> It will return a 0.0.0.1 for single level domains and a 0.0.0.2 for two
> level domains.
I've been playing with regex while all this has been happening and came
up with this evil looking thing which should return what you want in the
one regex.
Keeping in mind that I'm terrible with regex and usually have to look up
everything and test it 3 million times ....
Hmm.. this also doesn't take into account illegal hostnames such as
those with bits starting with digits
\N^.*\.(([A-Za-z0-9-]*)\.([A-Za-z-]{3}|[A-Za-z-]{2,3}\.[A-Za-z-]{2}|[A-Za-z-]{3}\.[A-Za-z-]{2,3}\.[A-Za-z-]{2}))$\N
OK. That works.. sort of. For a X.3 domain (com|mil etc), the domain
MUST be 3 parts long, ie X.X.3. For a X.3.2, is has to be 4 parts long.
This is fairly major downfall of the method by the looks :P
I have currently given up on trying to match the 3 different address
types :P There's something happening with the multiple possibility part
that I just don't understand.
xxx.
ftp.perkel.com -> perkel.com OK
xxx.
ftp.perkel.co.uk -> perkel.co.uk OK
www.orgforms.gov.on.ca -> gov.on.ca NOT OK
I'm sure someone who actually knows regex instead of hacking them
together like I do can figure out what's wrong there.
--
The Exim Manual
http://www.exim.org/docs.html
http://www.exim.org/exim-html-current/doc/html/spec_html/index.html