diff -u mutt-1.5.3.orig/PATCHES mutt-1.5.3/PATCHES --- mutt-1.5.3.orig/PATCHES 2002-12-17 10:47:20.000000000 +0100 +++ mutt-1.5.3/PATCHES 2003-01-14 18:21:16.000000000 +0100 @@ -1,0 +1 @@ +Debian.Md.etc_mailname_gethostbyname diff -u mutt-1.5.3.orig/init.c mutt-1.5.3/init.c --- mutt-1.5.3.orig/init.c 2002-12-11 16:13:49.000000000 +0100 +++ mutt-1.5.3/init.c 2003-01-14 18:27:54.000000000 +0100 @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -1748,6 +1749,31 @@ return 0; } +int getmailname(char *s, size_t l) +{ + FILE *f; + char tmp[512]; + char *p = tmp; + + if ((f = fopen ("/etc/mailname", "r")) == NULL) + return (-1); + + if (fgets (tmp, 510, f) != NULL) { + while (*p && !ISSPACE(*p) && l > 0) { + *s++ = *p++; + l--; + } + if (*(s-1) == '.') + s--; + *s = 0; + + fclose (f); + return 0; + } + fclose (f); + return (-1); +} + void mutt_init (int skip_sys_rc, LIST *commands) { struct passwd *pw; @@ -1816,10 +1842,25 @@ Hostname = mutt_substrdup (utsname.nodename, p); p++; strfcpy (buffer, p, sizeof (buffer)); /* save the domain for below */ + Fqdn = safe_strdup (utsname.nodename); } else Hostname = safe_strdup (utsname.nodename); + /* if /etc/mailname exists use it and ignore everything else */ + if (getmailname(buffer, sizeof (buffer)) != -1) + Fqdn = safe_strdup(buffer); + + /* try gethostbyname(3) if /etc/mailname does not exists */ + if (!Fqdn) { + struct hostent *hp; + + if ((hp = gethostbyname(Hostname))) + Fqdn = safe_strdup(hp->h_name); + } + + if (Fqdn) { + } else #ifndef DOMAIN #define DOMAIN buffer if (!p && getdnsdomainname (buffer, sizeof (buffer)) == -1)