Re: [Mutt] #3298: Mutt's way to get the FQDN is broken
#3298: Mutt's way to get the FQDN is broken
---------------------+------------------------------------------------------
Reporter: vinc17 | Owner: mutt-dev
Type: defect | Status: new
Priority: major | Milestone:
Component: mutt | Version: 1.5.20
Resolution: | Keywords:
---------------------+------------------------------------------------------
Comment(by Derek Martin):
{{{
On Wed, Jul 22, 2009 at 07:37:13PM -0500, Derek Martin wrote:
So actually, after coding up a fix for this that used getaddrinfo(), I
realized that it's not a good way to solve the problem. Here's why:
gethostbyname() has the advantage that you can get the hostname
using... the hostname. This can only fail if the hostname is not set
(or the system is otherwise broken). If you use getnameinfo, you MUST
pass it an IP address. This works fine in the expected case: machine
with one hostname and a corresponding IP address which reverse
resolves to that hostname. However, if the machine is multihomed, or
if the forward and reverse DNS don't match, you can get unexpected
(and undesirable) results (including none at all). Lots of folks have
such setups.
So, you gotta use gethostbyname(). Patch attached.
}}}
--
Ticket URL: <http://dev.mutt.org/trac/ticket/3298#comment:>
Mutt <http://www.mutt.org/>
The Mutt mail user agent