07-13-04 01:50 AM
jismay@unixboxen.net wrote:
> if the delivery program
> fails the resulting bounce message does contain the expanded form of the
> alias. The expanded alias is a private, internal designator and I need for
it
> to not be exposed.
Preliminary remark 1: The text of the bounce is hardcoded, so you need
to patch the sendmail sources and recompile to change it. The part
you're interested in is in sendmail/savemail.c (as of 8.13.0).
Preliminary remark 2: Look into that file. You will find *three*
instances of " (expanded from: %s)". Each has a putline() preceding
it by about 20 lines that allows you to tell which kind of DSN is
handeled there; namely, "The following addresses had permanent fatal
errors", "... transient non-fatal errors", and "... successful delivery
notifications".
Preliminary remark 3: The state of affairs may be more complicated than
what you described. Bounces will contain q->q_paddr (printable
representation of final address) as the failed address, and if the email
wasn't received thusly addressed, give q->q_alias->q_paddr (one step
back) as "expanded from". sendmail, however, records address expansion
*all the way back* to the one that was received via SMTP, as
q->q_alias->q_alias->q_paddr, q->q_alias->q_alias->q_alias->q_paddr,
etc.. (I know 'cause I patched X-Envelope-To: into sendmail, which
traces back through the entire chain to find that original address.)
Now, assumed that you're positive that backing out *just one* step
(where available) is going to reliably fix your problem, you could
change the source as follows (indentation reduced etc. to increase
readability):
From:
if (printheader)
{
putline(" ----- The following addresses [...]",
mci);
printheader = false;
}
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR),
sizeof buf);
putline(buf, mci);
if (q->q_rstatus != NULL)
{
[...]
}
if (q->q_alias != NULL)
{
(void) sm_snprintf(buf, sizeof buf,
" (expanded from: %s)",
shortenstring(q->q_alias->q_paddr,
MAXSHORTSTR));
putline(buf, mci);
}
Doing what:
-- Beefing up the sm_strlcpy() so that it will give the less expanded
address if available
-- Removing the (now useless) "if (q->q_alias != NULL)" part (that
used to create the "(expanded from: ...)" line)
To:
if (printheader)
{
putline(" ----- The following addresses [...]",
mci);
printheader = false;
}
(void) sm_strlcpy(buf, shortenstring(
( q->q_alias == NULL ? q->q_paddr : q->q_alias->q_paddr ),
MAXSHORTSTR),
sizeof buf);
putline(buf, mci);
if (q->q_rstatus != NULL)
{
[...]
}
Regards,
J. Bern
[ Post a follow-up to this message ]
|