On Thu, Jun 03, 2010 at 08:26:16PM +0200, Moe wrote:

> * Make sure /etc/hosts has something like:
>   127.0.0.1 tail.call tail
> 
> * 'hostname' should return: tail
> * 'hostname -f' should now return: tail.call
> * 'postconf -d mydomain' will still return: localdomain

Which is correct behaviour. Here is the Postfix get_hostname() function, read
it carefully:

    char    namebuf[MAXHOSTNAMELEN + 1];

    /*
     * 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".
     */
    if (my_host_name == 0) {
        /* DO NOT CALL GETHOSTBYNAME FROM THIS FUNCTION */
        if (gethostname(namebuf, sizeof(namebuf)) < 0)
            msg_fatal("gethostname: %m");
        namebuf[MAXHOSTNAMELEN] = 0;
        /* DO NOT CALL GETHOSTBYNAME FROM THIS FUNCTION */
        if (valid_hostname(namebuf, DO_GRIPE) == 0)
            msg_fatal("unable to use my own hostname");
        /* DO NOT CALL GETHOSTBYNAME FROM THIS FUNCTION */
        my_host_name = mystrdup(namebuf);
    }
    return (my_host_name);

-- 
        Viktor.

Reply via email to