~ubuntu-branches/ubuntu/hardy/postfix/hardy-security

« back to all changes in this revision

Viewing changes to src/util/get_hostname.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2007-06-01 23:14:55 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20070601231455-dm7tvhh7k68w3c5q
Tags: 2.4.3-1
* New upstream version
* Cleanup merge markers in changelog.  Closes: #420411
* Remove stale code in preinst.  Upgrading from pre-sarge versions no
  longer works.  Closes: #420413
* Template file overhaul to go with stale code removal, and translations
  Closes: #420156, #422339, #422975, #423110, #423367, #423876, #423878,
  #423894, #424689, #424762, #425411, #425682, #425980, #426052, #426214,
  #426329, #426833

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
     * part of the socket interface library. We avoid the more politically-
62
62
     * correct uname() routine because that has no portable way of dealing
63
63
     * with long (FQDN) hostnames.
 
64
     * 
 
65
     * DO NOT CALL GETHOSTBYNAME FROM THIS FUNCTION. IT BREAKS MAILDIR DELIVERY
 
66
     * AND OTHER THINGS WHEN THE MACHINE NAME IS NOT FOUND IN /ETC/HOSTS OR
 
67
     * CAUSES PROCESSES TO HANG WHEN THE NETWORK IS DISCONNECTED.
 
68
     * 
 
69
     * POSTFIX NO LONGER NEEDS A FULLY QUALIFIED HOSTNAME. INSTEAD POSTFIX WILL
 
70
     * USE A DEFAULT DOMAIN NAME "LOCALDOMAIN".
64
71
     */
65
72
    if (my_host_name == 0) {
 
73
        /* DO NOT CALL GETHOSTBYNAME FROM THIS FUNCTION */
66
74
        if (gethostname(namebuf, sizeof(namebuf)) < 0)
67
75
            msg_fatal("gethostname: %m");
68
76
        namebuf[MAXHOSTNAMELEN] = 0;
 
77
        /* DO NOT CALL GETHOSTBYNAME FROM THIS FUNCTION */
69
78
        if (valid_hostname(namebuf, DO_GRIPE) == 0)
70
79
            msg_fatal("unable to use my own hostname");
 
80
        /* DO NOT CALL GETHOSTBYNAME FROM THIS FUNCTION */
71
81
        my_host_name = mystrdup(namebuf);
72
82
    }
73
83
    return (my_host_name);