tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/bin/hostname
> > Well, I think that while we ship software that works in a particular
> > way, we should note the requirements in the likely sorts of places that
> > people will look for documentation. Postfix as an example expects that
> > either gethostname(2) returns a FQDN or that /etc/postfix/main.cf has
> > the myhostname or mydomain defined.
>
>Nope; it will also do a DNS lookup on the gethostname result.
Err ... are you sure? From $(postfix-2.10.1)/src/util/get_hostname.c:
const char *get_hostname(void)
{
...
/*
* The gethostname() call is not (or not yet) in ANSI or POSIX, but it is
* part of the socket interface library. We avoid the more politically-
* correct uname() routine because that has no portable way of dealing
* with long (FQDN) hostnames.
*
* DO NOT CALL GETHOSTBYNAME FROM THIS FUNCTION. IT BREAKS MAILDIR DELIVERY
* AND OTHER THINGS WHEN THE MACHINE NAME IS NOT FOUND IN /ETC/HOSTS OR
* CAUSES PROCESSES TO HANG WHEN THE NETWORK IS DISCONNECTED.
*
* POSTFIX NO LONGER NEEDS A FULLY QUALIFIED HOSTNAME. INSTEAD POSTFIX WILL
* USE A DEFAULT DOMAIN NAME "LOCALDOMAIN".
*/
I realize this really doesn't make the case either way whether or not
hostname(1) should return an FQDN. Also, it may be that gethostbyname()
(or more likely, getaddrinfo() nowadays) is called somewhere above this
function.
--Ken
Home |
Main Index |
Thread Index |
Old Index