diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-09-02 21:04:12 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-09-02 21:04:12 +0000 |
commit | ac2268d8876ee35d34cc8a9a412388d74e61360c (patch) | |
tree | 03fb41c93d3a36fb439dbf004326a27a6a6fbd0f | |
parent | 9a9c6a0e31cb1dd4854cbdf003ccb1df66262c9d (diff) |
Prepend Delivered-To, not append. Discussed with gilles@.
-rw-r--r-- | usr.sbin/smtpd/store.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/usr.sbin/smtpd/store.c b/usr.sbin/smtpd/store.c index 1ddf8428ee6..1457e081e09 100644 --- a/usr.sbin/smtpd/store.c +++ b/usr.sbin/smtpd/store.c @@ -1,4 +1,4 @@ -/* $OpenBSD: store.c,v 1.27 2009/09/02 10:00:58 jacekm Exp $ */ +/* $OpenBSD: store.c,v 1.28 2009/09/02 21:04:11 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -44,7 +44,10 @@ file_copy(FILE *dest, FILE *src, struct path *path, enum action_type type, int s char *buf, *lbuf; size_t len; char *escape; - int inheaders = 1; + + if (!session && path && fprintf(dest, "Delivered-To: %s@%s\n", + path->user, path->domain) == -1) + return 0; lbuf = NULL; while ((buf = fgetln(src, &len))) { @@ -61,20 +64,6 @@ file_copy(FILE *dest, FILE *src, struct path *path, enum action_type type, int s buf = lbuf; } - /* If we are NOT dealing with a mailer daemon copy, we have - * path set to the original recipient. In that case, we can - * add the Delivered-To header to help loop detection. - */ - if (!session && path != NULL && inheaders && - (*buf == '\0' || - (!isspace((int)*buf) && - strchr(buf, ':') == NULL))) { - if (fprintf(dest, "Delivered-To: %s@%s\n", - path->user, path->domain) == -1) - return 0; - inheaders = 0; - } - if (!session && type == A_MBOX) { escape = buf; while (*escape == '>') |