diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-11-19 22:51:53 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-11-19 22:51:53 +0000 |
commit | 5e8fa01c2753fc4bceb8b69b1c2a603759b43fca (patch) | |
tree | 298efe59cca423a91484112b443e4e166fbb72a6 /driver.c | |
parent | e9cb1840da3f730aba53e1b0f1e363e8c6d497e4 (diff) | |
download | fetchmail-5e8fa01c2753fc4bceb8b69b1c2a603759b43fca.tar.gz fetchmail-5e8fa01c2753fc4bceb8b69b1c2a603759b43fca.tar.bz2 fetchmail-5e8fa01c2753fc4bceb8b69b1c2a603759b43fca.zip |
First hack at deducing envelope From.
svn path=/trunk/; revision=558
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -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) |