Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Oct 2002 22:15:45 +1000 (EST)
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/43926: ports/mail/mutt can't handle FQDN > 31 characters
Message-ID:  <200210111215.g9BCFjmk011450@server.c18609.belrs1.nsw.optusnet.com.au>

next in thread | raw e-mail | index | archive | help

>Number:         43926
>Category:       ports
>Synopsis:       ports/mail/mutt can't handle FQDN > 31 characters
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 11 05:20:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Peter Jeremy
>Release:        FreeBSD 4.7-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD server.c18609.belrs1.nsw.optusnet.com.au 4.7-PRERELEASE FreeBSD 4.7-PRERELEASE #4: Sat Sep 14 15:07:16 EST 2002 root@server.c18609.belrs1.nsw.optusnet.com.au:/usr/obj/usr/src/sys/server i386

>Description:
	Mutt uses 'nodename' returned uname(3) to determine the system
	hostname.  If utsname.nodename includes a '.' then it is assumed
	to be a FQDN, otherwise it is assumed to be a bare hostname and
	the domainname from /etc/resolv.conf is appended.

	FreeBSD returns the FQDN as utsname.nodename and this is truncated
	if it equals or exceeds SYS_NMLN (32).  If a system has a long
	FQDN then mutt will read a truncated FQDN in utsname.nodename but
	will assume it is the complete FQDN.

	This shows up by mutt generating a From: address like
	"peter@server.c18609.belrs1.nsw.optusn" in my case.

>How-To-Repeat:

	1) Setup a machine with a long FQDN.
	2) Ensure that .muttrc includes "set edit_headers".
	3) Start mutt.

	The 'From:' address reported within mutt will be truncated.

>Fix:
	It's not clear whether this is a bug in mutt or FreeBSD.  The
	easiest solution would seem to be to use gethostname(3) instead
	of uname(3):
--- init.c~	Mon Feb 11 20:58:54 2002
+++ init.c	Fri Oct 11 21:34:55 2002
@@ -45,7 +45,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <sys/utsname.h>
 #include <errno.h>
 #include <sys/wait.h>
 
@@ -1706,7 +1705,7 @@
 void mutt_init (int skip_sys_rc, LIST *commands)
 {
   struct passwd *pw;
-  struct utsname utsname;
+  char nodename[STRING];
   char *p, buffer[STRING], error[STRING];
   int i, default_rc = 0, need_pause = 0;
   BUFFER err;
@@ -1764,16 +1763,16 @@
 #endif
 
   /* And about the host... */
-  uname (&utsname);
+  gethostname(nodename, sizeof nodename);
   /* some systems report the FQDN instead of just the hostname */
-  if ((p = strchr (utsname.nodename, '.')))
+  if ((p = strchr (nodename, '.')))
   {
-    Hostname = mutt_substrdup (utsname.nodename, p);
+    Hostname = mutt_substrdup (nodename, p);
     p++;
     strfcpy (buffer, p, sizeof (buffer)); /* save the domain for below */
   }
   else
-    Hostname = safe_strdup (utsname.nodename);
+    Hostname = safe_strdup (nodename);
 
 #ifndef DOMAIN
 #define DOMAIN buffer
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210111215.g9BCFjmk011450>