Subject: bin/4388: sendmail uses dns even if told not to do so
To: None <email@example.com>
From: Martin Husemann <firstname.lastname@example.org>
Date: 10/29/1997 19:59:40
>Synopsis: sendmail queries dns even if configured not to do it
>Responsible: bin-bug-people (Utility Bug People)
>Arrival-Date: Wed Oct 29 11:20:03 1997
>Originator: Martin Husemann
UP-Vision Computergrphik GmbH, Bad Arolsen
>Release: Oct 28
System: NetBSD rumolt.teuto.de 1.3_ALPHA NetBSD 1.3_ALPHA (RUMOLT) #0: Tue Oct 28 20:12:27 MET 1997 email@example.com:/usr/src/sys-local/arch/i386/compile/RUMOLT i386
In a setup where DNS queries should be avoided (e.g. DNS behind dial-up link)
and a sendmail configuration forwarding all mail uncanonicalized to a smart
hub via define(`SMART_HOST', esmtp:[mailhost.my.do.main]) or even simpler a
FEATURE(nullclient, [mailhost.my.do.main]) and a /etc/service.switch file
and /etc/hosts of course includes "mailhost" as well as "mailhost.my.do.main".
Send a mail. Watch ps -ax show sendmail in "user open" state for about
60 seconds, then the mail rush through in another few seconds.
Looking in the sendmail source, there is the sm_gethostbyname function
called for the "mailhost.my.do.main." - note the trailing dot. This functions
first does a gethostbyname from this name, waits 60 seconds until it fails
and then proceeds with the "home made" service switch functions to look up
the name again in the order specified by /etc/service.switch. In that process
it strips everything after the first dot and looks up the short name, in the
order given by service.switch, and of course succeeds at once.
Code inspection/gdb in a setup as described above.
Add another alias to /etc/hosts with trailing dot.
Make gethostbyname ignore trailing dots when searching /etc/hosts.