Re: Nameserver calls - libesmtp problem?



On Thu, 28 June 18:47 Albrecht Dreß wrote:

| No, for sure this is *not* the problem here. I run sendmail at port 25, and it
| does never dial in. I sent you a log from a session with `telnet localhost 25'
| yesterday. You can see that I submitted exactly the same commands as your test
| app does, but I did not get the dns call.

If you reread my messages from yesterday, you will see that I said that
getaddrinfo is guaranteed not to query a name server when passed a NULL
hostname, in which case the loopback interface address is returned.  On the
implementation in GNU libc, I observe the following - if an IP address literal
is used, no query is made, if "localhost" or any other name is used a name
server is queried.  This is correct behaviour, besides it is implemented in
the resolver so I can't do anything about that.   libESMTP will accept an empty
host name i.e. something like ":smtp" and pass NULL to getaddrinfo to take
advantage of this behaviour.

I have just run the example program specifying an address literal of a SMTP
server on the local network here.  While doing so I ran ethereal to see
what DNS queries were made.  Using a server on a different system eliminates
server side effects obviously.  In this situation *no DNS queries are made*.

Repeating the session using the hostname of the remote server reveals queries
first for an AAAA record which fails and then for an A record which succeeds.
No other queries are evident.

LibESMTP in this respect is correct.  It simply does not query a name server
when it is not required.

In light of this and looking over your name server query again I notice the
name server query is for the AAAA record for "localhost".  I missed this fact
before because I dont use tcpdump so I'm not familiar with its output.

I cannot emphasise enough that if "localhost" is specified as a hostname
name server queries *will be made to resolve it*.  I have stated this many
times now.  Furthermore, despite what people expect, this is correct behaviour
of a conformant resolver.  In case anyone has still missed the point,
specify "localhost:25" as ":25" to avoid a DNS query.  I made an effort to
ensure this feature worked correctly.  Please make the effort to use it.

| Hmmm, in principle I am quite happy with sendmail (after this long and
| difficult time of setup; if you had asked me during that period, I guess my
| answer had been a really different one ;-)), so I guess I rather try to
| configure balsa without-esmtp...

Whatever.  But bear in mind that most MTAs have been written because the
authors got fed up fixing the bugs and security holes in sendmail.  Nothing
that sendmail does surprises me.

Brian Stafford




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]