We are also experiencing this with postfix 2.7.1 and 2.9.6. The included patch solves the problem for 2.7.1, and should be trivial to adapt for newer versions.

Index: src/global/mail_params.c
===================================================================
--- src/global/mail_params.c    (revision 8399)
+++ src/global/mail_params.c    (revision 8400)
@@ -148,6 +148,7 @@
 #include <grp.h>
 #include <time.h>
 #include <ctype.h>
+#include <netdb.h>
 
 #ifdef STRCASECMP_IN_STRINGS_H
 #include <strings.h>
@@ -294,7 +295,6 @@
 static const char *check_myhostname(void)
 {
     static const char *name;
-    const char *dot;
     const char *domain;
 
     /*
@@ -308,10 +308,17 @@
      * contents of $mydomain. Use a default domain as a final workaround.
      */
     name = get_hostname();
-    if ((dot = strchr(name, '.')) == 0) {
-       if ((domain = mail_conf_lookup_eval(VAR_MYDOMAIN)) == 0)
-           domain = DEF_MYDOMAIN;
-       name = concatenate(name, ".", domain, (char *) 0);
+    if (strchr(name, '.') == 0) {
+       /* This may or may not be the most intelligent possible method,
+          but it is what Debian 'hostname --fqdn' does. */
+       struct hostent *ent = gethostbyname(name);
+       if (ent)
+           name = strdup(ent->h_name);
+       if (strchr(name, '.') == 0) {
+           if ((domain = mail_conf_lookup_eval(VAR_MYDOMAIN)) == 0)
+               domain = DEF_MYDOMAIN;
+           name = concatenate(name, ".", domain, (char *) 0);
+       }
     }
     return (name);
 }

Reply via email to