Subject: bin/5039: change to vacation to support wider variety of mailers
To: None <gnats-bugs@gnats.netbsd.org>
From: None <woods@always.weird.com>
List: netbsd-bugs
Date: 02/23/1998 03:03:37
>Number:         5039
>Category:       bin
>Synopsis:       change to vacation to support wider variety of mailers
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 23 00:05:00 1998
>Last-Modified:
>Originator:     Greg A. Woods
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Release:        NetBSD-1.3
>Environment:

System: NetBSD always 1.3 NetBSD 1.3 (GENERIC_SCSI3) #0: Thu Jan 1 19:03:39 MET 1998 pk@flambard:/usr/src1/sys/arch/sparc/compile/GENERIC_SCSI3 sparc

>Description:

	Vacation doesn't find the user's address in mail that's sent
	without a 'To:' (or 'Cc:') header, and most importantly not in
	mail that's been 'Bcc:'ed to the user.  However most mailers
	do include the specific envelope address that resulted in the
	delivery.  Unfortunately the header used to show this address
	is not standard and several varieties exist.

>How-To-Repeat:

	Try using vacation with a non-RFC-822 compliant sender which
	doesn't include a 'To:' header or with mail that's been Bcc'ed
	to the user.

>Fix:

	Apply the attached patch.  It should support at minimum
	Sendmail, Smail-3, and Exim.

	Note this patch also recommends in a comment a better way how
	to find the proper sender address.  This would make vacation
	compatible with mailers that don't use the 'From ' unix
	mailbox format.  There are probably also those who would argue
	that the vacation notice should go to the 'Reply-to:' header
	(if there is one) instead of the envelope sender address,
	though this could annoy as many people as it helps.

*** vacation.c-ORIG	Mon Feb 23 02:46:17 1998
--- vacation.c	Mon Feb 23 02:48:30 1998
***************
*** 211,216 ****
--- 211,217 ----
  	while (fgets(buf, sizeof(buf), stdin) && *buf != '\n')
  		switch(*buf) {
  		case 'F':		/* "From " */
+ 			/* XXX should instead consider Return-Path: and Sender: */
  			cont = 0;
  			if (!strncmp(buf, "From ", 5)) {
  				for (p = buf + 5; *p && *p != ' '; ++p);
***************
*** 245,250 ****
--- 246,261 ----
  			goto findme;
  		case 'T':		/* "To:" */
  			if (strncmp(buf, "To:", 3))
+ 				break;
+ 			cont = 1;
+ 			goto findme;
+ 		case 'A':
+ 			if (strncmp(buf, "Apparently-To:", 3))
+ 				break;
+ 			cont = 1;
+ 			goto findme;
+ 		case 'D':
+ 			if (strncmp(buf, "Delivered-To:", 3))
  				break;
  			cont = 1;
  			goto findme;
>Audit-Trail:
>Unformatted: