e07@nikhefh.nikhef.nl (Eric Wassenaar) (03/12/91)
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 (!bitset(QSELFREF, ctladdr->q_flags)) ctladdr->q_flags |= QDONTSEND; after the loop in which sendtolist() is called repeatedly. --- 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