🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #394

/bin/mail incorrectly deletes the "From: " header.

#394
From: Neil Rickert
Date: Thu, 20 Jun 1991 14:37
65 lines
2366 bytes
  PROBLEM:

    /bin/mail will, under certain circumstances, delete an existing
    "From:" header.

  REPEAT BY:

/bin/mail -r $USER -d $USER <<EOF
From: $USER (Just testing)
To: $USER

Test
EOF

    Observe that in the mail delivered to your mailbox, the "From:"
    header has been discarded.

  ANALYSIS:

    /bin/mail should be testing for the 5 character string "From " instead
    of the 4 character string "From".

  IMPLICATIONS:

    Under certain circumstances, the "From:" header is discarded and
    regenerated by sendmail.  Depending on the order of the header
    definition, this may result in "From:" preceding the "Received:"
    headers.  If it is the first header, /bin/mail may delete it.

  WORKAROUND:

    Make sure your local mailer definition in 'sendmail.cf' includes the
    'R' flag to generate a "Received:" header.  Send yourself mail with the
    command:  echo Testing | /usr/lib/sendmail $USER
    Inspect the mail, and make sure that the "Received:" header precedes the
    "From:" header.  If not, rearrange the header definitions in sendmail.cf
    appropriately.

  PATCH:

*** binmail.c.orig	Fri Nov 30 14:22:31 1990
--- binmail.c	Thu Jun 20 06:22:45 1991
***************
*** 481,487 ****
  				usage();
  			truename = argv[1];
  			fgets(line, LSIZE, stdin);
! 			if (strncmp("From", line, 4) == 0)
  				line[0] = '\0';
  			argv++;
  			argc--;
--- 481,487 ----
  				usage();
  			truename = argv[1];
  			fgets(line, LSIZE, stdin);
! 			if (strncmp(from, line, 5) == 0)
  				line[0] = '\0';
  			argv++;
  			argc--;
-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940
Technical Details
Message-ID: <1991Jun20.143728.23579@mp.cs.niu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!rickert

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!rickert
From: rickert@mp.cs.niu.edu (Neil Rickert)
Newsgroups: comp.bugs.4bsd,comp.mail.sendmail
Subject: /bin/mail incorrectly deletes the "From: " header.
Summary: Incorrect comparison with "From" instead of "From ".
Message-ID: <1991Jun20.143728.23579@mp.cs.niu.edu>
Date: 20 Jun 91 14:37:28 GMT
Organization: Northern Illinois University
Lines: 65