Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Dec 1995 23:58:56 -0600 (CST)
From:      "Gil Kloepfer Jr." <gil@limbic.ssdl.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/922: Bad From line handling in mail.local
Message-ID:  <199512300558.XAA22783@limbic.ssdl.com>
Resent-Message-ID: <199512300600.WAA01497@freefall.freebsd.org>

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

>Number:         922
>Category:       misc
>Synopsis:       From line handling incorrect in mail.local
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 29 22:00:01 PST 1995
>Last-Modified:
>Originator:     Gil Kloepfer Jr.
>Organization:
SSDL
>Release:        FreeBSD 2.0-BUILT-19950603 i386
>Environment:

	Any FreeBSD environment using sendmail with mailers such as elm

>Description:

	If a "From " line is in the text of a message, a ">" is not
	consistently prepended to the word "From ", causing mailers such
	as elm to erroneously think that a new message has started.

	The problem occurs specifically when a "From " line occurs in the
	text of a message without a blank line before it.

	The problem has manifested itself more recently because I think
	the old local mailer in sendmail had the F=E option, and I know
	it doesn't now.  mail.local is the correct place to do the
	substitution, not sendmail.

>How-To-Repeat:

	Forward a message to yourself using elm, or remotely using any
	mail user agent that will not automatically prepend ">" to
	"From " lines.  The mail.local program will not do the proper
	prepending.

>Fix:

The logic for the original mail.local for handling "From " lines makes
little sense.  I have interpreted it as attempting to leave existing
"From " lines in the header alone, although I'm pretty sure that these
are supposed to have a prepended ">" also if there is a duplicate.  I
will leave it up to the sendmail people to interpret what the code should
have done, and what it should do now.

The bug is also in the current mail.local in the latest version of sendmail.
I have not checked the 2.1.0-RELEASE of FreeBSD to see if it exists there.

*** mail.local.c	Fri Dec 29 23:45:34 1995
--- mail.local.c.orig	Fri Dec 29 23:46:45 1995
***************
*** 158,171 ****
  	(void)fprintf(fp, "From %s %s", from, ctime(&tval));
  
  	line[0] = '\0';
! 	for (eline = 0; fgets(line, sizeof(line), stdin);) {
  		if (line[0] == '\n')
  			eline = 1;
! 		else
  			if (eline && line[0] == 'F' &&
  			    !memcmp(line, "From ", 5))
  				(void)putc('>', fp);
! 
  		(void)fprintf(fp, "%s", line);
  		if (ferror(fp)) {
  			e_to_sys(errno);
--- 158,172 ----
  	(void)fprintf(fp, "From %s %s", from, ctime(&tval));
  
  	line[0] = '\0';
! 	for (eline = 1; fgets(line, sizeof(line), stdin);) {
  		if (line[0] == '\n')
  			eline = 1;
! 		else {
  			if (eline && line[0] == 'F' &&
  			    !memcmp(line, "From ", 5))
  				(void)putc('>', fp);
! 			eline = 0;
! 		}
  		(void)fprintf(fp, "%s", line);
  		if (ferror(fp)) {
  			e_to_sys(errno);
>Audit-Trail:
>Unformatted:



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