[comp.mail.sendmail] /bin/mail incorrectly deletes the "From: " header.

rickert@mp.cs.niu.edu (Neil Rickert) (06/20/91)

  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