Emailing: 0001-Add-IPv6-support-for-determining-FQDN-during-ADS-joi.patch

David Holder david.holder at
Tue May 12 11:02:14 MDT 2015

Hi All,

Please could you review the attached.

The existing code uses gethostbyname() which is obsoleted and should not 
be used.

This patch uses getaddrinfo(). With the AI_CANONNAME flag set, 
getaddrinfo() returns the canonical name of the host (that is its FQDN) 
in the first addrinfo struct. It only puts the canonical name in the 
first addrinfo struct as there should only ever be one FQDN.

The bad news with using getaddrinfo() is that for it to work /etc/hosts 
must be formatted correctly. It is less forgiving than gethostbyname() 
and does not return all the aliases. As a result, the FQDN must come 
before any aliases in /etc/hosts. I have added additional DEBUG messages 
to catch this. Please let me know if you think this may be a problem.

There are still a number of other places that gethostbyname() is used. I 
plan, with time, to eradicate them all. This just happens to be one that 
has caused me grief.

Dr David Holder CEng FIET MIEEE

Erion Ltd, An Cala, Inverkirkaig, Lochinver, Sutherland, IV27 4LR, UK

Reception: +44 (0)1422 207000

Direct Dial: +44 (0)131 2026317

Registered in England and Wales. Registered Number 3521142
Registered Office: Newtons, 49 Coniscliffe Road, Darlington, County 
Durham, DL3 7EH, UK
VAT Number: GB 698 3633 78

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-IPv6-support-for-determining-FQDN-during-ADS-joi.patch
Type: text/x-patch
Size: 4031 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list