Distributed /bin/rmail chokes on uucp "forwarded by ..." lines

Arnold D. Robbins {EUCC} arnold at emory.UUCP
Mon Apr 7 03:44:48 AEST 1986


We are running very vanilla 4.2 BSD on two vaxen (not currently on the net,
but connected via uucp to the machine I'm writing this on).  I found a bug
in the /bin/rmail as it came from Berkeley. This may be a very old bug, but
you never know. Thanks to akgua!glc for helping to trace this down.
Bug report in the official format follows:

---------------------------------

Subject: Distributed /bin/rmail chokes on uucp "forwarded by ..." lines
Index:	/usr/src/bin/rmail.c 4.2BSD

Description:
	Rmail chokes on incoming lines of the form

	>From glc Tue Apr  1 13:36 EST 1986 forwarded by glc

and ends up delivering the mail as "remote from somewhere". Using 'R' in
/usr/ucb/Mail tries to send mail to the bogus site ...!somewhere!person.
This occured on mail coming from a System V system, but it may also be other
UUCP's.

Repeat-By:
	echo test | mail yoursite!yoursite!you
or some such magic incantation.

Fix:
	Apply the following context diff. Your line numbers may vary.

*** /tmp/,RCSt1004875	Sun Apr  6 12:25:14 1986
--- rmail.c	Fri Apr  4 13:29:37 1986
***************
*** 1,5
  #ifndef lint
! static char RCSid[] = "$Header: rmail.c,v 1.1 86/04/04 11:00:31 root Exp $";
  #endif
  
  /*

--- 1,5 -----
  #ifndef lint
! static char RCSid[] = "$Header: rmail.c,v 1.2 86/04/04 13:28:54 root Exp $";
  #endif
  
  /*
***************
*** 4,9
  
  /*
   * $Log:	rmail.c,v $
   * Revision 1.1  86/04/04  11:00:31  root
   * Initial revision
   * 

--- 4,13 -----
  
  /*
   * $Log:	rmail.c,v $
+  * Revision 1.2  86/04/04  13:28:54  root
+  * Fix to handle 'forwarded by ...' incoming lines. They get thrown away.
+  * ADR.
+  * 
   * Revision 1.1  86/04/04  11:00:31  root
   * Initial revision
   * 
***************
*** 92,97
  					uf = p + 1;
  					break;
  				}
  				cp = "remote from somewhere";
  			}
  #ifdef DEBUG

--- 96,108 -----
  					uf = p + 1;
  					break;
  				}
+ 				/* check for "forwarded by ..." lines. ADR */
+ 				cp = rindex (lbuf, 'f');
+ 				if (cp != NULL &&
+ 					strncmp (cp, "forwarded by ", 13) == 0)
+ 					goto contin1;	/* chuck the line */
+ 				/* else
+ 					fall thru to old code */
  				cp = "remote from somewhere";
  			}
  #ifdef DEBUG
***************
*** 109,114
  		if (Debug)
  			printf("ufrom='%s', sys='%s', from now '%s'\n", uf, sys, from);
  #endif
  	}
  	(void) strcat(from, uf);
  

--- 120,127 -----
  		if (Debug)
  			printf("ufrom='%s', sys='%s', from now '%s'\n", uf, sys, from);
  #endif
+ 	contin1:
+ 		;	/* null statement, target of goto */
  	}
  	(void) strcat(from, uf);
  
-- 
Arnold Robbins
CSNET:	arnold at emory	BITNET:	arnold at emoryu1
ARPA:	arnold%emory.csnet at csnet-relay.arpa
UUCP:	{ akgua, decvax, gatech, sb1, sb6, sunatl }!emory!arnold

"All this digital stuff is just a fad. Analog is the way to go."
	-- William M. Robbins, 1984



More information about the Comp.bugs.4bsd.ucb-fixes mailing list