From fa085f58a31da4a28f3c75938ede3b01708b380b Mon Sep 17 00:00:00 2001 From: Eric Allman Date: Sat, 6 Mar 1993 16:32:12 -0800 Subject: [PATCH] allow host on local addresses; don't do domain extension on return path, ever -- for <> addresses SCCS-vsn: usr.sbin/sendmail/src/headers.c 6.15 SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 6.24 SCCS-vsn: usr.sbin/sendmail/src/deliver.c 6.37 --- usr/src/usr.sbin/sendmail/src/deliver.c | 6 +++--- usr/src/usr.sbin/sendmail/src/headers.c | 4 ++-- usr/src/usr.sbin/sendmail/src/parseaddr.c | 25 ++++++++++++----------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/usr/src/usr.sbin/sendmail/src/deliver.c b/usr/src/usr.sbin/sendmail/src/deliver.c index ff17df455a..c4f92f44c0 100644 --- a/usr/src/usr.sbin/sendmail/src/deliver.c +++ b/usr/src/usr.sbin/sendmail/src/deliver.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)deliver.c 6.36 (Berkeley) %G%"; +static char sccsid[] = "@(#)deliver.c 6.37 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" @@ -132,7 +132,7 @@ deliver(e, firstto) /* rewrite from address, using rewriting rules */ (void) strcpy(rpathbuf, remotename(e->e_returnpath, m, TRUE, FALSE, - TRUE, e)); + TRUE, FALSE, e)); if (e->e_returnpath == e->e_sender) { from = rpathbuf; @@ -140,7 +140,7 @@ deliver(e, firstto) else { (void) strcpy(tfrombuf, remotename(e->e_sender, m, TRUE, FALSE, - TRUE, e)); + TRUE, FALSE, e)); from = tfrombuf; } diff --git a/usr/src/usr.sbin/sendmail/src/headers.c b/usr/src/usr.sbin/sendmail/src/headers.c index 676b14f639..66498a84ec 100644 --- a/usr/src/usr.sbin/sendmail/src/headers.c +++ b/usr/src/usr.sbin/sendmail/src/headers.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)headers.c 6.14 (Berkeley) %G%"; +static char sccsid[] = "@(#)headers.c 6.15 (Berkeley) %G%"; #endif /* not lint */ # include @@ -867,7 +867,7 @@ commaize(h, p, fp, oldstyle, m, e) /* translate the name to be relative */ name = remotename(name, m, bitset(H_FROM, h->h_flags), - TRUE, FALSE, e); + TRUE, FALSE, TRUE, e); if (*name == '\0') { *p = savechar; diff --git a/usr/src/usr.sbin/sendmail/src/parseaddr.c b/usr/src/usr.sbin/sendmail/src/parseaddr.c index 4ee446616c..684cfbef5f 100644 --- a/usr/src/usr.sbin/sendmail/src/parseaddr.c +++ b/usr/src/usr.sbin/sendmail/src/parseaddr.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)parseaddr.c 6.23 (Berkeley) %G%"; +static char sccsid[] = "@(#)parseaddr.c 6.24 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" @@ -1562,11 +1562,6 @@ buildaddr(tv, a) /* figure out what host (if any) */ if (**++tv != CANONHOST) { - if (!bitnset(M_LOCAL, m->m_flags)) - { - syserr("554 buildaddr: no host"); - return (NULL); - } a->q_host = NULL; } else @@ -1719,13 +1714,17 @@ sameaddr(a, b) if (bitset(QGOODUID, a->q_flags & b->q_flags) && a->q_uid != b->q_uid) return (FALSE); - /* if the mailer ignores hosts, we have succeeded! */ - if (bitnset(M_LOCALMAILER, a->q_mailer->m_flags)) - return (TRUE); - /* otherwise compare hosts (but be careful for NULL ptrs) */ + if (a->q_host == b->q_host) + { + /* probably both null pointers */ + return (TRUE); + } if (a->q_host == NULL || b->q_host == NULL) + { + /* only one is a null pointer */ return (FALSE); + } if (strcasecmp(a->q_host, b->q_host)) return (FALSE); @@ -1806,6 +1805,7 @@ printaddr(a, follow) ** than an envelope header. ** canonical -- if set, strip out any comment information, ** etc. +** adddomain -- if set, OK to do domain extension. ** e -- the current envelope. ** ** Returns: @@ -1821,12 +1821,13 @@ printaddr(a, follow) */ char * -remotename(name, m, senderaddress, header, canonical, e) +remotename(name, m, senderaddress, header, canonical, adddomain, e) char *name; MAILER *m; bool senderaddress; bool header; bool canonical; + bool adddomain; register ENVELOPE *e; { register char **pvp; @@ -1866,7 +1867,7 @@ remotename(name, m, senderaddress, header, canonical, e) if (pvp == NULL) return (name); rewrite(pvp, 3); - if (e->e_fromdomain != NULL) + if (adddomain && e->e_fromdomain != NULL) { /* append from domain to this address */ register char **pxp = pvp; -- 2.20.1