From 00e5e338fb1ee4224b1f29aac8ed3eeaa5e4d63d Mon Sep 17 00:00:00 2001 From: Oleg Safiullin Date: Fri, 30 Jan 2009 20:11:14 +0000 Subject: Do not break header for messages received via smtp. look ok gilles@ --- usr.sbin/smtpd/smtpd.h | 4 ++-- usr.sbin/smtpd/store.c | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) (limited to 'usr.sbin/smtpd') diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 2c6da0c217d..e2446f51438 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.64 2009/01/30 17:34:58 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.65 2009/01/30 20:11:13 form Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -835,7 +835,7 @@ void session_respond(struct session *, char *, ...) SPLAY_PROTOTYPE(sessiontree, session, s_nodes, session_cmp); /* store.c */ -int store_write_header(struct batch *, struct message *, FILE *); +int store_write_header(struct batch *, struct message *, FILE *, int); int store_write_message(struct batch *, struct message *); int store_write_daemon(struct batch *, struct message *); int store_message(struct batch *, struct message *, diff --git a/usr.sbin/smtpd/store.c b/usr.sbin/smtpd/store.c index 4d1ac9b1751..517aa814084 100644 --- a/usr.sbin/smtpd/store.c +++ b/usr.sbin/smtpd/store.c @@ -1,4 +1,4 @@ -/* $OpenBSD: store.c,v 1.12 2009/01/29 15:20:34 gilles Exp $ */ +/* $OpenBSD: store.c,v 1.13 2009/01/30 20:11:13 form Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -84,7 +84,8 @@ file_copy(FILE *dest, FILE *src, enum action_type type) } int -store_write_header(struct batch *batchp, struct message *messagep, FILE *fp) +store_write_header(struct batch *batchp, struct message *messagep, FILE *fp, + int finalize) { time_t tm; char timebuf[26]; /* current time */ @@ -125,12 +126,13 @@ store_write_header(struct batch *batchp, struct message *messagep, FILE *fp) } if (fprintf(fp, "Received: from %s (%s [%s%s])\n" - "\tby %s with ESMTP id %s\n" - "\tfor <%s@%s>; %s\n\n", - messagep->session_helo, messagep->session_hostname, - messagep->session_ss.ss_family == PF_INET ? "" : "IPv6:", addrbuf, - batchp->env->sc_hostname, messagep->message_id, - messagep->sender.user, messagep->sender.domain, ctimebuf) == -1) { + "\tby %s with ESMTP id %s\n" + "\tfor <%s@%s>; %s\n%s", + messagep->session_helo, messagep->session_hostname, + messagep->session_ss.ss_family == PF_INET ? "" : "IPv6:", addrbuf, + batchp->env->sc_hostname, messagep->message_id, + messagep->sender.user, messagep->sender.domain, ctimebuf, + finalize ? "\n" : "") == -1) { return 0; } return 1; @@ -152,7 +154,7 @@ store_write_daemon(struct batch *batchp, struct message *messagep) if (messagefp == NULL) goto bad; - if (! store_write_header(batchp, messagep, mboxfp)) + if (! store_write_header(batchp, messagep, mboxfp, 1)) goto bad; if (fprintf(mboxfp, "Hi !\n\n" @@ -248,7 +250,7 @@ store_write_message(struct batch *batchp, struct message *messagep) if (messagefp == NULL) goto bad; - if (! store_write_header(batchp, messagep, mboxfp)) + if (! store_write_header(batchp, messagep, mboxfp, 0)) goto bad; if (! file_copy(mboxfp, messagefp, messagep->recipient.rule.r_action)) -- cgit v1.2.3