From 5e8fa01c2753fc4bceb8b69b1c2a603759b43fca Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 19 Nov 1996 22:51:53 +0000 Subject: First hack at deducing envelope From. svn path=/trunk/; revision=558 --- driver.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 3272f523..65d10ced 100644 --- a/driver.c +++ b/driver.c @@ -433,6 +433,8 @@ struct query *ctl; /* query control record */ } else { + char *ap; + /* build a connection to the SMTP listener */ if (ctl->mda[0] == '\0' && ((sinkfp = smtp_open(ctl)) == NULL)) { @@ -441,15 +443,17 @@ struct query *ctl; /* query control record */ return(PS_SMTP); } - /* - * We used to try parsing the From header address and using - * it here, but listeners were apt to think we were trying to - * forge mail or something. Screw it. The only place this - * will ever make a difference is in the Received headers, - * anyway. + /* + * Try to get the SMTP listener to take the header + * From address as MAIL FROM (this makes the logging + * nicer). If it won't, fall back on the calling-user + * ID. This won't affect replies, which use the header + * From address anyway. */ - if (SMTP_from(sinkfp, user) != SM_OK) - return(PS_SMTP); /* shouldn't happen */ + if (!fromhdr || !(ap = nxtaddr(fromhdr)) + || SMTP_from(sinkfp, ap) != SM_OK) + if (SMTP_from(sinkfp, user) != SM_OK) + return(PS_SMTP); /* should never happen */ /* now list the recipient addressees */ for (idp = xmit_names; idp; idp = idp->next) -- cgit v1.2.3