[exim-dev] [Bug 1532] New: Correctly determine the FQDN prim…

Top Page
Delete this message
Reply to this message
Author: Matthias Liertzer
Date:  
To: exim-dev
New-Topics: [exim-dev] [Bug 1532] Correctly determine the FQDN primary_hostname
Subject: [exim-dev] [Bug 1532] New: Correctly determine the FQDN primary_hostname
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1532
           Summary: Correctly determine the FQDN primary_hostname
           Product: Exim
           Version: 4.84
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Networking
        AssignedTo: nigel@???
        ReportedBy: matthias@???
                CC: exim-dev@???



Created an attachment (id=757)
--> (http://bugs.exim.org/attachment.cgi?id=757)
Patch to correctly determine primary_hostname

If configured with ipv6 support, exim always tries to determine the fqdn
hostname for primary_hostname by first trying the AF_INET6 address type and
only if this doesn't work the AF_INET address type. This is in contrast to
other tools such as `hostname -f`, which, as expected, take the first entry
found in /etc/hosts to find the canonical hostname.

For example, a machine having the uname "test" and the following /etc/hosts
file

172.194.35.66                   ipv4.test test
2a00:1450:400d:806::1005        ipv6.test test


will yield ipv4.test as a FQDN hostname, whereas an /etc/hosts file with

2a00:1450:400d:806::1005        ipv6.test test
172.194.35.66                   ipv4.test test


will yield ipv6.test as a FQDN hostname.

This is in contrast to exim, which always determines ipv6.test as the FQDN.

Attached is a patch, which fixes this behavior and in addition switches from
the obsolete gethostbyname function to getaddrinfo. Note, that the problem is
already reported in downstream distributions:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=760278


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email