aboutsummaryrefslogtreecommitdiffstats
path: root/driver.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-09-22 22:00:14 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-09-22 22:00:14 +0000
commit8007777ca19376bb0f7463815853ff70884afb83 (patch)
treef5802bfbfd7910456d9211dca587cd712b75d183 /driver.c
parentf6f9f34d1098a625489805bdf32c14fa502eb81a (diff)
downloadfetchmail-8007777ca19376bb0f7463815853ff70884afb83.tar.gz
fetchmail-8007777ca19376bb0f7463815853ff70884afb83.tar.bz2
fetchmail-8007777ca19376bb0f7463815853ff70884afb83.zip
Add new Received header.
svn path=/trunk/; revision=1386
Diffstat (limited to 'driver.c')
-rw-r--r--driver.c54
1 files changed, 33 insertions, 21 deletions
diff --git a/driver.c b/driver.c
index 79a95b64..fab75611 100644
--- a/driver.c
+++ b/driver.c
@@ -1042,31 +1042,43 @@ int num; /* index of message */
}
}
+ /* utter any per-message Received information we need here */
+ {
+ time_t now;
+
+ /* write a line describing fetchmail's processing of the message */
+ sprintf(buf,
+ "Received: from %s\r\n\tby %s (fetchmail-%s/%s) running as %s\r\n",
+ ctl->server.truename,
+ fetchmailhost,
+ RELEASE_ID,
+ protocol->name,
+ ctl->remotename);
+ if (!good_addresses)
+ sprintf(buf + strlen(buf),
+ "\tfor <%s@%s> (by default); ",
+ user, desthost);
+ if (good_addresses == 1)
+ {
+ for (idp = xmit_names; idp; idp = idp->next)
+ if (idp->val.num == XMIT_ACCEPT)
+ {
+ sprintf(buf + strlen(buf),
+ "\tfor <%s@%s>; ", idp->id, desthost);
+ break;
+ }
+ }
+ time(&now);
+ strcat(buf, ctime(&now));
+ strcpy(buf + strlen(buf) - 1, "\r\n");
+ }
+
/* tell it we're ready to send data */
SMTP_data(ctl->smtp_socket);
}
- /* we may need to strip carriage returns */
- if (ctl->stripcr)
- {
- char *sp, *tp;
-
- for (sp = tp = headers; *sp; sp++)
- if (*sp != '\r')
- *tp++ = *sp;
- *tp = '\0';
-
- }
-
- /* write all the headers */
- n = 0;
- if (ctl->mda && sinkfp)
- n = fwrite(headers, 1, strlen(headers), sinkfp);
- else if (ctl->smtp_socket != -1)
- n = SockWrite(ctl->smtp_socket, headers, strlen(headers));
- free(headers);
-
- if (n < 0)
+ /* ship out the synthetic Received line and the headers */
+ if (stuffline(ctl, buf) < 0 || stuffline(ctl, headers) < 0)
{
error(0, errno, "writing RFC822 headers");
if (ctl->mda)