dovecot: If the first line begins with "From ", ignore it.

dovecot at dovecot.org dovecot at dovecot.org
Sat Sep 22 18:01:45 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/910aadd76897
changeset: 6471:910aadd76897
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Sep 22 18:01:37 2007 +0300
description:
If the first line begins with "From ", ignore it.

diffstat:

1 file changed, 15 insertions(+), 2 deletions(-)
src/deliver/deliver.c |   17 +++++++++++++++--

diffs (45 lines):

diff -r d2c37921f5f9 -r 910aadd76897 src/deliver/deliver.c
--- a/src/deliver/deliver.c	Sat Sep 22 17:54:58 2007 +0300
+++ b/src/deliver/deliver.c	Sat Sep 22 18:01:37 2007 +0300
@@ -17,6 +17,7 @@
 #include "strescape.h"
 #include "var-expand.h"
 #include "message-address.h"
+#include "message-header-parser.h"
 #include "istream-header-filter.h"
 #include "mbox-storage.h"
 #include "mail-namespace.h"
@@ -409,10 +410,22 @@ static const char *address_sanitize(cons
 	return ret;
 }
 
+
+static void save_header_callback(struct message_header_line *hdr,
+				 bool *matched, bool *first)
+{
+	if (*first) {
+		*first = FALSE;
+		if (hdr != NULL && strncmp(hdr->name, "From ", 5) == 0)
+			*matched = TRUE;
+	}
+}
+
 static struct istream *create_mbox_stream(int fd, const char *envelope_sender)
 {
 	const char *mbox_hdr;
 	struct istream *input_list[4], *input, *input_filter;
+	bool first = TRUE;
 
 	fd_set_nonblock(fd, FALSE);
 
@@ -426,8 +439,8 @@ static struct istream *create_mbox_strea
 					      HEADER_FILTER_NO_CR,
 					      mbox_hide_headers,
 					      mbox_hide_headers_count,
-					      null_header_filter_callback,
-					      NULL);
+					      save_header_callback,
+					      &first);
 	i_stream_unref(&input);
 
 	input_list[0] = i_stream_create_from_data(mbox_hdr, strlen(mbox_hdr));


More information about the dovecot-cvs mailing list