dovecot-2.2: mail-filter: If filter returns 0 bytes, treat it as...

dovecot at dovecot.org dovecot at dovecot.org
Tue Dec 17 21:33:43 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/ba855eac00db
changeset: 17065:ba855eac00db
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Dec 17 21:33:32 2013 +0200
description:
mail-filter: If filter returns 0 bytes, treat it as EIO error.

diffstat:

 src/plugins/mail-filter/istream-ext-filter.c |  7 +++++++
 src/plugins/mail-filter/ostream-ext-filter.c |  8 ++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r b31f2a0b1273 -r ba855eac00db src/plugins/mail-filter/istream-ext-filter.c
--- a/src/plugins/mail-filter/istream-ext-filter.c	Sat Dec 14 14:40:13 2013 +0200
+++ b/src/plugins/mail-filter/istream-ext-filter.c	Tue Dec 17 21:33:32 2013 +0200
@@ -118,6 +118,13 @@
 		if (!stream->istream.blocking)
 			break;
 	}
+	if (ret == -1 && !i_stream_have_bytes_left(&stream->istream) &&
+	    stream->istream.v_offset == 0) {
+		/* EOF without any input -> assume the script is repoting
+		   failure. pretty ugly way, but currently there's no error
+		   reporting channel. */
+		stream->istream.stream_errno = EIO;
+	}
 	return ret;
 }
 
diff -r b31f2a0b1273 -r ba855eac00db src/plugins/mail-filter/ostream-ext-filter.c
--- a/src/plugins/mail-filter/ostream-ext-filter.c	Sat Dec 14 14:40:13 2013 +0200
+++ b/src/plugins/mail-filter/ostream-ext-filter.c	Tue Dec 17 21:33:32 2013 +0200
@@ -93,6 +93,14 @@
 	}
 	i_assert(ret == -1);
 
+	if (!i_stream_have_bytes_left(mstream->ext_in) &&
+	    mstream->ext_in->v_offset == 0) {
+		/* EOF without any input -> assume the script is repoting
+		   failure. pretty ugly way, but currently there's no error
+		   reporting channel. */
+		stream->ostream.stream_errno = EIO;
+		return -1;
+	}
 	if (mstream->ext_in->stream_errno != 0) {
 		stream->ostream.stream_errno = mstream->ext_in->stream_errno;
 		return -1;


More information about the dovecot-cvs mailing list