procmail
[Top] [All Lists]

Re: ? test for DNS records

2006-06-16 10:13:38
At 07:55 2006-06-16 -0700, Don Russell wrote:
Primarily as a self-learning exercise, I'm writing a procmail script to
look at the List-ID: header (RFC 2919)
(Ref: http://ietfreport.isoc.org/idref/rfc2919/)

Dunno how you're parsing it, but the List-ID on _this_ very list doesn't 
parse right down to a hostname - you have to grab the part in <>, then 
strip out the  first apparent domain component from the result.

I would like to do a DNS check for the list specified in this header.
After parsing the field contents for the list ID to look up, I thought
the following would work:

:0
*$ ? nslookup ${LISTID}
{
    dns records were found
}
:0 E
{
    dns records were not found (conclusion - fake list = spam/junk, or
DNS server unavailable)
}

However, the :0 E clause is never executed, even if the command line
nslookup fails with a "non-existant domain" message.

Not surprising - nslookup doesn't return an error code, so it always looks 
successful (=0).  Procmail doesn't parse the returned text - it looks to 
the program completion code.

Unfortunatley, dig and host are both in the same boat:

host -t MX foo.lists.RWTH-Aachen.DE ; echo $?

Remove "foo." and you'll get the same error code (0), despite the 
successful output.

In general, "host" is a lighter app to use than nslookup, and nslookup is 
deprecated anyway - if your system doesn't tell you as much when you run 
nslookup, you must have a very old distribution of BIND, or someone altered 
the source and recompiled nslookup so that it wouldn't report the warning 
(which is quite possible - it's a very handy tool).

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>