[comp.mail.sendmail] .forward

frotz@dri.com (Frotz) (06/01/91)

I am looking for information about the .forward file.  From what I can
piece together, this is handled by the MTA.  My question is:  Is this
sendmail (which we run at this site)?

--
Frotz

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

In article <ACR3CSQ@dri.com> frotz@dri.com writes:
>I am looking for information about the .forward file.  From what I can
>piece together, this is handled by the MTA.  My question is:  Is this
>sendmail (which we run at this site)?
>
>--
>Frotz

  Look in the sendmail operations manual.  It will tell you as an afterthought
to its discussion of aliases that you can do per user aliasing with .forward.

There is also a lot it doesn't tell you.

 Basically, just use a comma separated list of addresses, much as you would
use in aliases.  There is no 'name:' preceding the list though, in .forward.
The .forward probably has to be owned by the user whose mail is being
forwarded.  The man pages for vacation give an example of its use.


-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940

vixie@pa.dec.com (Paul Vixie) (06/01/91)

#  Basically, just use a comma separated list of addresses, much as you would
# use in aliases.  There is no 'name:' preceding the list though, in .forward.

note that multiple lines are processed as well.  so

	vixie, "|/usr/ucb/vacation"

is the same as

	vixie
	"|/usr/ucb/vacation"

cheers
-- 
Paul Vixie
DEC Western Research Lab	<vixie@pa.dec.com>	<paul@vixie.sf.ca.us>
Palo Alto, California, USA	...!decwrl!vixie	...!vixie!paul

e07@nikhefh.nikhef.nl (Eric Wassenaar) (06/03/91)

In article <1991Jun1.053417.17421@pa.dec.com>, vixie@pa.dec.com (Paul Vixie) writes:
> note that multiple lines are processed as well.  so
> 	vixie, "|/usr/ucb/vacation"
> is the same as
> 	vixie
> 	"|/usr/ucb/vacation"

Nope. Not correct. Below is a fix I posted about 2 months ago
(with a subtle but essential enhancement added).

Problem description: (all versions of sendmail)

   If a user 'foo' references himself in his own .forward file,
   it makes a big difference whether this file looks like
	foo,bar
   or like
	foo
	bar
   In the first case mail to 'foo' is forwarded to both 'foo'
   and 'bar', in the second case only to 'bar' but not to 'foo'.
   (Note that it is not required to \escape self-references.)

Analysis:

   During the forward processing, sendtolist() is called for each
   line in the .forward file. A possible self-reference is acted
   upon on a per-call basis, however.

   In the first case, sendtolist("foo,bar") will recognize the
   self-reference of 'foo', will not put 'foo' on the recipient
   list a second time, and because of the self-reference, will
   not mark the original 'foo' to be deleted from the recipient list.

   In the second case, sendtolist("foo") will recognize the self-
   reference, will not put 'foo' on the recipient list a second time,
   and not mark the original 'foo' to be deleted.
   However, sendtolist("bar") will then not see a self-reference in
   this call, and will mark the original 'foo' to be deleted from the
   recipient list by setting the QDONTSEND bit.

   A self-reference in any of the lines in the .forward file should
   be remembered, and the original 'foo' possibly be marked for
   deletion only after all lines in the file have been processed.
   The same holds when processing an :include: file.

Suggested fix:

--- In file sendmail.h ---

	#define QSELFREF 001000 /* self-reference in alias/forward expansion */

--- In file recipient.c module sendtolist() ---
   replace

	if (!selfref && ctladdr != NULL)
		ctladdr->q_flags |= QDONTSEND;

   by

	if (selfref && ctladdr != NULL)
		ctladdr->q_flags |= QSELFREF;

--- In file recipient.c module include() ---
   add

	if (included && !bitset(QSELFREF, ctladdr->q_flags))
		ctladdr->q_flags |= QDONTSEND;

   after the loop in which sendtolist() is called repeatedly.
   The new bool variable "included" must be set TRUE in the loop
   if sendtolist() is actually invoked (safeguard against empty files).

--- In file alias.c module alias() ---
   add

	if (!bitset(QSELFREF, a->q_flags))
		a->q_flags |= QDONTSEND;

   after the call to sendtolist() at the end.

Eric Wassenaar
-- 
Organization: NIKHEF-H, National Institute for Nuclear and High-Energy Physics
Address: Kruislaan 409, P.O. Box 41882, 1009 DB Amsterdam, the Netherlands
Phone: +31 20 592 0412, Home: +31 20 6909449, Telefax: +31 20 592 5155
Internet: e07@nikhef.nl

ATHENA@MAINE.MAINE.EDU (Barry Gates) (06/03/91)

You can find information on the syntax of .forward by doing a man aliases(5).